]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Merge remote-tracking branch 'upstream/pull/5987'
[rails.git] / vendor / assets / iD / iD.js
1 "use strict";
2 (() => {
3   var __create = Object.create;
4   var __defProp = Object.defineProperty;
5   var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6   var __getOwnPropNames = Object.getOwnPropertyNames;
7   var __getProtoOf = Object.getPrototypeOf;
8   var __hasOwnProp = Object.prototype.hasOwnProperty;
9   var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10   var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
11     get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
12   }) : x2)(function(x2) {
13     if (typeof require !== "undefined") return require.apply(this, arguments);
14     throw Error('Dynamic require of "' + x2 + '" is not supported');
15   });
16   var __glob = (map2) => (path) => {
17     var fn = map2[path];
18     if (fn) return fn();
19     throw new Error("Module not found in bundle: " + path);
20   };
21   var __esm = (fn, res) => function __init() {
22     return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
23   };
24   var __commonJS = (cb, mod) => function __require2() {
25     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26   };
27   var __export = (target, all) => {
28     for (var name in all)
29       __defProp(target, name, { get: all[name], enumerable: true });
30   };
31   var __copyProps = (to, from, except, desc) => {
32     if (from && typeof from === "object" || typeof from === "function") {
33       for (let key of __getOwnPropNames(from))
34         if (!__hasOwnProp.call(to, key) && key !== except)
35           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36     }
37     return to;
38   };
39   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
40     // If the importer is in node compatibility mode or this is not an ESM
41     // file that has been converted to a CommonJS file using a Babel-
42     // compatible transform (i.e. "__esModule" has not been set), then set
43     // "default" to the CommonJS "module.exports" for node compatibility.
44     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
45     mod
46   ));
47   var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
48
49   // node_modules/whatwg-fetch/fetch.js
50   function isDataView(obj) {
51     return obj && DataView.prototype.isPrototypeOf(obj);
52   }
53   function normalizeName(name) {
54     if (typeof name !== "string") {
55       name = String(name);
56     }
57     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
58       throw new TypeError('Invalid character in header field name: "' + name + '"');
59     }
60     return name.toLowerCase();
61   }
62   function normalizeValue(value) {
63     if (typeof value !== "string") {
64       value = String(value);
65     }
66     return value;
67   }
68   function iteratorFor(items) {
69     var iterator = {
70       next: function() {
71         var value = items.shift();
72         return { done: value === void 0, value };
73       }
74     };
75     if (support.iterable) {
76       iterator[Symbol.iterator] = function() {
77         return iterator;
78       };
79     }
80     return iterator;
81   }
82   function Headers(headers) {
83     this.map = {};
84     if (headers instanceof Headers) {
85       headers.forEach(function(value, name) {
86         this.append(name, value);
87       }, this);
88     } else if (Array.isArray(headers)) {
89       headers.forEach(function(header) {
90         if (header.length != 2) {
91           throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
92         }
93         this.append(header[0], header[1]);
94       }, this);
95     } else if (headers) {
96       Object.getOwnPropertyNames(headers).forEach(function(name) {
97         this.append(name, headers[name]);
98       }, this);
99     }
100   }
101   function consumed(body) {
102     if (body._noBody) return;
103     if (body.bodyUsed) {
104       return Promise.reject(new TypeError("Already read"));
105     }
106     body.bodyUsed = true;
107   }
108   function fileReaderReady(reader) {
109     return new Promise(function(resolve, reject) {
110       reader.onload = function() {
111         resolve(reader.result);
112       };
113       reader.onerror = function() {
114         reject(reader.error);
115       };
116     });
117   }
118   function readBlobAsArrayBuffer(blob) {
119     var reader = new FileReader();
120     var promise = fileReaderReady(reader);
121     reader.readAsArrayBuffer(blob);
122     return promise;
123   }
124   function readBlobAsText(blob) {
125     var reader = new FileReader();
126     var promise = fileReaderReady(reader);
127     var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
128     var encoding = match ? match[1] : "utf-8";
129     reader.readAsText(blob, encoding);
130     return promise;
131   }
132   function readArrayBufferAsText(buf) {
133     var view = new Uint8Array(buf);
134     var chars = new Array(view.length);
135     for (var i3 = 0; i3 < view.length; i3++) {
136       chars[i3] = String.fromCharCode(view[i3]);
137     }
138     return chars.join("");
139   }
140   function bufferClone(buf) {
141     if (buf.slice) {
142       return buf.slice(0);
143     } else {
144       var view = new Uint8Array(buf.byteLength);
145       view.set(new Uint8Array(buf));
146       return view.buffer;
147     }
148   }
149   function Body() {
150     this.bodyUsed = false;
151     this._initBody = function(body) {
152       this.bodyUsed = this.bodyUsed;
153       this._bodyInit = body;
154       if (!body) {
155         this._noBody = true;
156         this._bodyText = "";
157       } else if (typeof body === "string") {
158         this._bodyText = body;
159       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
160         this._bodyBlob = body;
161       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
162         this._bodyFormData = body;
163       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
164         this._bodyText = body.toString();
165       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
166         this._bodyArrayBuffer = bufferClone(body.buffer);
167         this._bodyInit = new Blob([this._bodyArrayBuffer]);
168       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
169         this._bodyArrayBuffer = bufferClone(body);
170       } else {
171         this._bodyText = body = Object.prototype.toString.call(body);
172       }
173       if (!this.headers.get("content-type")) {
174         if (typeof body === "string") {
175           this.headers.set("content-type", "text/plain;charset=UTF-8");
176         } else if (this._bodyBlob && this._bodyBlob.type) {
177           this.headers.set("content-type", this._bodyBlob.type);
178         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
179           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
180         }
181       }
182     };
183     if (support.blob) {
184       this.blob = function() {
185         var rejected = consumed(this);
186         if (rejected) {
187           return rejected;
188         }
189         if (this._bodyBlob) {
190           return Promise.resolve(this._bodyBlob);
191         } else if (this._bodyArrayBuffer) {
192           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
193         } else if (this._bodyFormData) {
194           throw new Error("could not read FormData body as blob");
195         } else {
196           return Promise.resolve(new Blob([this._bodyText]));
197         }
198       };
199     }
200     this.arrayBuffer = function() {
201       if (this._bodyArrayBuffer) {
202         var isConsumed = consumed(this);
203         if (isConsumed) {
204           return isConsumed;
205         } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
206           return Promise.resolve(
207             this._bodyArrayBuffer.buffer.slice(
208               this._bodyArrayBuffer.byteOffset,
209               this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
210             )
211           );
212         } else {
213           return Promise.resolve(this._bodyArrayBuffer);
214         }
215       } else if (support.blob) {
216         return this.blob().then(readBlobAsArrayBuffer);
217       } else {
218         throw new Error("could not read as ArrayBuffer");
219       }
220     };
221     this.text = function() {
222       var rejected = consumed(this);
223       if (rejected) {
224         return rejected;
225       }
226       if (this._bodyBlob) {
227         return readBlobAsText(this._bodyBlob);
228       } else if (this._bodyArrayBuffer) {
229         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
230       } else if (this._bodyFormData) {
231         throw new Error("could not read FormData body as text");
232       } else {
233         return Promise.resolve(this._bodyText);
234       }
235     };
236     if (support.formData) {
237       this.formData = function() {
238         return this.text().then(decode);
239       };
240     }
241     this.json = function() {
242       return this.text().then(JSON.parse);
243     };
244     return this;
245   }
246   function normalizeMethod(method) {
247     var upcased = method.toUpperCase();
248     return methods.indexOf(upcased) > -1 ? upcased : method;
249   }
250   function Request(input, options2) {
251     if (!(this instanceof Request)) {
252       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
253     }
254     options2 = options2 || {};
255     var body = options2.body;
256     if (input instanceof Request) {
257       if (input.bodyUsed) {
258         throw new TypeError("Already read");
259       }
260       this.url = input.url;
261       this.credentials = input.credentials;
262       if (!options2.headers) {
263         this.headers = new Headers(input.headers);
264       }
265       this.method = input.method;
266       this.mode = input.mode;
267       this.signal = input.signal;
268       if (!body && input._bodyInit != null) {
269         body = input._bodyInit;
270         input.bodyUsed = true;
271       }
272     } else {
273       this.url = String(input);
274     }
275     this.credentials = options2.credentials || this.credentials || "same-origin";
276     if (options2.headers || !this.headers) {
277       this.headers = new Headers(options2.headers);
278     }
279     this.method = normalizeMethod(options2.method || this.method || "GET");
280     this.mode = options2.mode || this.mode || null;
281     this.signal = options2.signal || this.signal || function() {
282       if ("AbortController" in g) {
283         var ctrl = new AbortController();
284         return ctrl.signal;
285       }
286     }();
287     this.referrer = null;
288     if ((this.method === "GET" || this.method === "HEAD") && body) {
289       throw new TypeError("Body not allowed for GET or HEAD requests");
290     }
291     this._initBody(body);
292     if (this.method === "GET" || this.method === "HEAD") {
293       if (options2.cache === "no-store" || options2.cache === "no-cache") {
294         var reParamSearch = /([?&])_=[^&]*/;
295         if (reParamSearch.test(this.url)) {
296           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
297         } else {
298           var reQueryString = /\?/;
299           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
300         }
301       }
302     }
303   }
304   function decode(body) {
305     var form = new FormData();
306     body.trim().split("&").forEach(function(bytes) {
307       if (bytes) {
308         var split = bytes.split("=");
309         var name = split.shift().replace(/\+/g, " ");
310         var value = split.join("=").replace(/\+/g, " ");
311         form.append(decodeURIComponent(name), decodeURIComponent(value));
312       }
313     });
314     return form;
315   }
316   function parseHeaders(rawHeaders) {
317     var headers = new Headers();
318     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
319     preProcessedHeaders.split("\r").map(function(header) {
320       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
321     }).forEach(function(line) {
322       var parts = line.split(":");
323       var key = parts.shift().trim();
324       if (key) {
325         var value = parts.join(":").trim();
326         try {
327           headers.append(key, value);
328         } catch (error) {
329           console.warn("Response " + error.message);
330         }
331       }
332     });
333     return headers;
334   }
335   function Response(bodyInit, options2) {
336     if (!(this instanceof Response)) {
337       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
338     }
339     if (!options2) {
340       options2 = {};
341     }
342     this.type = "default";
343     this.status = options2.status === void 0 ? 200 : options2.status;
344     if (this.status < 200 || this.status > 599) {
345       throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
346     }
347     this.ok = this.status >= 200 && this.status < 300;
348     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
349     this.headers = new Headers(options2.headers);
350     this.url = options2.url || "";
351     this._initBody(bodyInit);
352   }
353   function fetch2(input, init2) {
354     return new Promise(function(resolve, reject) {
355       var request3 = new Request(input, init2);
356       if (request3.signal && request3.signal.aborted) {
357         return reject(new DOMException2("Aborted", "AbortError"));
358       }
359       var xhr = new XMLHttpRequest();
360       function abortXhr() {
361         xhr.abort();
362       }
363       xhr.onload = function() {
364         var options2 = {
365           statusText: xhr.statusText,
366           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
367         };
368         if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
369           options2.status = 200;
370         } else {
371           options2.status = xhr.status;
372         }
373         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
374         var body = "response" in xhr ? xhr.response : xhr.responseText;
375         setTimeout(function() {
376           resolve(new Response(body, options2));
377         }, 0);
378       };
379       xhr.onerror = function() {
380         setTimeout(function() {
381           reject(new TypeError("Network request failed"));
382         }, 0);
383       };
384       xhr.ontimeout = function() {
385         setTimeout(function() {
386           reject(new TypeError("Network request timed out"));
387         }, 0);
388       };
389       xhr.onabort = function() {
390         setTimeout(function() {
391           reject(new DOMException2("Aborted", "AbortError"));
392         }, 0);
393       };
394       function fixUrl(url) {
395         try {
396           return url === "" && g.location.href ? g.location.href : url;
397         } catch (e3) {
398           return url;
399         }
400       }
401       xhr.open(request3.method, fixUrl(request3.url), true);
402       if (request3.credentials === "include") {
403         xhr.withCredentials = true;
404       } else if (request3.credentials === "omit") {
405         xhr.withCredentials = false;
406       }
407       if ("responseType" in xhr) {
408         if (support.blob) {
409           xhr.responseType = "blob";
410         } else if (support.arrayBuffer) {
411           xhr.responseType = "arraybuffer";
412         }
413       }
414       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
415         var names = [];
416         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
417           names.push(normalizeName(name));
418           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
419         });
420         request3.headers.forEach(function(value, name) {
421           if (names.indexOf(name) === -1) {
422             xhr.setRequestHeader(name, value);
423           }
424         });
425       } else {
426         request3.headers.forEach(function(value, name) {
427           xhr.setRequestHeader(name, value);
428         });
429       }
430       if (request3.signal) {
431         request3.signal.addEventListener("abort", abortXhr);
432         xhr.onreadystatechange = function() {
433           if (xhr.readyState === 4) {
434             request3.signal.removeEventListener("abort", abortXhr);
435           }
436         };
437       }
438       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
439     });
440   }
441   var g, support, viewClasses, isArrayBufferView, methods, redirectStatuses, DOMException2;
442   var init_fetch = __esm({
443     "node_modules/whatwg-fetch/fetch.js"() {
444       g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
445       typeof global !== "undefined" && global || {};
446       support = {
447         searchParams: "URLSearchParams" in g,
448         iterable: "Symbol" in g && "iterator" in Symbol,
449         blob: "FileReader" in g && "Blob" in g && function() {
450           try {
451             new Blob();
452             return true;
453           } catch (e3) {
454             return false;
455           }
456         }(),
457         formData: "FormData" in g,
458         arrayBuffer: "ArrayBuffer" in g
459       };
460       if (support.arrayBuffer) {
461         viewClasses = [
462           "[object Int8Array]",
463           "[object Uint8Array]",
464           "[object Uint8ClampedArray]",
465           "[object Int16Array]",
466           "[object Uint16Array]",
467           "[object Int32Array]",
468           "[object Uint32Array]",
469           "[object Float32Array]",
470           "[object Float64Array]"
471         ];
472         isArrayBufferView = ArrayBuffer.isView || function(obj) {
473           return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
474         };
475       }
476       Headers.prototype.append = function(name, value) {
477         name = normalizeName(name);
478         value = normalizeValue(value);
479         var oldValue = this.map[name];
480         this.map[name] = oldValue ? oldValue + ", " + value : value;
481       };
482       Headers.prototype["delete"] = function(name) {
483         delete this.map[normalizeName(name)];
484       };
485       Headers.prototype.get = function(name) {
486         name = normalizeName(name);
487         return this.has(name) ? this.map[name] : null;
488       };
489       Headers.prototype.has = function(name) {
490         return this.map.hasOwnProperty(normalizeName(name));
491       };
492       Headers.prototype.set = function(name, value) {
493         this.map[normalizeName(name)] = normalizeValue(value);
494       };
495       Headers.prototype.forEach = function(callback, thisArg) {
496         for (var name in this.map) {
497           if (this.map.hasOwnProperty(name)) {
498             callback.call(thisArg, this.map[name], name, this);
499           }
500         }
501       };
502       Headers.prototype.keys = function() {
503         var items = [];
504         this.forEach(function(value, name) {
505           items.push(name);
506         });
507         return iteratorFor(items);
508       };
509       Headers.prototype.values = function() {
510         var items = [];
511         this.forEach(function(value) {
512           items.push(value);
513         });
514         return iteratorFor(items);
515       };
516       Headers.prototype.entries = function() {
517         var items = [];
518         this.forEach(function(value, name) {
519           items.push([name, value]);
520         });
521         return iteratorFor(items);
522       };
523       if (support.iterable) {
524         Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
525       }
526       methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
527       Request.prototype.clone = function() {
528         return new Request(this, { body: this._bodyInit });
529       };
530       Body.call(Request.prototype);
531       Body.call(Response.prototype);
532       Response.prototype.clone = function() {
533         return new Response(this._bodyInit, {
534           status: this.status,
535           statusText: this.statusText,
536           headers: new Headers(this.headers),
537           url: this.url
538         });
539       };
540       Response.error = function() {
541         var response = new Response(null, { status: 200, statusText: "" });
542         response.ok = false;
543         response.status = 0;
544         response.type = "error";
545         return response;
546       };
547       redirectStatuses = [301, 302, 303, 307, 308];
548       Response.redirect = function(url, status) {
549         if (redirectStatuses.indexOf(status) === -1) {
550           throw new RangeError("Invalid status code");
551         }
552         return new Response(null, { status, headers: { location: url } });
553       };
554       DOMException2 = g.DOMException;
555       try {
556         new DOMException2();
557       } catch (err) {
558         DOMException2 = function(message, name) {
559           this.message = message;
560           this.name = name;
561           var error = Error(message);
562           this.stack = error.stack;
563         };
564         DOMException2.prototype = Object.create(Error.prototype);
565         DOMException2.prototype.constructor = DOMException2;
566       }
567       fetch2.polyfill = true;
568       if (!g.fetch) {
569         g.fetch = fetch2;
570         g.Headers = Headers;
571         g.Request = Request;
572         g.Response = Response;
573       }
574     }
575   });
576
577   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
578   var init_polyfill_patch_fetch = __esm({
579     "node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js"() {
580       (function(factory) {
581         typeof define === "function" && define.amd ? define(factory) : factory();
582       })(function() {
583         "use strict";
584         function _arrayLikeToArray(r2, a2) {
585           (null == a2 || a2 > r2.length) && (a2 = r2.length);
586           for (var e3 = 0, n3 = Array(a2); e3 < a2; e3++) n3[e3] = r2[e3];
587           return n3;
588         }
589         function _assertThisInitialized(e3) {
590           if (void 0 === e3) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
591           return e3;
592         }
593         function _callSuper(t2, o2, e3) {
594           return o2 = _getPrototypeOf(o2), _possibleConstructorReturn(t2, _isNativeReflectConstruct() ? Reflect.construct(o2, e3 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e3));
595         }
596         function _classCallCheck(a2, n3) {
597           if (!(a2 instanceof n3)) throw new TypeError("Cannot call a class as a function");
598         }
599         function _defineProperties(e3, r2) {
600           for (var t2 = 0; t2 < r2.length; t2++) {
601             var o2 = r2[t2];
602             o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e3, _toPropertyKey(o2.key), o2);
603           }
604         }
605         function _createClass(e3, r2, t2) {
606           return r2 && _defineProperties(e3.prototype, r2), t2 && _defineProperties(e3, t2), Object.defineProperty(e3, "prototype", {
607             writable: false
608           }), e3;
609         }
610         function _createForOfIteratorHelper(r2, e3) {
611           var t2 = "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
612           if (!t2) {
613             if (Array.isArray(r2) || (t2 = _unsupportedIterableToArray(r2)) || e3 && r2 && "number" == typeof r2.length) {
614               t2 && (r2 = t2);
615               var n3 = 0, F2 = function() {
616               };
617               return {
618                 s: F2,
619                 n: function() {
620                   return n3 >= r2.length ? {
621                     done: true
622                   } : {
623                     done: false,
624                     value: r2[n3++]
625                   };
626                 },
627                 e: function(r3) {
628                   throw r3;
629                 },
630                 f: F2
631               };
632             }
633             throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
634           }
635           var o2, a2 = true, u2 = false;
636           return {
637             s: function() {
638               t2 = t2.call(r2);
639             },
640             n: function() {
641               var r3 = t2.next();
642               return a2 = r3.done, r3;
643             },
644             e: function(r3) {
645               u2 = true, o2 = r3;
646             },
647             f: function() {
648               try {
649                 a2 || null == t2.return || t2.return();
650               } finally {
651                 if (u2) throw o2;
652               }
653             }
654           };
655         }
656         function _get() {
657           return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function(e3, t2, r2) {
658             var p2 = _superPropBase(e3, t2);
659             if (p2) {
660               var n3 = Object.getOwnPropertyDescriptor(p2, t2);
661               return n3.get ? n3.get.call(arguments.length < 3 ? e3 : r2) : n3.value;
662             }
663           }, _get.apply(null, arguments);
664         }
665         function _getPrototypeOf(t2) {
666           return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
667             return t3.__proto__ || Object.getPrototypeOf(t3);
668           }, _getPrototypeOf(t2);
669         }
670         function _inherits(t2, e3) {
671           if ("function" != typeof e3 && null !== e3) throw new TypeError("Super expression must either be null or a function");
672           t2.prototype = Object.create(e3 && e3.prototype, {
673             constructor: {
674               value: t2,
675               writable: true,
676               configurable: true
677             }
678           }), Object.defineProperty(t2, "prototype", {
679             writable: false
680           }), e3 && _setPrototypeOf(t2, e3);
681         }
682         function _isNativeReflectConstruct() {
683           try {
684             var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
685             }));
686           } catch (t3) {
687           }
688           return (_isNativeReflectConstruct = function() {
689             return !!t2;
690           })();
691         }
692         function _possibleConstructorReturn(t2, e3) {
693           if (e3 && ("object" == typeof e3 || "function" == typeof e3)) return e3;
694           if (void 0 !== e3) throw new TypeError("Derived constructors may only return object or undefined");
695           return _assertThisInitialized(t2);
696         }
697         function _setPrototypeOf(t2, e3) {
698           return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e4) {
699             return t3.__proto__ = e4, t3;
700           }, _setPrototypeOf(t2, e3);
701         }
702         function _superPropBase(t2, o2) {
703           for (; !{}.hasOwnProperty.call(t2, o2) && null !== (t2 = _getPrototypeOf(t2)); ) ;
704           return t2;
705         }
706         function _superPropGet(t2, o2, e3, r2) {
707           var p2 = _get(_getPrototypeOf(1 & r2 ? t2.prototype : t2), o2, e3);
708           return 2 & r2 && "function" == typeof p2 ? function(t3) {
709             return p2.apply(e3, t3);
710           } : p2;
711         }
712         function _toPrimitive(t2, r2) {
713           if ("object" != typeof t2 || !t2) return t2;
714           var e3 = t2[Symbol.toPrimitive];
715           if (void 0 !== e3) {
716             var i3 = e3.call(t2, r2 || "default");
717             if ("object" != typeof i3) return i3;
718             throw new TypeError("@@toPrimitive must return a primitive value.");
719           }
720           return ("string" === r2 ? String : Number)(t2);
721         }
722         function _toPropertyKey(t2) {
723           var i3 = _toPrimitive(t2, "string");
724           return "symbol" == typeof i3 ? i3 : i3 + "";
725         }
726         function _unsupportedIterableToArray(r2, a2) {
727           if (r2) {
728             if ("string" == typeof r2) return _arrayLikeToArray(r2, a2);
729             var t2 = {}.toString.call(r2).slice(8, -1);
730             return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r2, a2) : void 0;
731           }
732         }
733         (function(self2) {
734           return {
735             NativeAbortSignal: self2.AbortSignal,
736             NativeAbortController: self2.AbortController
737           };
738         })(typeof self !== "undefined" ? self : global);
739         function createAbortEvent(reason) {
740           var event;
741           try {
742             event = new Event("abort");
743           } catch (e3) {
744             if (typeof document !== "undefined") {
745               if (!document.createEvent) {
746                 event = document.createEventObject();
747                 event.type = "abort";
748               } else {
749                 event = document.createEvent("Event");
750                 event.initEvent("abort", false, false);
751               }
752             } else {
753               event = {
754                 type: "abort",
755                 bubbles: false,
756                 cancelable: false
757               };
758             }
759           }
760           event.reason = reason;
761           return event;
762         }
763         function normalizeAbortReason(reason) {
764           if (reason === void 0) {
765             if (typeof document === "undefined") {
766               reason = new Error("This operation was aborted");
767               reason.name = "AbortError";
768             } else {
769               try {
770                 reason = new DOMException("signal is aborted without reason");
771                 Object.defineProperty(reason, "name", {
772                   value: "AbortError"
773                 });
774               } catch (err) {
775                 reason = new Error("This operation was aborted");
776                 reason.name = "AbortError";
777               }
778             }
779           }
780           return reason;
781         }
782         var Emitter = /* @__PURE__ */ function() {
783           function Emitter2() {
784             _classCallCheck(this, Emitter2);
785             Object.defineProperty(this, "listeners", {
786               value: {},
787               writable: true,
788               configurable: true
789             });
790           }
791           return _createClass(Emitter2, [{
792             key: "addEventListener",
793             value: function addEventListener(type2, callback, options2) {
794               if (!(type2 in this.listeners)) {
795                 this.listeners[type2] = [];
796               }
797               this.listeners[type2].push({
798                 callback,
799                 options: options2
800               });
801             }
802           }, {
803             key: "removeEventListener",
804             value: function removeEventListener(type2, callback) {
805               if (!(type2 in this.listeners)) {
806                 return;
807               }
808               var stack = this.listeners[type2];
809               for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
810                 if (stack[i3].callback === callback) {
811                   stack.splice(i3, 1);
812                   return;
813                 }
814               }
815             }
816           }, {
817             key: "dispatchEvent",
818             value: function dispatchEvent2(event) {
819               var _this = this;
820               if (!(event.type in this.listeners)) {
821                 return;
822               }
823               var stack = this.listeners[event.type];
824               var stackToCall = stack.slice();
825               var _loop = function _loop2() {
826                 var listener = stackToCall[i3];
827                 try {
828                   listener.callback.call(_this, event);
829                 } catch (e3) {
830                   Promise.resolve().then(function() {
831                     throw e3;
832                   });
833                 }
834                 if (listener.options && listener.options.once) {
835                   _this.removeEventListener(event.type, listener.callback);
836                 }
837               };
838               for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
839                 _loop();
840               }
841               return !event.defaultPrevented;
842             }
843           }]);
844         }();
845         var AbortSignal = /* @__PURE__ */ function(_Emitter) {
846           function AbortSignal2() {
847             var _this2;
848             _classCallCheck(this, AbortSignal2);
849             _this2 = _callSuper(this, AbortSignal2);
850             if (!_this2.listeners) {
851               Emitter.call(_this2);
852             }
853             Object.defineProperty(_this2, "aborted", {
854               value: false,
855               writable: true,
856               configurable: true
857             });
858             Object.defineProperty(_this2, "onabort", {
859               value: null,
860               writable: true,
861               configurable: true
862             });
863             Object.defineProperty(_this2, "reason", {
864               value: void 0,
865               writable: true,
866               configurable: true
867             });
868             return _this2;
869           }
870           _inherits(AbortSignal2, _Emitter);
871           return _createClass(AbortSignal2, [{
872             key: "toString",
873             value: function toString2() {
874               return "[object AbortSignal]";
875             }
876           }, {
877             key: "dispatchEvent",
878             value: function dispatchEvent2(event) {
879               if (event.type === "abort") {
880                 this.aborted = true;
881                 if (typeof this.onabort === "function") {
882                   this.onabort.call(this, event);
883                 }
884               }
885               _superPropGet(AbortSignal2, "dispatchEvent", this, 3)([event]);
886             }
887             /**
888              * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/throwIfAborted}
889              */
890           }, {
891             key: "throwIfAborted",
892             value: function throwIfAborted() {
893               var aborted = this.aborted, _this$reason = this.reason, reason = _this$reason === void 0 ? "Aborted" : _this$reason;
894               if (!aborted) return;
895               throw reason;
896             }
897             /**
898              * @see {@link https://developer.mozilla.org/zh-CN/docs/Web/API/AbortSignal/timeout_static}
899              * @param {number} time The "active" time in milliseconds before the returned {@link AbortSignal} will abort.
900              *                      The value must be within range of 0 and {@link Number.MAX_SAFE_INTEGER}.
901              * @returns {AbortSignal} The signal will abort with its {@link AbortSignal.reason} property set to a `TimeoutError` {@link DOMException} on timeout,
902              *                        or an `AbortError` {@link DOMException} if the operation was user-triggered.
903              */
904           }], [{
905             key: "timeout",
906             value: function timeout2(time) {
907               var controller = new AbortController2();
908               setTimeout(function() {
909                 return controller.abort(new DOMException("This signal is timeout in ".concat(time, "ms"), "TimeoutError"));
910               }, time);
911               return controller.signal;
912             }
913             /**
914              * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static}
915              * @param {Iterable<AbortSignal>} iterable An {@link Iterable} (such as an {@link Array}) of abort signals.
916              * @returns {AbortSignal} - **Already aborted**, if any of the abort signals given is already aborted.
917              *                          The returned {@link AbortSignal}'s reason will be already set to the `reason` of the first abort signal that was already aborted.
918              *                        - **Asynchronously aborted**, when any abort signal in `iterable` aborts.
919              *                          The `reason` will be set to the reason of the first abort signal that is aborted.
920              */
921           }, {
922             key: "any",
923             value: function any(iterable) {
924               var controller = new AbortController2();
925               function abort() {
926                 controller.abort(this.reason);
927                 clean2();
928               }
929               function clean2() {
930                 var _iterator = _createForOfIteratorHelper(iterable), _step;
931                 try {
932                   for (_iterator.s(); !(_step = _iterator.n()).done; ) {
933                     var signal2 = _step.value;
934                     signal2.removeEventListener("abort", abort);
935                   }
936                 } catch (err) {
937                   _iterator.e(err);
938                 } finally {
939                   _iterator.f();
940                 }
941               }
942               var _iterator2 = _createForOfIteratorHelper(iterable), _step2;
943               try {
944                 for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
945                   var signal = _step2.value;
946                   if (signal.aborted) {
947                     controller.abort(signal.reason);
948                     break;
949                   } else signal.addEventListener("abort", abort);
950                 }
951               } catch (err) {
952                 _iterator2.e(err);
953               } finally {
954                 _iterator2.f();
955               }
956               return controller.signal;
957             }
958           }]);
959         }(Emitter);
960         var AbortController2 = /* @__PURE__ */ function() {
961           function AbortController3() {
962             _classCallCheck(this, AbortController3);
963             Object.defineProperty(this, "signal", {
964               value: new AbortSignal(),
965               writable: true,
966               configurable: true
967             });
968           }
969           return _createClass(AbortController3, [{
970             key: "abort",
971             value: function abort(reason) {
972               var signalReason = normalizeAbortReason(reason);
973               var event = createAbortEvent(signalReason);
974               this.signal.reason = signalReason;
975               this.signal.dispatchEvent(event);
976             }
977           }, {
978             key: "toString",
979             value: function toString2() {
980               return "[object AbortController]";
981             }
982           }]);
983         }();
984         if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
985           AbortController2.prototype[Symbol.toStringTag] = "AbortController";
986           AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
987         }
988         function polyfillNeeded(self2) {
989           if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
990             console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
991             return true;
992           }
993           return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
994         }
995         function abortableFetchDecorator(patchTargets) {
996           if ("function" === typeof patchTargets) {
997             patchTargets = {
998               fetch: patchTargets
999             };
1000           }
1001           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;
1002           if (!polyfillNeeded({
1003             fetch: fetch3,
1004             Request: NativeRequest,
1005             AbortController: NativeAbortController,
1006             __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
1007           })) {
1008             return {
1009               fetch: fetch3,
1010               Request: Request2
1011             };
1012           }
1013           var Request2 = NativeRequest;
1014           if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
1015             Request2 = function Request3(input, init2) {
1016               var signal;
1017               if (init2 && init2.signal) {
1018                 signal = init2.signal;
1019                 delete init2.signal;
1020               }
1021               var request3 = new NativeRequest(input, init2);
1022               if (signal) {
1023                 Object.defineProperty(request3, "signal", {
1024                   writable: false,
1025                   enumerable: false,
1026                   configurable: true,
1027                   value: signal
1028                 });
1029               }
1030               return request3;
1031             };
1032             Request2.prototype = NativeRequest.prototype;
1033           }
1034           var realFetch = fetch3;
1035           var abortableFetch = function abortableFetch2(input, init2) {
1036             var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
1037             if (signal) {
1038               var abortError;
1039               try {
1040                 abortError = new DOMException("Aborted", "AbortError");
1041               } catch (err) {
1042                 abortError = new Error("Aborted");
1043                 abortError.name = "AbortError";
1044               }
1045               if (signal.aborted) {
1046                 return Promise.reject(abortError);
1047               }
1048               var cancellation = new Promise(function(_2, reject) {
1049                 signal.addEventListener("abort", function() {
1050                   return reject(abortError);
1051                 }, {
1052                   once: true
1053                 });
1054               });
1055               if (init2 && init2.signal) {
1056                 delete init2.signal;
1057               }
1058               return Promise.race([cancellation, realFetch(input, init2)]);
1059             }
1060             return realFetch(input, init2);
1061           };
1062           return {
1063             fetch: abortableFetch,
1064             Request: Request2
1065           };
1066         }
1067         (function(self2) {
1068           if (!polyfillNeeded(self2)) {
1069             return;
1070           }
1071           if (!self2.fetch) {
1072             console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
1073             return;
1074           }
1075           var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
1076           self2.fetch = fetch3;
1077           self2.Request = Request2;
1078           Object.defineProperty(self2, "AbortController", {
1079             writable: true,
1080             enumerable: false,
1081             configurable: true,
1082             value: AbortController2
1083           });
1084           Object.defineProperty(self2, "AbortSignal", {
1085             writable: true,
1086             enumerable: false,
1087             configurable: true,
1088             value: AbortSignal
1089           });
1090         })(typeof self !== "undefined" ? self : global);
1091       });
1092     }
1093   });
1094
1095   // modules/actions/add_entity.js
1096   var add_entity_exports = {};
1097   __export(add_entity_exports, {
1098     actionAddEntity: () => actionAddEntity
1099   });
1100   function actionAddEntity(way) {
1101     return function(graph) {
1102       return graph.replace(way);
1103     };
1104   }
1105   var init_add_entity = __esm({
1106     "modules/actions/add_entity.js"() {
1107       "use strict";
1108     }
1109   });
1110
1111   // modules/actions/reverse.js
1112   var reverse_exports = {};
1113   __export(reverse_exports, {
1114     actionReverse: () => actionReverse
1115   });
1116   function actionReverse(entityID, options2) {
1117     var numeric = /^([+\-]?)(?=[\d.])/;
1118     var directionKey = /direction$/;
1119     var keyReplacements = [
1120       [/:right$/, ":left"],
1121       [/:left$/, ":right"],
1122       [/:forward$/, ":backward"],
1123       [/:backward$/, ":forward"],
1124       [/:right:/, ":left:"],
1125       [/:left:/, ":right:"],
1126       [/:forward:/, ":backward:"],
1127       [/:backward:/, ":forward:"]
1128     ];
1129     var valueReplacements = {
1130       left: "right",
1131       right: "left",
1132       up: "down",
1133       down: "up",
1134       forward: "backward",
1135       backward: "forward",
1136       forwards: "backward",
1137       backwards: "forward"
1138     };
1139     const keysToKeepUnchanged = [
1140       // https://github.com/openstreetmap/iD/issues/10736
1141       /^red_turn:(right|left):?/
1142     ];
1143     const keyValuesToKeepUnchanged = [
1144       {
1145         keyRegex: /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/,
1146         prerequisiteTags: [{}]
1147       },
1148       {
1149         // Turn lanes are left/right to key (not way) direction - #5674
1150         keyRegex: /^turn:lanes:?/,
1151         prerequisiteTags: [{}]
1152       },
1153       {
1154         // https://github.com/openstreetmap/iD/issues/10128
1155         keyRegex: /^side$/,
1156         prerequisiteTags: [{ highway: "cyclist_waiting_aid" }]
1157       }
1158     ];
1159     var roleReplacements = {
1160       forward: "backward",
1161       backward: "forward",
1162       forwards: "backward",
1163       backwards: "forward"
1164     };
1165     var onewayReplacements = {
1166       yes: "-1",
1167       "1": "-1",
1168       "-1": "yes"
1169     };
1170     var compassReplacements = {
1171       N: "S",
1172       NNE: "SSW",
1173       NE: "SW",
1174       ENE: "WSW",
1175       E: "W",
1176       ESE: "WNW",
1177       SE: "NW",
1178       SSE: "NNW",
1179       S: "N",
1180       SSW: "NNE",
1181       SW: "NE",
1182       WSW: "ENE",
1183       W: "E",
1184       WNW: "ESE",
1185       NW: "SE",
1186       NNW: "SSE"
1187     };
1188     function reverseKey(key) {
1189       if (keysToKeepUnchanged.some((keyRegex) => keyRegex.test(key))) {
1190         return key;
1191       }
1192       for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
1193         var replacement = keyReplacements[i3];
1194         if (replacement[0].test(key)) {
1195           return key.replace(replacement[0], replacement[1]);
1196         }
1197       }
1198       return key;
1199     }
1200     function reverseValue(key, value, includeAbsolute, allTags) {
1201       for (let { keyRegex, prerequisiteTags } of keyValuesToKeepUnchanged) {
1202         if (keyRegex.test(key) && prerequisiteTags.some(
1203           (expectedTags) => Object.entries(expectedTags).every(([k2, v2]) => {
1204             return allTags[k2] && (v2 === "*" || allTags[k2] === v2);
1205           })
1206         )) {
1207           return value;
1208         }
1209       }
1210       if (key === "incline" && numeric.test(value)) {
1211         return value.replace(numeric, function(_2, sign2) {
1212           return sign2 === "-" ? "" : "-";
1213         });
1214       } else if (options2 && options2.reverseOneway && key === "oneway") {
1215         return onewayReplacements[value] || value;
1216       } else if (includeAbsolute && directionKey.test(key)) {
1217         return value.split(";").map((value2) => {
1218           if (compassReplacements[value2]) return compassReplacements[value2];
1219           var degrees3 = Number(value2);
1220           if (isFinite(degrees3)) {
1221             if (degrees3 < 180) {
1222               degrees3 += 180;
1223             } else {
1224               degrees3 -= 180;
1225             }
1226             return degrees3.toString();
1227           } else {
1228             return valueReplacements[value2] || value2;
1229           }
1230         }).join(";");
1231       }
1232       return valueReplacements[value] || value;
1233     }
1234     function reverseNodeTags(graph, nodeIDs) {
1235       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
1236         var node = graph.hasEntity(nodeIDs[i3]);
1237         if (!node || !Object.keys(node.tags).length) continue;
1238         var tags = {};
1239         for (var key in node.tags) {
1240           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID, node.tags);
1241         }
1242         graph = graph.replace(node.update({ tags }));
1243       }
1244       return graph;
1245     }
1246     function reverseWay(graph, way) {
1247       var nodes = way.nodes.slice().reverse();
1248       var tags = {};
1249       var role;
1250       for (var key in way.tags) {
1251         tags[reverseKey(key)] = reverseValue(key, way.tags[key], false, way.tags);
1252       }
1253       graph.parentRelations(way).forEach(function(relation) {
1254         relation.members.forEach(function(member, index) {
1255           if (member.id === way.id && (role = roleReplacements[member.role])) {
1256             relation = relation.updateMember({ role }, index);
1257             graph = graph.replace(relation);
1258           }
1259         });
1260       });
1261       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
1262     }
1263     var action = function(graph) {
1264       var entity = graph.entity(entityID);
1265       if (entity.type === "way") {
1266         return reverseWay(graph, entity);
1267       }
1268       return reverseNodeTags(graph, [entityID]);
1269     };
1270     action.disabled = function(graph) {
1271       var entity = graph.hasEntity(entityID);
1272       if (!entity || entity.type === "way") return false;
1273       for (var key in entity.tags) {
1274         var value = entity.tags[key];
1275         if (reverseKey(key) !== key || reverseValue(key, value, true, entity.tags) !== value) {
1276           return false;
1277         }
1278       }
1279       return "nondirectional_node";
1280     };
1281     action.entityID = function() {
1282       return entityID;
1283     };
1284     return action;
1285   }
1286   var init_reverse = __esm({
1287     "modules/actions/reverse.js"() {
1288       "use strict";
1289     }
1290   });
1291
1292   // node_modules/d3-array/src/ascending.js
1293   function ascending(a2, b2) {
1294     return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
1295   }
1296   var init_ascending = __esm({
1297     "node_modules/d3-array/src/ascending.js"() {
1298     }
1299   });
1300
1301   // node_modules/d3-array/src/descending.js
1302   function descending(a2, b2) {
1303     return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
1304   }
1305   var init_descending = __esm({
1306     "node_modules/d3-array/src/descending.js"() {
1307     }
1308   });
1309
1310   // node_modules/d3-array/src/bisector.js
1311   function bisector(f2) {
1312     let compare1, compare2, delta;
1313     if (f2.length !== 2) {
1314       compare1 = ascending;
1315       compare2 = (d2, x2) => ascending(f2(d2), x2);
1316       delta = (d2, x2) => f2(d2) - x2;
1317     } else {
1318       compare1 = f2 === ascending || f2 === descending ? f2 : zero;
1319       compare2 = f2;
1320       delta = f2;
1321     }
1322     function left(a2, x2, lo = 0, hi = a2.length) {
1323       if (lo < hi) {
1324         if (compare1(x2, x2) !== 0) return hi;
1325         do {
1326           const mid = lo + hi >>> 1;
1327           if (compare2(a2[mid], x2) < 0) lo = mid + 1;
1328           else hi = mid;
1329         } while (lo < hi);
1330       }
1331       return lo;
1332     }
1333     function right(a2, x2, lo = 0, hi = a2.length) {
1334       if (lo < hi) {
1335         if (compare1(x2, x2) !== 0) return hi;
1336         do {
1337           const mid = lo + hi >>> 1;
1338           if (compare2(a2[mid], x2) <= 0) lo = mid + 1;
1339           else hi = mid;
1340         } while (lo < hi);
1341       }
1342       return lo;
1343     }
1344     function center(a2, x2, lo = 0, hi = a2.length) {
1345       const i3 = left(a2, x2, lo, hi - 1);
1346       return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
1347     }
1348     return { left, center, right };
1349   }
1350   function zero() {
1351     return 0;
1352   }
1353   var init_bisector = __esm({
1354     "node_modules/d3-array/src/bisector.js"() {
1355       init_ascending();
1356       init_descending();
1357     }
1358   });
1359
1360   // node_modules/d3-array/src/number.js
1361   function number(x2) {
1362     return x2 === null ? NaN : +x2;
1363   }
1364   function* numbers(values, valueof) {
1365     if (valueof === void 0) {
1366       for (let value of values) {
1367         if (value != null && (value = +value) >= value) {
1368           yield value;
1369         }
1370       }
1371     } else {
1372       let index = -1;
1373       for (let value of values) {
1374         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
1375           yield value;
1376         }
1377       }
1378     }
1379   }
1380   var init_number = __esm({
1381     "node_modules/d3-array/src/number.js"() {
1382     }
1383   });
1384
1385   // node_modules/d3-array/src/bisect.js
1386   var ascendingBisect, bisectRight, bisectLeft, bisectCenter, bisect_default;
1387   var init_bisect = __esm({
1388     "node_modules/d3-array/src/bisect.js"() {
1389       init_ascending();
1390       init_bisector();
1391       init_number();
1392       ascendingBisect = bisector(ascending);
1393       bisectRight = ascendingBisect.right;
1394       bisectLeft = ascendingBisect.left;
1395       bisectCenter = bisector(number).center;
1396       bisect_default = bisectRight;
1397     }
1398   });
1399
1400   // node_modules/d3-array/src/fsum.js
1401   var Adder;
1402   var init_fsum = __esm({
1403     "node_modules/d3-array/src/fsum.js"() {
1404       Adder = class {
1405         constructor() {
1406           this._partials = new Float64Array(32);
1407           this._n = 0;
1408         }
1409         add(x2) {
1410           const p2 = this._partials;
1411           let i3 = 0;
1412           for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
1413             const y2 = p2[j2], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
1414             if (lo) p2[i3++] = lo;
1415             x2 = hi;
1416           }
1417           p2[i3] = x2;
1418           this._n = i3 + 1;
1419           return this;
1420         }
1421         valueOf() {
1422           const p2 = this._partials;
1423           let n3 = this._n, x2, y2, lo, hi = 0;
1424           if (n3 > 0) {
1425             hi = p2[--n3];
1426             while (n3 > 0) {
1427               x2 = hi;
1428               y2 = p2[--n3];
1429               hi = x2 + y2;
1430               lo = y2 - (hi - x2);
1431               if (lo) break;
1432             }
1433             if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
1434               y2 = lo * 2;
1435               x2 = hi + y2;
1436               if (y2 == x2 - hi) hi = x2;
1437             }
1438           }
1439           return hi;
1440         }
1441       };
1442     }
1443   });
1444
1445   // node_modules/d3-array/src/sort.js
1446   function compareDefined(compare2 = ascending) {
1447     if (compare2 === ascending) return ascendingDefined;
1448     if (typeof compare2 !== "function") throw new TypeError("compare is not a function");
1449     return (a2, b2) => {
1450       const x2 = compare2(a2, b2);
1451       if (x2 || x2 === 0) return x2;
1452       return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0);
1453     };
1454   }
1455   function ascendingDefined(a2, b2) {
1456     return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
1457   }
1458   var init_sort = __esm({
1459     "node_modules/d3-array/src/sort.js"() {
1460       init_ascending();
1461     }
1462   });
1463
1464   // node_modules/d3-array/src/ticks.js
1465   function tickSpec(start2, stop, count) {
1466     const step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
1467     let i1, i22, inc;
1468     if (power < 0) {
1469       inc = Math.pow(10, -power) / factor;
1470       i1 = Math.round(start2 * inc);
1471       i22 = Math.round(stop * inc);
1472       if (i1 / inc < start2) ++i1;
1473       if (i22 / inc > stop) --i22;
1474       inc = -inc;
1475     } else {
1476       inc = Math.pow(10, power) * factor;
1477       i1 = Math.round(start2 / inc);
1478       i22 = Math.round(stop / inc);
1479       if (i1 * inc < start2) ++i1;
1480       if (i22 * inc > stop) --i22;
1481     }
1482     if (i22 < i1 && 0.5 <= count && count < 2) return tickSpec(start2, stop, count * 2);
1483     return [i1, i22, inc];
1484   }
1485   function ticks(start2, stop, count) {
1486     stop = +stop, start2 = +start2, count = +count;
1487     if (!(count > 0)) return [];
1488     if (start2 === stop) return [start2];
1489     const reverse = stop < start2, [i1, i22, inc] = reverse ? tickSpec(stop, start2, count) : tickSpec(start2, stop, count);
1490     if (!(i22 >= i1)) return [];
1491     const n3 = i22 - i1 + 1, ticks2 = new Array(n3);
1492     if (reverse) {
1493       if (inc < 0) for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i22 - i3) / -inc;
1494       else for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i22 - i3) * inc;
1495     } else {
1496       if (inc < 0) for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i1 + i3) / -inc;
1497       else for (let i3 = 0; i3 < n3; ++i3) ticks2[i3] = (i1 + i3) * inc;
1498     }
1499     return ticks2;
1500   }
1501   function tickIncrement(start2, stop, count) {
1502     stop = +stop, start2 = +start2, count = +count;
1503     return tickSpec(start2, stop, count)[2];
1504   }
1505   function tickStep(start2, stop, count) {
1506     stop = +stop, start2 = +start2, count = +count;
1507     const reverse = stop < start2, inc = reverse ? tickIncrement(stop, start2, count) : tickIncrement(start2, stop, count);
1508     return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
1509   }
1510   var e10, e5, e2;
1511   var init_ticks = __esm({
1512     "node_modules/d3-array/src/ticks.js"() {
1513       e10 = Math.sqrt(50);
1514       e5 = Math.sqrt(10);
1515       e2 = Math.sqrt(2);
1516     }
1517   });
1518
1519   // node_modules/d3-array/src/max.js
1520   function max(values, valueof) {
1521     let max3;
1522     if (valueof === void 0) {
1523       for (const value of values) {
1524         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
1525           max3 = value;
1526         }
1527       }
1528     } else {
1529       let index = -1;
1530       for (let value of values) {
1531         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
1532           max3 = value;
1533         }
1534       }
1535     }
1536     return max3;
1537   }
1538   var init_max = __esm({
1539     "node_modules/d3-array/src/max.js"() {
1540     }
1541   });
1542
1543   // node_modules/d3-array/src/min.js
1544   function min(values, valueof) {
1545     let min3;
1546     if (valueof === void 0) {
1547       for (const value of values) {
1548         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
1549           min3 = value;
1550         }
1551       }
1552     } else {
1553       let index = -1;
1554       for (let value of values) {
1555         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
1556           min3 = value;
1557         }
1558       }
1559     }
1560     return min3;
1561   }
1562   var init_min = __esm({
1563     "node_modules/d3-array/src/min.js"() {
1564     }
1565   });
1566
1567   // node_modules/d3-array/src/quickselect.js
1568   function quickselect(array2, k2, left = 0, right = Infinity, compare2) {
1569     k2 = Math.floor(k2);
1570     left = Math.floor(Math.max(0, left));
1571     right = Math.floor(Math.min(array2.length - 1, right));
1572     if (!(left <= k2 && k2 <= right)) return array2;
1573     compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
1574     while (right > left) {
1575       if (right - left > 600) {
1576         const n3 = right - left + 1;
1577         const m2 = k2 - left + 1;
1578         const z2 = Math.log(n3);
1579         const s2 = 0.5 * Math.exp(2 * z2 / 3);
1580         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
1581         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
1582         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
1583         quickselect(array2, k2, newLeft, newRight, compare2);
1584       }
1585       const t2 = array2[k2];
1586       let i3 = left;
1587       let j2 = right;
1588       swap(array2, left, k2);
1589       if (compare2(array2[right], t2) > 0) swap(array2, left, right);
1590       while (i3 < j2) {
1591         swap(array2, i3, j2), ++i3, --j2;
1592         while (compare2(array2[i3], t2) < 0) ++i3;
1593         while (compare2(array2[j2], t2) > 0) --j2;
1594       }
1595       if (compare2(array2[left], t2) === 0) swap(array2, left, j2);
1596       else ++j2, swap(array2, j2, right);
1597       if (j2 <= k2) left = j2 + 1;
1598       if (k2 <= j2) right = j2 - 1;
1599     }
1600     return array2;
1601   }
1602   function swap(array2, i3, j2) {
1603     const t2 = array2[i3];
1604     array2[i3] = array2[j2];
1605     array2[j2] = t2;
1606   }
1607   var init_quickselect = __esm({
1608     "node_modules/d3-array/src/quickselect.js"() {
1609       init_sort();
1610     }
1611   });
1612
1613   // node_modules/d3-array/src/quantile.js
1614   function quantile(values, p2, valueof) {
1615     values = Float64Array.from(numbers(values, valueof));
1616     if (!(n3 = values.length) || isNaN(p2 = +p2)) return;
1617     if (p2 <= 0 || n3 < 2) return min(values);
1618     if (p2 >= 1) return max(values);
1619     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));
1620     return value0 + (value1 - value0) * (i3 - i0);
1621   }
1622   var init_quantile = __esm({
1623     "node_modules/d3-array/src/quantile.js"() {
1624       init_max();
1625       init_min();
1626       init_quickselect();
1627       init_number();
1628     }
1629   });
1630
1631   // node_modules/d3-array/src/median.js
1632   function median(values, valueof) {
1633     return quantile(values, 0.5, valueof);
1634   }
1635   var init_median = __esm({
1636     "node_modules/d3-array/src/median.js"() {
1637       init_quantile();
1638     }
1639   });
1640
1641   // node_modules/d3-array/src/merge.js
1642   function* flatten(arrays) {
1643     for (const array2 of arrays) {
1644       yield* array2;
1645     }
1646   }
1647   function merge(arrays) {
1648     return Array.from(flatten(arrays));
1649   }
1650   var init_merge = __esm({
1651     "node_modules/d3-array/src/merge.js"() {
1652     }
1653   });
1654
1655   // node_modules/d3-array/src/pairs.js
1656   function pairs(values, pairof = pair) {
1657     const pairs2 = [];
1658     let previous;
1659     let first = false;
1660     for (const value of values) {
1661       if (first) pairs2.push(pairof(previous, value));
1662       previous = value;
1663       first = true;
1664     }
1665     return pairs2;
1666   }
1667   function pair(a2, b2) {
1668     return [a2, b2];
1669   }
1670   var init_pairs = __esm({
1671     "node_modules/d3-array/src/pairs.js"() {
1672     }
1673   });
1674
1675   // node_modules/d3-array/src/range.js
1676   function range(start2, stop, step) {
1677     start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
1678     var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
1679     while (++i3 < n3) {
1680       range3[i3] = start2 + i3 * step;
1681     }
1682     return range3;
1683   }
1684   var init_range = __esm({
1685     "node_modules/d3-array/src/range.js"() {
1686     }
1687   });
1688
1689   // node_modules/d3-array/src/index.js
1690   var init_src = __esm({
1691     "node_modules/d3-array/src/index.js"() {
1692       init_bisect();
1693       init_ascending();
1694       init_bisector();
1695       init_descending();
1696       init_fsum();
1697       init_median();
1698       init_merge();
1699       init_pairs();
1700       init_range();
1701       init_ticks();
1702     }
1703   });
1704
1705   // node_modules/d3-geo/src/math.js
1706   function acos(x2) {
1707     return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
1708   }
1709   function asin(x2) {
1710     return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
1711   }
1712   var epsilon, epsilon2, pi, halfPi, quarterPi, tau, degrees, radians, abs, atan, atan2, cos, exp, log, sin, sign, sqrt, tan;
1713   var init_math = __esm({
1714     "node_modules/d3-geo/src/math.js"() {
1715       epsilon = 1e-6;
1716       epsilon2 = 1e-12;
1717       pi = Math.PI;
1718       halfPi = pi / 2;
1719       quarterPi = pi / 4;
1720       tau = pi * 2;
1721       degrees = 180 / pi;
1722       radians = pi / 180;
1723       abs = Math.abs;
1724       atan = Math.atan;
1725       atan2 = Math.atan2;
1726       cos = Math.cos;
1727       exp = Math.exp;
1728       log = Math.log;
1729       sin = Math.sin;
1730       sign = Math.sign || function(x2) {
1731         return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
1732       };
1733       sqrt = Math.sqrt;
1734       tan = Math.tan;
1735     }
1736   });
1737
1738   // node_modules/d3-geo/src/noop.js
1739   function noop() {
1740   }
1741   var init_noop = __esm({
1742     "node_modules/d3-geo/src/noop.js"() {
1743     }
1744   });
1745
1746   // node_modules/d3-geo/src/stream.js
1747   function streamGeometry(geometry, stream) {
1748     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
1749       streamGeometryType[geometry.type](geometry, stream);
1750     }
1751   }
1752   function streamLine(coordinates, stream, closed) {
1753     var i3 = -1, n3 = coordinates.length - closed, coordinate;
1754     stream.lineStart();
1755     while (++i3 < n3) coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
1756     stream.lineEnd();
1757   }
1758   function streamPolygon(coordinates, stream) {
1759     var i3 = -1, n3 = coordinates.length;
1760     stream.polygonStart();
1761     while (++i3 < n3) streamLine(coordinates[i3], stream, 1);
1762     stream.polygonEnd();
1763   }
1764   function stream_default(object, stream) {
1765     if (object && streamObjectType.hasOwnProperty(object.type)) {
1766       streamObjectType[object.type](object, stream);
1767     } else {
1768       streamGeometry(object, stream);
1769     }
1770   }
1771   var streamObjectType, streamGeometryType;
1772   var init_stream = __esm({
1773     "node_modules/d3-geo/src/stream.js"() {
1774       streamObjectType = {
1775         Feature: function(object, stream) {
1776           streamGeometry(object.geometry, stream);
1777         },
1778         FeatureCollection: function(object, stream) {
1779           var features = object.features, i3 = -1, n3 = features.length;
1780           while (++i3 < n3) streamGeometry(features[i3].geometry, stream);
1781         }
1782       };
1783       streamGeometryType = {
1784         Sphere: function(object, stream) {
1785           stream.sphere();
1786         },
1787         Point: function(object, stream) {
1788           object = object.coordinates;
1789           stream.point(object[0], object[1], object[2]);
1790         },
1791         MultiPoint: function(object, stream) {
1792           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1793           while (++i3 < n3) object = coordinates[i3], stream.point(object[0], object[1], object[2]);
1794         },
1795         LineString: function(object, stream) {
1796           streamLine(object.coordinates, stream, 0);
1797         },
1798         MultiLineString: function(object, stream) {
1799           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1800           while (++i3 < n3) streamLine(coordinates[i3], stream, 0);
1801         },
1802         Polygon: function(object, stream) {
1803           streamPolygon(object.coordinates, stream);
1804         },
1805         MultiPolygon: function(object, stream) {
1806           var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
1807           while (++i3 < n3) streamPolygon(coordinates[i3], stream);
1808         },
1809         GeometryCollection: function(object, stream) {
1810           var geometries = object.geometries, i3 = -1, n3 = geometries.length;
1811           while (++i3 < n3) streamGeometry(geometries[i3], stream);
1812         }
1813       };
1814     }
1815   });
1816
1817   // node_modules/d3-geo/src/area.js
1818   function areaRingStart() {
1819     areaStream.point = areaPointFirst;
1820   }
1821   function areaRingEnd() {
1822     areaPoint(lambda00, phi00);
1823   }
1824   function areaPointFirst(lambda, phi) {
1825     areaStream.point = areaPoint;
1826     lambda00 = lambda, phi00 = phi;
1827     lambda *= radians, phi *= radians;
1828     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
1829   }
1830   function areaPoint(lambda, phi) {
1831     lambda *= radians, phi *= radians;
1832     phi = phi / 2 + quarterPi;
1833     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);
1834     areaRingSum.add(atan2(v2, u2));
1835     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
1836   }
1837   function area_default(object) {
1838     areaSum = new Adder();
1839     stream_default(object, areaStream);
1840     return areaSum * 2;
1841   }
1842   var areaRingSum, areaSum, lambda00, phi00, lambda0, cosPhi0, sinPhi0, areaStream;
1843   var init_area = __esm({
1844     "node_modules/d3-geo/src/area.js"() {
1845       init_src();
1846       init_math();
1847       init_noop();
1848       init_stream();
1849       areaRingSum = new Adder();
1850       areaSum = new Adder();
1851       areaStream = {
1852         point: noop,
1853         lineStart: noop,
1854         lineEnd: noop,
1855         polygonStart: function() {
1856           areaRingSum = new Adder();
1857           areaStream.lineStart = areaRingStart;
1858           areaStream.lineEnd = areaRingEnd;
1859         },
1860         polygonEnd: function() {
1861           var areaRing = +areaRingSum;
1862           areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
1863           this.lineStart = this.lineEnd = this.point = noop;
1864         },
1865         sphere: function() {
1866           areaSum.add(tau);
1867         }
1868       };
1869     }
1870   });
1871
1872   // node_modules/d3-geo/src/cartesian.js
1873   function spherical(cartesian2) {
1874     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
1875   }
1876   function cartesian(spherical2) {
1877     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
1878     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
1879   }
1880   function cartesianDot(a2, b2) {
1881     return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
1882   }
1883   function cartesianCross(a2, b2) {
1884     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]];
1885   }
1886   function cartesianAddInPlace(a2, b2) {
1887     a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
1888   }
1889   function cartesianScale(vector, k2) {
1890     return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
1891   }
1892   function cartesianNormalizeInPlace(d2) {
1893     var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
1894     d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
1895   }
1896   var init_cartesian = __esm({
1897     "node_modules/d3-geo/src/cartesian.js"() {
1898       init_math();
1899     }
1900   });
1901
1902   // node_modules/d3-geo/src/bounds.js
1903   function boundsPoint(lambda, phi) {
1904     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
1905     if (phi < phi0) phi0 = phi;
1906     if (phi > phi1) phi1 = phi;
1907   }
1908   function linePoint(lambda, phi) {
1909     var p2 = cartesian([lambda * radians, phi * radians]);
1910     if (p0) {
1911       var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
1912       cartesianNormalizeInPlace(inflection);
1913       inflection = spherical(inflection);
1914       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
1915       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
1916         phii = inflection[1] * degrees;
1917         if (phii > phi1) phi1 = phii;
1918       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
1919         phii = -inflection[1] * degrees;
1920         if (phii < phi0) phi0 = phii;
1921       } else {
1922         if (phi < phi0) phi0 = phi;
1923         if (phi > phi1) phi1 = phi;
1924       }
1925       if (antimeridian) {
1926         if (lambda < lambda2) {
1927           if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
1928         } else {
1929           if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
1930         }
1931       } else {
1932         if (lambda1 >= lambda02) {
1933           if (lambda < lambda02) lambda02 = lambda;
1934           if (lambda > lambda1) lambda1 = lambda;
1935         } else {
1936           if (lambda > lambda2) {
1937             if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
1938           } else {
1939             if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
1940           }
1941         }
1942       }
1943     } else {
1944       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
1945     }
1946     if (phi < phi0) phi0 = phi;
1947     if (phi > phi1) phi1 = phi;
1948     p0 = p2, lambda2 = lambda;
1949   }
1950   function boundsLineStart() {
1951     boundsStream.point = linePoint;
1952   }
1953   function boundsLineEnd() {
1954     range2[0] = lambda02, range2[1] = lambda1;
1955     boundsStream.point = boundsPoint;
1956     p0 = null;
1957   }
1958   function boundsRingPoint(lambda, phi) {
1959     if (p0) {
1960       var delta = lambda - lambda2;
1961       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
1962     } else {
1963       lambda002 = lambda, phi002 = phi;
1964     }
1965     areaStream.point(lambda, phi);
1966     linePoint(lambda, phi);
1967   }
1968   function boundsRingStart() {
1969     areaStream.lineStart();
1970   }
1971   function boundsRingEnd() {
1972     boundsRingPoint(lambda002, phi002);
1973     areaStream.lineEnd();
1974     if (abs(deltaSum) > epsilon) lambda02 = -(lambda1 = 180);
1975     range2[0] = lambda02, range2[1] = lambda1;
1976     p0 = null;
1977   }
1978   function angle(lambda04, lambda12) {
1979     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
1980   }
1981   function rangeCompare(a2, b2) {
1982     return a2[0] - b2[0];
1983   }
1984   function rangeContains(range3, x2) {
1985     return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
1986   }
1987   function bounds_default(feature3) {
1988     var i3, n3, a2, b2, merged, deltaMax, delta;
1989     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
1990     ranges = [];
1991     stream_default(feature3, boundsStream);
1992     if (n3 = ranges.length) {
1993       ranges.sort(rangeCompare);
1994       for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
1995         b2 = ranges[i3];
1996         if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
1997           if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1];
1998           if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0];
1999         } else {
2000           merged.push(a2 = b2);
2001         }
2002       }
2003       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
2004         b2 = merged[i3];
2005         if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
2006       }
2007     }
2008     ranges = range2 = null;
2009     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
2010   }
2011   var lambda02, phi0, lambda1, phi1, lambda2, lambda002, phi002, p0, deltaSum, ranges, range2, boundsStream;
2012   var init_bounds = __esm({
2013     "node_modules/d3-geo/src/bounds.js"() {
2014       init_src();
2015       init_area();
2016       init_cartesian();
2017       init_math();
2018       init_stream();
2019       boundsStream = {
2020         point: boundsPoint,
2021         lineStart: boundsLineStart,
2022         lineEnd: boundsLineEnd,
2023         polygonStart: function() {
2024           boundsStream.point = boundsRingPoint;
2025           boundsStream.lineStart = boundsRingStart;
2026           boundsStream.lineEnd = boundsRingEnd;
2027           deltaSum = new Adder();
2028           areaStream.polygonStart();
2029         },
2030         polygonEnd: function() {
2031           areaStream.polygonEnd();
2032           boundsStream.point = boundsPoint;
2033           boundsStream.lineStart = boundsLineStart;
2034           boundsStream.lineEnd = boundsLineEnd;
2035           if (areaRingSum < 0) lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
2036           else if (deltaSum > epsilon) phi1 = 90;
2037           else if (deltaSum < -epsilon) phi0 = -90;
2038           range2[0] = lambda02, range2[1] = lambda1;
2039         },
2040         sphere: function() {
2041           lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
2042         }
2043       };
2044     }
2045   });
2046
2047   // node_modules/d3-geo/src/compose.js
2048   function compose_default(a2, b2) {
2049     function compose(x2, y2) {
2050       return x2 = a2(x2, y2), b2(x2[0], x2[1]);
2051     }
2052     if (a2.invert && b2.invert) compose.invert = function(x2, y2) {
2053       return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
2054     };
2055     return compose;
2056   }
2057   var init_compose = __esm({
2058     "node_modules/d3-geo/src/compose.js"() {
2059     }
2060   });
2061
2062   // node_modules/d3-geo/src/rotation.js
2063   function rotationIdentity(lambda, phi) {
2064     if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
2065     return [lambda, phi];
2066   }
2067   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
2068     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
2069   }
2070   function forwardRotationLambda(deltaLambda) {
2071     return function(lambda, phi) {
2072       lambda += deltaLambda;
2073       if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
2074       return [lambda, phi];
2075     };
2076   }
2077   function rotationLambda(deltaLambda) {
2078     var rotation = forwardRotationLambda(deltaLambda);
2079     rotation.invert = forwardRotationLambda(-deltaLambda);
2080     return rotation;
2081   }
2082   function rotationPhiGamma(deltaPhi, deltaGamma) {
2083     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
2084     function rotation(lambda, phi) {
2085       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
2086       return [
2087         atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
2088         asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
2089       ];
2090     }
2091     rotation.invert = function(lambda, phi) {
2092       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
2093       return [
2094         atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
2095         asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
2096       ];
2097     };
2098     return rotation;
2099   }
2100   function rotation_default(rotate) {
2101     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
2102     function forward(coordinates) {
2103       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
2104       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
2105     }
2106     forward.invert = function(coordinates) {
2107       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
2108       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
2109     };
2110     return forward;
2111   }
2112   var init_rotation = __esm({
2113     "node_modules/d3-geo/src/rotation.js"() {
2114       init_compose();
2115       init_math();
2116       rotationIdentity.invert = rotationIdentity;
2117     }
2118   });
2119
2120   // node_modules/d3-geo/src/circle.js
2121   function circleStream(stream, radius, delta, direction, t02, t12) {
2122     if (!delta) return;
2123     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
2124     if (t02 == null) {
2125       t02 = radius + direction * tau;
2126       t12 = radius - step / 2;
2127     } else {
2128       t02 = circleRadius(cosRadius, t02);
2129       t12 = circleRadius(cosRadius, t12);
2130       if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau;
2131     }
2132     for (var point, t2 = t02; direction > 0 ? t2 > t12 : t2 < t12; t2 -= step) {
2133       point = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
2134       stream.point(point[0], point[1]);
2135     }
2136   }
2137   function circleRadius(cosRadius, point) {
2138     point = cartesian(point), point[0] -= cosRadius;
2139     cartesianNormalizeInPlace(point);
2140     var radius = acos(-point[1]);
2141     return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
2142   }
2143   var init_circle = __esm({
2144     "node_modules/d3-geo/src/circle.js"() {
2145       init_cartesian();
2146       init_math();
2147     }
2148   });
2149
2150   // node_modules/d3-geo/src/clip/buffer.js
2151   function buffer_default() {
2152     var lines = [], line;
2153     return {
2154       point: function(x2, y2, m2) {
2155         line.push([x2, y2, m2]);
2156       },
2157       lineStart: function() {
2158         lines.push(line = []);
2159       },
2160       lineEnd: noop,
2161       rejoin: function() {
2162         if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
2163       },
2164       result: function() {
2165         var result = lines;
2166         lines = [];
2167         line = null;
2168         return result;
2169       }
2170     };
2171   }
2172   var init_buffer = __esm({
2173     "node_modules/d3-geo/src/clip/buffer.js"() {
2174       init_noop();
2175     }
2176   });
2177
2178   // node_modules/d3-geo/src/pointEqual.js
2179   function pointEqual_default(a2, b2) {
2180     return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
2181   }
2182   var init_pointEqual = __esm({
2183     "node_modules/d3-geo/src/pointEqual.js"() {
2184       init_math();
2185     }
2186   });
2187
2188   // node_modules/d3-geo/src/clip/rejoin.js
2189   function Intersection(point, points, other2, entry) {
2190     this.x = point;
2191     this.z = points;
2192     this.o = other2;
2193     this.e = entry;
2194     this.v = false;
2195     this.n = this.p = null;
2196   }
2197   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
2198     var subject = [], clip = [], i3, n3;
2199     segments.forEach(function(segment) {
2200       if ((n4 = segment.length - 1) <= 0) return;
2201       var n4, p02 = segment[0], p1 = segment[n4], x2;
2202       if (pointEqual_default(p02, p1)) {
2203         if (!p02[2] && !p1[2]) {
2204           stream.lineStart();
2205           for (i3 = 0; i3 < n4; ++i3) stream.point((p02 = segment[i3])[0], p02[1]);
2206           stream.lineEnd();
2207           return;
2208         }
2209         p1[0] += 2 * epsilon;
2210       }
2211       subject.push(x2 = new Intersection(p02, segment, null, true));
2212       clip.push(x2.o = new Intersection(p02, null, x2, false));
2213       subject.push(x2 = new Intersection(p1, segment, null, false));
2214       clip.push(x2.o = new Intersection(p1, null, x2, true));
2215     });
2216     if (!subject.length) return;
2217     clip.sort(compareIntersection2);
2218     link(subject);
2219     link(clip);
2220     for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
2221       clip[i3].e = startInside = !startInside;
2222     }
2223     var start2 = subject[0], points, point;
2224     while (1) {
2225       var current = start2, isSubject = true;
2226       while (current.v) if ((current = current.n) === start2) return;
2227       points = current.z;
2228       stream.lineStart();
2229       do {
2230         current.v = current.o.v = true;
2231         if (current.e) {
2232           if (isSubject) {
2233             for (i3 = 0, n3 = points.length; i3 < n3; ++i3) stream.point((point = points[i3])[0], point[1]);
2234           } else {
2235             interpolate(current.x, current.n.x, 1, stream);
2236           }
2237           current = current.n;
2238         } else {
2239           if (isSubject) {
2240             points = current.p.z;
2241             for (i3 = points.length - 1; i3 >= 0; --i3) stream.point((point = points[i3])[0], point[1]);
2242           } else {
2243             interpolate(current.x, current.p.x, -1, stream);
2244           }
2245           current = current.p;
2246         }
2247         current = current.o;
2248         points = current.z;
2249         isSubject = !isSubject;
2250       } while (!current.v);
2251       stream.lineEnd();
2252     }
2253   }
2254   function link(array2) {
2255     if (!(n3 = array2.length)) return;
2256     var n3, i3 = 0, a2 = array2[0], b2;
2257     while (++i3 < n3) {
2258       a2.n = b2 = array2[i3];
2259       b2.p = a2;
2260       a2 = b2;
2261     }
2262     a2.n = b2 = array2[0];
2263     b2.p = a2;
2264   }
2265   var init_rejoin = __esm({
2266     "node_modules/d3-geo/src/clip/rejoin.js"() {
2267       init_pointEqual();
2268       init_math();
2269     }
2270   });
2271
2272   // node_modules/d3-geo/src/polygonContains.js
2273   function longitude(point) {
2274     return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
2275   }
2276   function polygonContains_default(polygon2, point) {
2277     var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
2278     var sum = new Adder();
2279     if (sinPhi === 1) phi = halfPi + epsilon;
2280     else if (sinPhi === -1) phi = -halfPi - epsilon;
2281     for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
2282       if (!(m2 = (ring = polygon2[i3]).length)) continue;
2283       var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
2284       for (var j2 = 0; j2 < m2; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
2285         var point1 = ring[j2], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
2286         sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
2287         angle2 += antimeridian ? delta + sign2 * tau : delta;
2288         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
2289           var arc = cartesianCross(cartesian(point0), cartesian(point1));
2290           cartesianNormalizeInPlace(arc);
2291           var intersection2 = cartesianCross(normal, arc);
2292           cartesianNormalizeInPlace(intersection2);
2293           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection2[2]);
2294           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
2295             winding += antimeridian ^ delta >= 0 ? 1 : -1;
2296           }
2297         }
2298       }
2299     }
2300     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
2301   }
2302   var init_polygonContains = __esm({
2303     "node_modules/d3-geo/src/polygonContains.js"() {
2304       init_src();
2305       init_cartesian();
2306       init_math();
2307     }
2308   });
2309
2310   // node_modules/d3-geo/src/clip/index.js
2311   function clip_default(pointVisible, clipLine, interpolate, start2) {
2312     return function(sink) {
2313       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
2314       var clip = {
2315         point,
2316         lineStart,
2317         lineEnd,
2318         polygonStart: function() {
2319           clip.point = pointRing;
2320           clip.lineStart = ringStart;
2321           clip.lineEnd = ringEnd;
2322           segments = [];
2323           polygon2 = [];
2324         },
2325         polygonEnd: function() {
2326           clip.point = point;
2327           clip.lineStart = lineStart;
2328           clip.lineEnd = lineEnd;
2329           segments = merge(segments);
2330           var startInside = polygonContains_default(polygon2, start2);
2331           if (segments.length) {
2332             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2333             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
2334           } else if (startInside) {
2335             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2336             sink.lineStart();
2337             interpolate(null, null, 1, sink);
2338             sink.lineEnd();
2339           }
2340           if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
2341           segments = polygon2 = null;
2342         },
2343         sphere: function() {
2344           sink.polygonStart();
2345           sink.lineStart();
2346           interpolate(null, null, 1, sink);
2347           sink.lineEnd();
2348           sink.polygonEnd();
2349         }
2350       };
2351       function point(lambda, phi) {
2352         if (pointVisible(lambda, phi)) sink.point(lambda, phi);
2353       }
2354       function pointLine(lambda, phi) {
2355         line.point(lambda, phi);
2356       }
2357       function lineStart() {
2358         clip.point = pointLine;
2359         line.lineStart();
2360       }
2361       function lineEnd() {
2362         clip.point = point;
2363         line.lineEnd();
2364       }
2365       function pointRing(lambda, phi) {
2366         ring.push([lambda, phi]);
2367         ringSink.point(lambda, phi);
2368       }
2369       function ringStart() {
2370         ringSink.lineStart();
2371         ring = [];
2372       }
2373       function ringEnd() {
2374         pointRing(ring[0][0], ring[0][1]);
2375         ringSink.lineEnd();
2376         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point2;
2377         ring.pop();
2378         polygon2.push(ring);
2379         ring = null;
2380         if (!n3) return;
2381         if (clean2 & 1) {
2382           segment = ringSegments[0];
2383           if ((m2 = segment.length - 1) > 0) {
2384             if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
2385             sink.lineStart();
2386             for (i3 = 0; i3 < m2; ++i3) sink.point((point2 = segment[i3])[0], point2[1]);
2387             sink.lineEnd();
2388           }
2389           return;
2390         }
2391         if (n3 > 1 && clean2 & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
2392         segments.push(ringSegments.filter(validSegment));
2393       }
2394       return clip;
2395     };
2396   }
2397   function validSegment(segment) {
2398     return segment.length > 1;
2399   }
2400   function compareIntersection(a2, b2) {
2401     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]);
2402   }
2403   var init_clip = __esm({
2404     "node_modules/d3-geo/src/clip/index.js"() {
2405       init_buffer();
2406       init_rejoin();
2407       init_math();
2408       init_polygonContains();
2409       init_src();
2410     }
2411   });
2412
2413   // node_modules/d3-geo/src/clip/antimeridian.js
2414   function clipAntimeridianLine(stream) {
2415     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
2416     return {
2417       lineStart: function() {
2418         stream.lineStart();
2419         clean2 = 1;
2420       },
2421       point: function(lambda12, phi12) {
2422         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
2423         if (abs(delta - pi) < epsilon) {
2424           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
2425           stream.point(sign0, phi02);
2426           stream.lineEnd();
2427           stream.lineStart();
2428           stream.point(sign1, phi02);
2429           stream.point(lambda12, phi02);
2430           clean2 = 0;
2431         } else if (sign0 !== sign1 && delta >= pi) {
2432           if (abs(lambda04 - sign0) < epsilon) lambda04 -= sign0 * epsilon;
2433           if (abs(lambda12 - sign1) < epsilon) lambda12 -= sign1 * epsilon;
2434           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
2435           stream.point(sign0, phi02);
2436           stream.lineEnd();
2437           stream.lineStart();
2438           stream.point(sign1, phi02);
2439           clean2 = 0;
2440         }
2441         stream.point(lambda04 = lambda12, phi02 = phi12);
2442         sign0 = sign1;
2443       },
2444       lineEnd: function() {
2445         stream.lineEnd();
2446         lambda04 = phi02 = NaN;
2447       },
2448       clean: function() {
2449         return 2 - clean2;
2450       }
2451     };
2452   }
2453   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
2454     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
2455     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;
2456   }
2457   function clipAntimeridianInterpolate(from, to, direction, stream) {
2458     var phi;
2459     if (from == null) {
2460       phi = direction * halfPi;
2461       stream.point(-pi, phi);
2462       stream.point(0, phi);
2463       stream.point(pi, phi);
2464       stream.point(pi, 0);
2465       stream.point(pi, -phi);
2466       stream.point(0, -phi);
2467       stream.point(-pi, -phi);
2468       stream.point(-pi, 0);
2469       stream.point(-pi, phi);
2470     } else if (abs(from[0] - to[0]) > epsilon) {
2471       var lambda = from[0] < to[0] ? pi : -pi;
2472       phi = direction * lambda / 2;
2473       stream.point(-lambda, phi);
2474       stream.point(0, phi);
2475       stream.point(lambda, phi);
2476     } else {
2477       stream.point(to[0], to[1]);
2478     }
2479   }
2480   var antimeridian_default;
2481   var init_antimeridian = __esm({
2482     "node_modules/d3-geo/src/clip/antimeridian.js"() {
2483       init_clip();
2484       init_math();
2485       antimeridian_default = clip_default(
2486         function() {
2487           return true;
2488         },
2489         clipAntimeridianLine,
2490         clipAntimeridianInterpolate,
2491         [-pi, -halfPi]
2492       );
2493     }
2494   });
2495
2496   // node_modules/d3-geo/src/clip/circle.js
2497   function circle_default(radius) {
2498     var cr = cos(radius), delta = 2 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
2499     function interpolate(from, to, direction, stream) {
2500       circleStream(stream, radius, delta, direction, from, to);
2501     }
2502     function visible(lambda, phi) {
2503       return cos(lambda) * cos(phi) > cr;
2504     }
2505     function clipLine(stream) {
2506       var point0, c0, v0, v00, clean2;
2507       return {
2508         lineStart: function() {
2509           v00 = v0 = false;
2510           clean2 = 1;
2511         },
2512         point: function(lambda, phi) {
2513           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;
2514           if (!point0 && (v00 = v0 = v2)) stream.lineStart();
2515           if (v2 !== v0) {
2516             point2 = intersect2(point0, point1);
2517             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
2518               point1[2] = 1;
2519           }
2520           if (v2 !== v0) {
2521             clean2 = 0;
2522             if (v2) {
2523               stream.lineStart();
2524               point2 = intersect2(point1, point0);
2525               stream.point(point2[0], point2[1]);
2526             } else {
2527               point2 = intersect2(point0, point1);
2528               stream.point(point2[0], point2[1], 2);
2529               stream.lineEnd();
2530             }
2531             point0 = point2;
2532           } else if (notHemisphere && point0 && smallRadius ^ v2) {
2533             var t2;
2534             if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
2535               clean2 = 0;
2536               if (smallRadius) {
2537                 stream.lineStart();
2538                 stream.point(t2[0][0], t2[0][1]);
2539                 stream.point(t2[1][0], t2[1][1]);
2540                 stream.lineEnd();
2541               } else {
2542                 stream.point(t2[1][0], t2[1][1]);
2543                 stream.lineEnd();
2544                 stream.lineStart();
2545                 stream.point(t2[0][0], t2[0][1], 3);
2546               }
2547             }
2548           }
2549           if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
2550             stream.point(point1[0], point1[1]);
2551           }
2552           point0 = point1, v0 = v2, c0 = c2;
2553         },
2554         lineEnd: function() {
2555           if (v0) stream.lineEnd();
2556           point0 = null;
2557         },
2558         // Rejoin first and last segments if there were intersections and the first
2559         // and last points were visible.
2560         clean: function() {
2561           return clean2 | (v00 && v0) << 1;
2562         }
2563       };
2564     }
2565     function intersect2(a2, b2, two) {
2566       var pa = cartesian(a2), pb = cartesian(b2);
2567       var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
2568       if (!determinant) return !two && a2;
2569       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
2570       cartesianAddInPlace(A2, B2);
2571       var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
2572       if (t2 < 0) return;
2573       var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
2574       cartesianAddInPlace(q2, A2);
2575       q2 = spherical(q2);
2576       if (!two) return q2;
2577       var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
2578       if (lambda12 < lambda04) z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
2579       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
2580       if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2;
2581       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)) {
2582         var q1 = cartesianScale(u2, (-w2 + t3) / uu);
2583         cartesianAddInPlace(q1, A2);
2584         return [q2, spherical(q1)];
2585       }
2586     }
2587     function code(lambda, phi) {
2588       var r2 = smallRadius ? radius : pi - radius, code2 = 0;
2589       if (lambda < -r2) code2 |= 1;
2590       else if (lambda > r2) code2 |= 2;
2591       if (phi < -r2) code2 |= 4;
2592       else if (phi > r2) code2 |= 8;
2593       return code2;
2594     }
2595     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
2596   }
2597   var init_circle2 = __esm({
2598     "node_modules/d3-geo/src/clip/circle.js"() {
2599       init_cartesian();
2600       init_circle();
2601       init_math();
2602       init_pointEqual();
2603       init_clip();
2604     }
2605   });
2606
2607   // node_modules/d3-geo/src/clip/line.js
2608   function line_default(a2, b2, x05, y05, x12, y12) {
2609     var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r2;
2610     r2 = x05 - ax;
2611     if (!dx && r2 > 0) return;
2612     r2 /= dx;
2613     if (dx < 0) {
2614       if (r2 < t02) return;
2615       if (r2 < t12) t12 = r2;
2616     } else if (dx > 0) {
2617       if (r2 > t12) return;
2618       if (r2 > t02) t02 = r2;
2619     }
2620     r2 = x12 - ax;
2621     if (!dx && r2 < 0) return;
2622     r2 /= dx;
2623     if (dx < 0) {
2624       if (r2 > t12) return;
2625       if (r2 > t02) t02 = r2;
2626     } else if (dx > 0) {
2627       if (r2 < t02) return;
2628       if (r2 < t12) t12 = r2;
2629     }
2630     r2 = y05 - ay;
2631     if (!dy && r2 > 0) return;
2632     r2 /= dy;
2633     if (dy < 0) {
2634       if (r2 < t02) return;
2635       if (r2 < t12) t12 = r2;
2636     } else if (dy > 0) {
2637       if (r2 > t12) return;
2638       if (r2 > t02) t02 = r2;
2639     }
2640     r2 = y12 - ay;
2641     if (!dy && r2 < 0) return;
2642     r2 /= dy;
2643     if (dy < 0) {
2644       if (r2 > t12) return;
2645       if (r2 > t02) t02 = r2;
2646     } else if (dy > 0) {
2647       if (r2 < t02) return;
2648       if (r2 < t12) t12 = r2;
2649     }
2650     if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy;
2651     if (t12 < 1) b2[0] = ax + t12 * dx, b2[1] = ay + t12 * dy;
2652     return true;
2653   }
2654   var init_line = __esm({
2655     "node_modules/d3-geo/src/clip/line.js"() {
2656     }
2657   });
2658
2659   // node_modules/d3-geo/src/clip/rectangle.js
2660   function clipRectangle(x05, y05, x12, y12) {
2661     function visible(x2, y2) {
2662       return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
2663     }
2664     function interpolate(from, to, direction, stream) {
2665       var a2 = 0, a1 = 0;
2666       if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
2667         do
2668           stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
2669         while ((a2 = (a2 + direction + 4) % 4) !== a1);
2670       } else {
2671         stream.point(to[0], to[1]);
2672       }
2673     }
2674     function corner(p2, direction) {
2675       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;
2676     }
2677     function compareIntersection2(a2, b2) {
2678       return comparePoint(a2.x, b2.x);
2679     }
2680     function comparePoint(a2, b2) {
2681       var ca = corner(a2, 1), cb = corner(b2, 1);
2682       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];
2683     }
2684     return function(stream) {
2685       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
2686       var clipStream = {
2687         point,
2688         lineStart,
2689         lineEnd,
2690         polygonStart,
2691         polygonEnd
2692       };
2693       function point(x2, y2) {
2694         if (visible(x2, y2)) activeStream.point(x2, y2);
2695       }
2696       function polygonInside() {
2697         var winding = 0;
2698         for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
2699           for (var ring2 = polygon2[i3], j2 = 1, m2 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
2700             a0 = b0, a1 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
2701             if (a1 <= y12) {
2702               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0)) ++winding;
2703             } else {
2704               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0)) --winding;
2705             }
2706           }
2707         }
2708         return winding;
2709       }
2710       function polygonStart() {
2711         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
2712       }
2713       function polygonEnd() {
2714         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
2715         if (cleanInside || visible2) {
2716           stream.polygonStart();
2717           if (cleanInside) {
2718             stream.lineStart();
2719             interpolate(null, null, 1, stream);
2720             stream.lineEnd();
2721           }
2722           if (visible2) {
2723             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
2724           }
2725           stream.polygonEnd();
2726         }
2727         activeStream = stream, segments = polygon2 = ring = null;
2728       }
2729       function lineStart() {
2730         clipStream.point = linePoint2;
2731         if (polygon2) polygon2.push(ring = []);
2732         first = true;
2733         v_ = false;
2734         x_ = y_ = NaN;
2735       }
2736       function lineEnd() {
2737         if (segments) {
2738           linePoint2(x__, y__);
2739           if (v__ && v_) bufferStream.rejoin();
2740           segments.push(bufferStream.result());
2741         }
2742         clipStream.point = point;
2743         if (v_) activeStream.lineEnd();
2744       }
2745       function linePoint2(x2, y2) {
2746         var v2 = visible(x2, y2);
2747         if (polygon2) ring.push([x2, y2]);
2748         if (first) {
2749           x__ = x2, y__ = y2, v__ = v2;
2750           first = false;
2751           if (v2) {
2752             activeStream.lineStart();
2753             activeStream.point(x2, y2);
2754           }
2755         } else {
2756           if (v2 && v_) activeStream.point(x2, y2);
2757           else {
2758             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))];
2759             if (line_default(a2, b2, x05, y05, x12, y12)) {
2760               if (!v_) {
2761                 activeStream.lineStart();
2762                 activeStream.point(a2[0], a2[1]);
2763               }
2764               activeStream.point(b2[0], b2[1]);
2765               if (!v2) activeStream.lineEnd();
2766               clean2 = false;
2767             } else if (v2) {
2768               activeStream.lineStart();
2769               activeStream.point(x2, y2);
2770               clean2 = false;
2771             }
2772           }
2773         }
2774         x_ = x2, y_ = y2, v_ = v2;
2775       }
2776       return clipStream;
2777     };
2778   }
2779   var clipMax, clipMin;
2780   var init_rectangle = __esm({
2781     "node_modules/d3-geo/src/clip/rectangle.js"() {
2782       init_math();
2783       init_buffer();
2784       init_line();
2785       init_rejoin();
2786       init_src();
2787       clipMax = 1e9;
2788       clipMin = -clipMax;
2789     }
2790   });
2791
2792   // node_modules/d3-geo/src/length.js
2793   function lengthLineStart() {
2794     lengthStream.point = lengthPointFirst;
2795     lengthStream.lineEnd = lengthLineEnd;
2796   }
2797   function lengthLineEnd() {
2798     lengthStream.point = lengthStream.lineEnd = noop;
2799   }
2800   function lengthPointFirst(lambda, phi) {
2801     lambda *= radians, phi *= radians;
2802     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
2803     lengthStream.point = lengthPoint;
2804   }
2805   function lengthPoint(lambda, phi) {
2806     lambda *= radians, phi *= radians;
2807     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;
2808     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
2809     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
2810   }
2811   function length_default(object) {
2812     lengthSum = new Adder();
2813     stream_default(object, lengthStream);
2814     return +lengthSum;
2815   }
2816   var lengthSum, lambda03, sinPhi02, cosPhi02, lengthStream;
2817   var init_length = __esm({
2818     "node_modules/d3-geo/src/length.js"() {
2819       init_src();
2820       init_math();
2821       init_noop();
2822       init_stream();
2823       lengthStream = {
2824         sphere: noop,
2825         point: noop,
2826         lineStart: lengthLineStart,
2827         lineEnd: noop,
2828         polygonStart: noop,
2829         polygonEnd: noop
2830       };
2831     }
2832   });
2833
2834   // node_modules/d3-geo/src/identity.js
2835   var identity_default;
2836   var init_identity = __esm({
2837     "node_modules/d3-geo/src/identity.js"() {
2838       identity_default = (x2) => x2;
2839     }
2840   });
2841
2842   // node_modules/d3-geo/src/path/area.js
2843   function areaRingStart2() {
2844     areaStream2.point = areaPointFirst2;
2845   }
2846   function areaPointFirst2(x2, y2) {
2847     areaStream2.point = areaPoint2;
2848     x00 = x0 = x2, y00 = y0 = y2;
2849   }
2850   function areaPoint2(x2, y2) {
2851     areaRingSum2.add(y0 * x2 - x0 * y2);
2852     x0 = x2, y0 = y2;
2853   }
2854   function areaRingEnd2() {
2855     areaPoint2(x00, y00);
2856   }
2857   var areaSum2, areaRingSum2, x00, y00, x0, y0, areaStream2, area_default2;
2858   var init_area2 = __esm({
2859     "node_modules/d3-geo/src/path/area.js"() {
2860       init_src();
2861       init_math();
2862       init_noop();
2863       areaSum2 = new Adder();
2864       areaRingSum2 = new Adder();
2865       areaStream2 = {
2866         point: noop,
2867         lineStart: noop,
2868         lineEnd: noop,
2869         polygonStart: function() {
2870           areaStream2.lineStart = areaRingStart2;
2871           areaStream2.lineEnd = areaRingEnd2;
2872         },
2873         polygonEnd: function() {
2874           areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
2875           areaSum2.add(abs(areaRingSum2));
2876           areaRingSum2 = new Adder();
2877         },
2878         result: function() {
2879           var area = areaSum2 / 2;
2880           areaSum2 = new Adder();
2881           return area;
2882         }
2883       };
2884       area_default2 = areaStream2;
2885     }
2886   });
2887
2888   // node_modules/d3-geo/src/path/bounds.js
2889   function boundsPoint2(x2, y2) {
2890     if (x2 < x02) x02 = x2;
2891     if (x2 > x1) x1 = x2;
2892     if (y2 < y02) y02 = y2;
2893     if (y2 > y1) y1 = y2;
2894   }
2895   var x02, y02, x1, y1, boundsStream2, bounds_default2;
2896   var init_bounds2 = __esm({
2897     "node_modules/d3-geo/src/path/bounds.js"() {
2898       init_noop();
2899       x02 = Infinity;
2900       y02 = x02;
2901       x1 = -x02;
2902       y1 = x1;
2903       boundsStream2 = {
2904         point: boundsPoint2,
2905         lineStart: noop,
2906         lineEnd: noop,
2907         polygonStart: noop,
2908         polygonEnd: noop,
2909         result: function() {
2910           var bounds = [[x02, y02], [x1, y1]];
2911           x1 = y1 = -(y02 = x02 = Infinity);
2912           return bounds;
2913         }
2914       };
2915       bounds_default2 = boundsStream2;
2916     }
2917   });
2918
2919   // node_modules/d3-geo/src/path/centroid.js
2920   function centroidPoint(x2, y2) {
2921     X0 += x2;
2922     Y0 += y2;
2923     ++Z0;
2924   }
2925   function centroidLineStart() {
2926     centroidStream.point = centroidPointFirstLine;
2927   }
2928   function centroidPointFirstLine(x2, y2) {
2929     centroidStream.point = centroidPointLine;
2930     centroidPoint(x03 = x2, y03 = y2);
2931   }
2932   function centroidPointLine(x2, y2) {
2933     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
2934     X1 += z2 * (x03 + x2) / 2;
2935     Y1 += z2 * (y03 + y2) / 2;
2936     Z1 += z2;
2937     centroidPoint(x03 = x2, y03 = y2);
2938   }
2939   function centroidLineEnd() {
2940     centroidStream.point = centroidPoint;
2941   }
2942   function centroidRingStart() {
2943     centroidStream.point = centroidPointFirstRing;
2944   }
2945   function centroidRingEnd() {
2946     centroidPointRing(x002, y002);
2947   }
2948   function centroidPointFirstRing(x2, y2) {
2949     centroidStream.point = centroidPointRing;
2950     centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
2951   }
2952   function centroidPointRing(x2, y2) {
2953     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
2954     X1 += z2 * (x03 + x2) / 2;
2955     Y1 += z2 * (y03 + y2) / 2;
2956     Z1 += z2;
2957     z2 = y03 * x2 - x03 * y2;
2958     X2 += z2 * (x03 + x2);
2959     Y2 += z2 * (y03 + y2);
2960     Z2 += z2 * 3;
2961     centroidPoint(x03 = x2, y03 = y2);
2962   }
2963   var X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, x002, y002, x03, y03, centroidStream, centroid_default;
2964   var init_centroid = __esm({
2965     "node_modules/d3-geo/src/path/centroid.js"() {
2966       init_math();
2967       X0 = 0;
2968       Y0 = 0;
2969       Z0 = 0;
2970       X1 = 0;
2971       Y1 = 0;
2972       Z1 = 0;
2973       X2 = 0;
2974       Y2 = 0;
2975       Z2 = 0;
2976       centroidStream = {
2977         point: centroidPoint,
2978         lineStart: centroidLineStart,
2979         lineEnd: centroidLineEnd,
2980         polygonStart: function() {
2981           centroidStream.lineStart = centroidRingStart;
2982           centroidStream.lineEnd = centroidRingEnd;
2983         },
2984         polygonEnd: function() {
2985           centroidStream.point = centroidPoint;
2986           centroidStream.lineStart = centroidLineStart;
2987           centroidStream.lineEnd = centroidLineEnd;
2988         },
2989         result: function() {
2990           var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
2991           X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
2992           return centroid;
2993         }
2994       };
2995       centroid_default = centroidStream;
2996     }
2997   });
2998
2999   // node_modules/d3-geo/src/path/context.js
3000   function PathContext(context) {
3001     this._context = context;
3002   }
3003   var init_context = __esm({
3004     "node_modules/d3-geo/src/path/context.js"() {
3005       init_math();
3006       init_noop();
3007       PathContext.prototype = {
3008         _radius: 4.5,
3009         pointRadius: function(_2) {
3010           return this._radius = _2, this;
3011         },
3012         polygonStart: function() {
3013           this._line = 0;
3014         },
3015         polygonEnd: function() {
3016           this._line = NaN;
3017         },
3018         lineStart: function() {
3019           this._point = 0;
3020         },
3021         lineEnd: function() {
3022           if (this._line === 0) this._context.closePath();
3023           this._point = NaN;
3024         },
3025         point: function(x2, y2) {
3026           switch (this._point) {
3027             case 0: {
3028               this._context.moveTo(x2, y2);
3029               this._point = 1;
3030               break;
3031             }
3032             case 1: {
3033               this._context.lineTo(x2, y2);
3034               break;
3035             }
3036             default: {
3037               this._context.moveTo(x2 + this._radius, y2);
3038               this._context.arc(x2, y2, this._radius, 0, tau);
3039               break;
3040             }
3041           }
3042         },
3043         result: noop
3044       };
3045     }
3046   });
3047
3048   // node_modules/d3-geo/src/path/measure.js
3049   function lengthPointFirst2(x2, y2) {
3050     lengthStream2.point = lengthPoint2;
3051     x003 = x04 = x2, y003 = y04 = y2;
3052   }
3053   function lengthPoint2(x2, y2) {
3054     x04 -= x2, y04 -= y2;
3055     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
3056     x04 = x2, y04 = y2;
3057   }
3058   var lengthSum2, lengthRing, x003, y003, x04, y04, lengthStream2, measure_default;
3059   var init_measure = __esm({
3060     "node_modules/d3-geo/src/path/measure.js"() {
3061       init_src();
3062       init_math();
3063       init_noop();
3064       lengthSum2 = new Adder();
3065       lengthStream2 = {
3066         point: noop,
3067         lineStart: function() {
3068           lengthStream2.point = lengthPointFirst2;
3069         },
3070         lineEnd: function() {
3071           if (lengthRing) lengthPoint2(x003, y003);
3072           lengthStream2.point = noop;
3073         },
3074         polygonStart: function() {
3075           lengthRing = true;
3076         },
3077         polygonEnd: function() {
3078           lengthRing = null;
3079         },
3080         result: function() {
3081           var length2 = +lengthSum2;
3082           lengthSum2 = new Adder();
3083           return length2;
3084         }
3085       };
3086       measure_default = lengthStream2;
3087     }
3088   });
3089
3090   // node_modules/d3-geo/src/path/string.js
3091   function append(strings) {
3092     let i3 = 1;
3093     this._ += strings[0];
3094     for (const j2 = strings.length; i3 < j2; ++i3) {
3095       this._ += arguments[i3] + strings[i3];
3096     }
3097   }
3098   function appendRound(digits) {
3099     const d2 = Math.floor(digits);
3100     if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${digits}`);
3101     if (d2 > 15) return append;
3102     if (d2 !== cacheDigits) {
3103       const k2 = 10 ** d2;
3104       cacheDigits = d2;
3105       cacheAppend = function append2(strings) {
3106         let i3 = 1;
3107         this._ += strings[0];
3108         for (const j2 = strings.length; i3 < j2; ++i3) {
3109           this._ += Math.round(arguments[i3] * k2) / k2 + strings[i3];
3110         }
3111       };
3112     }
3113     return cacheAppend;
3114   }
3115   var cacheDigits, cacheAppend, cacheRadius, cacheCircle, PathString;
3116   var init_string = __esm({
3117     "node_modules/d3-geo/src/path/string.js"() {
3118       PathString = class {
3119         constructor(digits) {
3120           this._append = digits == null ? append : appendRound(digits);
3121           this._radius = 4.5;
3122           this._ = "";
3123         }
3124         pointRadius(_2) {
3125           this._radius = +_2;
3126           return this;
3127         }
3128         polygonStart() {
3129           this._line = 0;
3130         }
3131         polygonEnd() {
3132           this._line = NaN;
3133         }
3134         lineStart() {
3135           this._point = 0;
3136         }
3137         lineEnd() {
3138           if (this._line === 0) this._ += "Z";
3139           this._point = NaN;
3140         }
3141         point(x2, y2) {
3142           switch (this._point) {
3143             case 0: {
3144               this._append`M${x2},${y2}`;
3145               this._point = 1;
3146               break;
3147             }
3148             case 1: {
3149               this._append`L${x2},${y2}`;
3150               break;
3151             }
3152             default: {
3153               this._append`M${x2},${y2}`;
3154               if (this._radius !== cacheRadius || this._append !== cacheAppend) {
3155                 const r2 = this._radius;
3156                 const s2 = this._;
3157                 this._ = "";
3158                 this._append`m0,${r2}a${r2},${r2} 0 1,1 0,${-2 * r2}a${r2},${r2} 0 1,1 0,${2 * r2}z`;
3159                 cacheRadius = r2;
3160                 cacheAppend = this._append;
3161                 cacheCircle = this._;
3162                 this._ = s2;
3163               }
3164               this._ += cacheCircle;
3165               break;
3166             }
3167           }
3168         }
3169         result() {
3170           const result = this._;
3171           this._ = "";
3172           return result.length ? result : null;
3173         }
3174       };
3175     }
3176   });
3177
3178   // node_modules/d3-geo/src/path/index.js
3179   function path_default(projection2, context) {
3180     let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
3181     function path(object) {
3182       if (object) {
3183         if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
3184         stream_default(object, projectionStream(contextStream));
3185       }
3186       return contextStream.result();
3187     }
3188     path.area = function(object) {
3189       stream_default(object, projectionStream(area_default2));
3190       return area_default2.result();
3191     };
3192     path.measure = function(object) {
3193       stream_default(object, projectionStream(measure_default));
3194       return measure_default.result();
3195     };
3196     path.bounds = function(object) {
3197       stream_default(object, projectionStream(bounds_default2));
3198       return bounds_default2.result();
3199     };
3200     path.centroid = function(object) {
3201       stream_default(object, projectionStream(centroid_default));
3202       return centroid_default.result();
3203     };
3204     path.projection = function(_2) {
3205       if (!arguments.length) return projection2;
3206       projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream;
3207       return path;
3208     };
3209     path.context = function(_2) {
3210       if (!arguments.length) return context;
3211       contextStream = _2 == null ? (context = null, new PathString(digits)) : new PathContext(context = _2);
3212       if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
3213       return path;
3214     };
3215     path.pointRadius = function(_2) {
3216       if (!arguments.length) return pointRadius;
3217       pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
3218       return path;
3219     };
3220     path.digits = function(_2) {
3221       if (!arguments.length) return digits;
3222       if (_2 == null) digits = null;
3223       else {
3224         const d2 = Math.floor(_2);
3225         if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_2}`);
3226         digits = d2;
3227       }
3228       if (context === null) contextStream = new PathString(digits);
3229       return path;
3230     };
3231     return path.projection(projection2).digits(digits).context(context);
3232   }
3233   var init_path = __esm({
3234     "node_modules/d3-geo/src/path/index.js"() {
3235       init_identity();
3236       init_stream();
3237       init_area2();
3238       init_bounds2();
3239       init_centroid();
3240       init_context();
3241       init_measure();
3242       init_string();
3243     }
3244   });
3245
3246   // node_modules/d3-geo/src/transform.js
3247   function transform_default(methods2) {
3248     return {
3249       stream: transformer(methods2)
3250     };
3251   }
3252   function transformer(methods2) {
3253     return function(stream) {
3254       var s2 = new TransformStream();
3255       for (var key in methods2) s2[key] = methods2[key];
3256       s2.stream = stream;
3257       return s2;
3258     };
3259   }
3260   function TransformStream() {
3261   }
3262   var init_transform = __esm({
3263     "node_modules/d3-geo/src/transform.js"() {
3264       TransformStream.prototype = {
3265         constructor: TransformStream,
3266         point: function(x2, y2) {
3267           this.stream.point(x2, y2);
3268         },
3269         sphere: function() {
3270           this.stream.sphere();
3271         },
3272         lineStart: function() {
3273           this.stream.lineStart();
3274         },
3275         lineEnd: function() {
3276           this.stream.lineEnd();
3277         },
3278         polygonStart: function() {
3279           this.stream.polygonStart();
3280         },
3281         polygonEnd: function() {
3282           this.stream.polygonEnd();
3283         }
3284       };
3285     }
3286   });
3287
3288   // node_modules/d3-geo/src/projection/fit.js
3289   function fit(projection2, fitBounds, object) {
3290     var clip = projection2.clipExtent && projection2.clipExtent();
3291     projection2.scale(150).translate([0, 0]);
3292     if (clip != null) projection2.clipExtent(null);
3293     stream_default(object, projection2.stream(bounds_default2));
3294     fitBounds(bounds_default2.result());
3295     if (clip != null) projection2.clipExtent(clip);
3296     return projection2;
3297   }
3298   function fitExtent(projection2, extent, object) {
3299     return fit(projection2, function(b2) {
3300       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;
3301       projection2.scale(150 * k2).translate([x2, y2]);
3302     }, object);
3303   }
3304   function fitSize(projection2, size, object) {
3305     return fitExtent(projection2, [[0, 0], size], object);
3306   }
3307   function fitWidth(projection2, width, object) {
3308     return fit(projection2, function(b2) {
3309       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];
3310       projection2.scale(150 * k2).translate([x2, y2]);
3311     }, object);
3312   }
3313   function fitHeight(projection2, height, object) {
3314     return fit(projection2, function(b2) {
3315       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;
3316       projection2.scale(150 * k2).translate([x2, y2]);
3317     }, object);
3318   }
3319   var init_fit = __esm({
3320     "node_modules/d3-geo/src/projection/fit.js"() {
3321       init_stream();
3322       init_bounds2();
3323     }
3324   });
3325
3326   // node_modules/d3-geo/src/projection/resample.js
3327   function resample_default(project, delta2) {
3328     return +delta2 ? resample(project, delta2) : resampleNone(project);
3329   }
3330   function resampleNone(project) {
3331     return transformer({
3332       point: function(x2, y2) {
3333         x2 = project(x2, y2);
3334         this.stream.point(x2[0], x2[1]);
3335       }
3336     });
3337   }
3338   function resample(project, delta2) {
3339     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
3340       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
3341       if (d2 > 4 * delta2 && depth--) {
3342         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;
3343         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
3344           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
3345           stream.point(x2, y2);
3346           resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
3347         }
3348       }
3349     }
3350     return function(stream) {
3351       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
3352       var resampleStream = {
3353         point,
3354         lineStart,
3355         lineEnd,
3356         polygonStart: function() {
3357           stream.polygonStart();
3358           resampleStream.lineStart = ringStart;
3359         },
3360         polygonEnd: function() {
3361           stream.polygonEnd();
3362           resampleStream.lineStart = lineStart;
3363         }
3364       };
3365       function point(x2, y2) {
3366         x2 = project(x2, y2);
3367         stream.point(x2[0], x2[1]);
3368       }
3369       function lineStart() {
3370         x05 = NaN;
3371         resampleStream.point = linePoint2;
3372         stream.lineStart();
3373       }
3374       function linePoint2(lambda, phi) {
3375         var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
3376         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);
3377         stream.point(x05, y05);
3378       }
3379       function lineEnd() {
3380         resampleStream.point = point;
3381         stream.lineEnd();
3382       }
3383       function ringStart() {
3384         lineStart();
3385         resampleStream.point = ringPoint;
3386         resampleStream.lineEnd = ringEnd;
3387       }
3388       function ringPoint(lambda, phi) {
3389         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
3390         resampleStream.point = linePoint2;
3391       }
3392       function ringEnd() {
3393         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
3394         resampleStream.lineEnd = lineEnd;
3395         lineEnd();
3396       }
3397       return resampleStream;
3398     };
3399   }
3400   var maxDepth, cosMinDistance;
3401   var init_resample = __esm({
3402     "node_modules/d3-geo/src/projection/resample.js"() {
3403       init_cartesian();
3404       init_math();
3405       init_transform();
3406       maxDepth = 16;
3407       cosMinDistance = cos(30 * radians);
3408     }
3409   });
3410
3411   // node_modules/d3-geo/src/projection/index.js
3412   function transformRotate(rotate) {
3413     return transformer({
3414       point: function(x2, y2) {
3415         var r2 = rotate(x2, y2);
3416         return this.stream.point(r2[0], r2[1]);
3417       }
3418     });
3419   }
3420   function scaleTranslate(k2, dx, dy, sx, sy) {
3421     function transform2(x2, y2) {
3422       x2 *= sx;
3423       y2 *= sy;
3424       return [dx + k2 * x2, dy - k2 * y2];
3425     }
3426     transform2.invert = function(x2, y2) {
3427       return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
3428     };
3429     return transform2;
3430   }
3431   function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
3432     if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
3433     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;
3434     function transform2(x2, y2) {
3435       x2 *= sx;
3436       y2 *= sy;
3437       return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
3438     }
3439     transform2.invert = function(x2, y2) {
3440       return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
3441     };
3442     return transform2;
3443   }
3444   function projection(project) {
3445     return projectionMutator(function() {
3446       return project;
3447     })();
3448   }
3449   function projectionMutator(projectAt) {
3450     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;
3451     function projection2(point) {
3452       return projectRotateTransform(point[0] * radians, point[1] * radians);
3453     }
3454     function invert(point) {
3455       point = projectRotateTransform.invert(point[0], point[1]);
3456       return point && [point[0] * degrees, point[1] * degrees];
3457     }
3458     projection2.stream = function(stream) {
3459       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
3460     };
3461     projection2.preclip = function(_2) {
3462       return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
3463     };
3464     projection2.postclip = function(_2) {
3465       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3466     };
3467     projection2.clipAngle = function(_2) {
3468       return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
3469     };
3470     projection2.clipExtent = function(_2) {
3471       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]];
3472     };
3473     projection2.scale = function(_2) {
3474       return arguments.length ? (k2 = +_2, recenter()) : k2;
3475     };
3476     projection2.translate = function(_2) {
3477       return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
3478     };
3479     projection2.center = function(_2) {
3480       return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
3481     };
3482     projection2.rotate = function(_2) {
3483       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];
3484     };
3485     projection2.angle = function(_2) {
3486       return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
3487     };
3488     projection2.reflectX = function(_2) {
3489       return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
3490     };
3491     projection2.reflectY = function(_2) {
3492       return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
3493     };
3494     projection2.precision = function(_2) {
3495       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
3496     };
3497     projection2.fitExtent = function(extent, object) {
3498       return fitExtent(projection2, extent, object);
3499     };
3500     projection2.fitSize = function(size, object) {
3501       return fitSize(projection2, size, object);
3502     };
3503     projection2.fitWidth = function(width, object) {
3504       return fitWidth(projection2, width, object);
3505     };
3506     projection2.fitHeight = function(height, object) {
3507       return fitHeight(projection2, height, object);
3508     };
3509     function recenter() {
3510       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);
3511       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
3512       projectTransform = compose_default(project, transform2);
3513       projectRotateTransform = compose_default(rotate, projectTransform);
3514       projectResample = resample_default(projectTransform, delta2);
3515       return reset();
3516     }
3517     function reset() {
3518       cache = cacheStream = null;
3519       return projection2;
3520     }
3521     return function() {
3522       project = projectAt.apply(this, arguments);
3523       projection2.invert = project.invert && invert;
3524       return recenter();
3525     };
3526   }
3527   var transformRadians;
3528   var init_projection = __esm({
3529     "node_modules/d3-geo/src/projection/index.js"() {
3530       init_antimeridian();
3531       init_circle2();
3532       init_rectangle();
3533       init_compose();
3534       init_identity();
3535       init_math();
3536       init_rotation();
3537       init_transform();
3538       init_fit();
3539       init_resample();
3540       transformRadians = transformer({
3541         point: function(x2, y2) {
3542           this.stream.point(x2 * radians, y2 * radians);
3543         }
3544       });
3545     }
3546   });
3547
3548   // node_modules/d3-geo/src/projection/mercator.js
3549   function mercatorRaw(lambda, phi) {
3550     return [lambda, log(tan((halfPi + phi) / 2))];
3551   }
3552   function mercator_default() {
3553     return mercatorProjection(mercatorRaw).scale(961 / tau);
3554   }
3555   function mercatorProjection(project) {
3556     var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
3557     m2.scale = function(_2) {
3558       return arguments.length ? (scale(_2), reclip()) : scale();
3559     };
3560     m2.translate = function(_2) {
3561       return arguments.length ? (translate(_2), reclip()) : translate();
3562     };
3563     m2.center = function(_2) {
3564       return arguments.length ? (center(_2), reclip()) : center();
3565     };
3566     m2.clipExtent = function(_2) {
3567       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]];
3568     };
3569     function reclip() {
3570       var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
3571       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)]]);
3572     }
3573     return reclip();
3574   }
3575   var init_mercator = __esm({
3576     "node_modules/d3-geo/src/projection/mercator.js"() {
3577       init_math();
3578       init_rotation();
3579       init_projection();
3580       mercatorRaw.invert = function(x2, y2) {
3581         return [x2, 2 * atan(exp(y2)) - halfPi];
3582       };
3583     }
3584   });
3585
3586   // node_modules/d3-geo/src/projection/identity.js
3587   function identity_default2() {
3588     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({
3589       point: function(x2, y2) {
3590         var p2 = projection2([x2, y2]);
3591         this.stream.point(p2[0], p2[1]);
3592       }
3593     }), postclip = identity_default, cache, cacheStream;
3594     function reset() {
3595       kx = k2 * sx;
3596       ky = k2 * sy;
3597       cache = cacheStream = null;
3598       return projection2;
3599     }
3600     function projection2(p2) {
3601       var x2 = p2[0] * kx, y2 = p2[1] * ky;
3602       if (alpha) {
3603         var t2 = y2 * ca - x2 * sa;
3604         x2 = x2 * ca + y2 * sa;
3605         y2 = t2;
3606       }
3607       return [x2 + tx, y2 + ty];
3608     }
3609     projection2.invert = function(p2) {
3610       var x2 = p2[0] - tx, y2 = p2[1] - ty;
3611       if (alpha) {
3612         var t2 = y2 * ca + x2 * sa;
3613         x2 = x2 * ca - y2 * sa;
3614         y2 = t2;
3615       }
3616       return [x2 / kx, y2 / ky];
3617     };
3618     projection2.stream = function(stream) {
3619       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
3620     };
3621     projection2.postclip = function(_2) {
3622       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
3623     };
3624     projection2.clipExtent = function(_2) {
3625       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]];
3626     };
3627     projection2.scale = function(_2) {
3628       return arguments.length ? (k2 = +_2, reset()) : k2;
3629     };
3630     projection2.translate = function(_2) {
3631       return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
3632     };
3633     projection2.angle = function(_2) {
3634       return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
3635     };
3636     projection2.reflectX = function(_2) {
3637       return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
3638     };
3639     projection2.reflectY = function(_2) {
3640       return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
3641     };
3642     projection2.fitExtent = function(extent, object) {
3643       return fitExtent(projection2, extent, object);
3644     };
3645     projection2.fitSize = function(size, object) {
3646       return fitSize(projection2, size, object);
3647     };
3648     projection2.fitWidth = function(width, object) {
3649       return fitWidth(projection2, width, object);
3650     };
3651     projection2.fitHeight = function(height, object) {
3652       return fitHeight(projection2, height, object);
3653     };
3654     return projection2;
3655   }
3656   var init_identity2 = __esm({
3657     "node_modules/d3-geo/src/projection/identity.js"() {
3658       init_rectangle();
3659       init_identity();
3660       init_transform();
3661       init_fit();
3662       init_math();
3663     }
3664   });
3665
3666   // node_modules/d3-geo/src/index.js
3667   var init_src2 = __esm({
3668     "node_modules/d3-geo/src/index.js"() {
3669       init_area();
3670       init_bounds();
3671       init_length();
3672       init_path();
3673       init_identity2();
3674       init_projection();
3675       init_mercator();
3676       init_stream();
3677       init_transform();
3678     }
3679   });
3680
3681   // modules/geo/geo.js
3682   var geo_exports = {};
3683   __export(geo_exports, {
3684     geoLatToMeters: () => geoLatToMeters,
3685     geoLonToMeters: () => geoLonToMeters,
3686     geoMetersToLat: () => geoMetersToLat,
3687     geoMetersToLon: () => geoMetersToLon,
3688     geoMetersToOffset: () => geoMetersToOffset,
3689     geoOffsetToMeters: () => geoOffsetToMeters,
3690     geoScaleToZoom: () => geoScaleToZoom,
3691     geoSphericalClosestNode: () => geoSphericalClosestNode,
3692     geoSphericalDistance: () => geoSphericalDistance,
3693     geoZoomToScale: () => geoZoomToScale
3694   });
3695   function geoLatToMeters(dLat) {
3696     return dLat * (TAU * POLAR_RADIUS / 360);
3697   }
3698   function geoLonToMeters(dLon, atLat) {
3699     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
3700   }
3701   function geoMetersToLat(m2) {
3702     return m2 / (TAU * POLAR_RADIUS / 360);
3703   }
3704   function geoMetersToLon(m2, atLat) {
3705     return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
3706   }
3707   function geoMetersToOffset(meters, tileSize) {
3708     tileSize = tileSize || 256;
3709     return [
3710       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
3711       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
3712     ];
3713   }
3714   function geoOffsetToMeters(offset, tileSize) {
3715     tileSize = tileSize || 256;
3716     return [
3717       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
3718       -offset[1] * TAU * POLAR_RADIUS / tileSize
3719     ];
3720   }
3721   function geoSphericalDistance(a2, b2) {
3722     var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
3723     var y2 = geoLatToMeters(a2[1] - b2[1]);
3724     return Math.sqrt(x2 * x2 + y2 * y2);
3725   }
3726   function geoScaleToZoom(k2, tileSize) {
3727     tileSize = tileSize || 256;
3728     var log2ts = Math.log(tileSize) * Math.LOG2E;
3729     return Math.log(k2 * TAU) / Math.LN2 - log2ts;
3730   }
3731   function geoZoomToScale(z2, tileSize) {
3732     tileSize = tileSize || 256;
3733     return tileSize * Math.pow(2, z2) / TAU;
3734   }
3735   function geoSphericalClosestNode(nodes, point) {
3736     var minDistance = Infinity, distance;
3737     var indexOfMin;
3738     for (var i3 in nodes) {
3739       distance = geoSphericalDistance(nodes[i3].loc, point);
3740       if (distance < minDistance) {
3741         minDistance = distance;
3742         indexOfMin = i3;
3743       }
3744     }
3745     if (indexOfMin !== void 0) {
3746       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
3747     } else {
3748       return null;
3749     }
3750   }
3751   var TAU, EQUATORIAL_RADIUS, POLAR_RADIUS;
3752   var init_geo = __esm({
3753     "modules/geo/geo.js"() {
3754       "use strict";
3755       TAU = 2 * Math.PI;
3756       EQUATORIAL_RADIUS = 6378137;
3757       POLAR_RADIUS = 63567523e-1;
3758     }
3759   });
3760
3761   // modules/geo/extent.js
3762   var extent_exports = {};
3763   __export(extent_exports, {
3764     geoExtent: () => geoExtent
3765   });
3766   function geoExtent(min3, max3) {
3767     if (!(this instanceof geoExtent)) {
3768       return new geoExtent(min3, max3);
3769     } else if (min3 instanceof geoExtent) {
3770       return min3;
3771     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
3772       this[0] = min3[0];
3773       this[1] = min3[1];
3774     } else {
3775       this[0] = min3 || [Infinity, Infinity];
3776       this[1] = max3 || min3 || [-Infinity, -Infinity];
3777     }
3778   }
3779   var init_extent = __esm({
3780     "modules/geo/extent.js"() {
3781       "use strict";
3782       init_geo();
3783       geoExtent.prototype = new Array(2);
3784       Object.assign(geoExtent.prototype, {
3785         equals: function(obj) {
3786           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];
3787         },
3788         extend: function(obj) {
3789           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3790           return geoExtent(
3791             [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
3792             [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
3793           );
3794         },
3795         _extend: function(extent) {
3796           this[0][0] = Math.min(extent[0][0], this[0][0]);
3797           this[0][1] = Math.min(extent[0][1], this[0][1]);
3798           this[1][0] = Math.max(extent[1][0], this[1][0]);
3799           this[1][1] = Math.max(extent[1][1], this[1][1]);
3800         },
3801         area: function() {
3802           return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
3803         },
3804         center: function() {
3805           return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
3806         },
3807         rectangle: function() {
3808           return [this[0][0], this[0][1], this[1][0], this[1][1]];
3809         },
3810         bbox: function() {
3811           return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
3812         },
3813         polygon: function() {
3814           return [
3815             [this[0][0], this[0][1]],
3816             [this[0][0], this[1][1]],
3817             [this[1][0], this[1][1]],
3818             [this[1][0], this[0][1]],
3819             [this[0][0], this[0][1]]
3820           ];
3821         },
3822         contains: function(obj) {
3823           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3824           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];
3825         },
3826         intersects: function(obj) {
3827           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3828           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];
3829         },
3830         intersection: function(obj) {
3831           if (!this.intersects(obj)) return new geoExtent();
3832           return new geoExtent(
3833             [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
3834             [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
3835           );
3836         },
3837         percentContainedIn: function(obj) {
3838           if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
3839           var a1 = this.intersection(obj).area();
3840           var a2 = this.area();
3841           if (a1 === Infinity || a2 === Infinity) {
3842             return 0;
3843           } else if (a1 === 0 || a2 === 0) {
3844             if (obj.contains(this)) {
3845               return 1;
3846             }
3847             return 0;
3848           } else {
3849             return a1 / a2;
3850           }
3851         },
3852         padByMeters: function(meters) {
3853           var dLat = geoMetersToLat(meters);
3854           var dLon = geoMetersToLon(meters, this.center()[1]);
3855           return geoExtent(
3856             [this[0][0] - dLon, this[0][1] - dLat],
3857             [this[1][0] + dLon, this[1][1] + dLat]
3858           );
3859         },
3860         toParam: function() {
3861           return this.rectangle().join(",");
3862         },
3863         split: function() {
3864           const center = this.center();
3865           return [
3866             geoExtent(this[0], center),
3867             geoExtent([center[0], this[0][1]], [this[1][0], center[1]]),
3868             geoExtent(center, this[1]),
3869             geoExtent([this[0][0], center[1]], [center[0], this[1][1]])
3870           ];
3871         }
3872       });
3873     }
3874   });
3875
3876   // node_modules/d3-polygon/src/area.js
3877   function area_default3(polygon2) {
3878     var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
3879     while (++i3 < n3) {
3880       a2 = b2;
3881       b2 = polygon2[i3];
3882       area += a2[1] * b2[0] - a2[0] * b2[1];
3883     }
3884     return area / 2;
3885   }
3886   var init_area3 = __esm({
3887     "node_modules/d3-polygon/src/area.js"() {
3888     }
3889   });
3890
3891   // node_modules/d3-polygon/src/centroid.js
3892   function centroid_default2(polygon2) {
3893     var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
3894     while (++i3 < n3) {
3895       a2 = b2;
3896       b2 = polygon2[i3];
3897       k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
3898       x2 += (a2[0] + b2[0]) * c2;
3899       y2 += (a2[1] + b2[1]) * c2;
3900     }
3901     return k2 *= 3, [x2 / k2, y2 / k2];
3902   }
3903   var init_centroid2 = __esm({
3904     "node_modules/d3-polygon/src/centroid.js"() {
3905     }
3906   });
3907
3908   // node_modules/d3-polygon/src/cross.js
3909   function cross_default(a2, b2, c2) {
3910     return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
3911   }
3912   var init_cross = __esm({
3913     "node_modules/d3-polygon/src/cross.js"() {
3914     }
3915   });
3916
3917   // node_modules/d3-polygon/src/hull.js
3918   function lexicographicOrder(a2, b2) {
3919     return a2[0] - b2[0] || a2[1] - b2[1];
3920   }
3921   function computeUpperHullIndexes(points) {
3922     const n3 = points.length, indexes = [0, 1];
3923     let size = 2, i3;
3924     for (i3 = 2; i3 < n3; ++i3) {
3925       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0) --size;
3926       indexes[size++] = i3;
3927     }
3928     return indexes.slice(0, size);
3929   }
3930   function hull_default(points) {
3931     if ((n3 = points.length) < 3) return null;
3932     var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
3933     for (i3 = 0; i3 < n3; ++i3) sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
3934     sortedPoints.sort(lexicographicOrder);
3935     for (i3 = 0; i3 < n3; ++i3) flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
3936     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
3937     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
3938     for (i3 = upperIndexes.length - 1; i3 >= 0; --i3) hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
3939     for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3) hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
3940     return hull;
3941   }
3942   var init_hull = __esm({
3943     "node_modules/d3-polygon/src/hull.js"() {
3944       init_cross();
3945     }
3946   });
3947
3948   // node_modules/d3-polygon/src/index.js
3949   var init_src3 = __esm({
3950     "node_modules/d3-polygon/src/index.js"() {
3951       init_area3();
3952       init_centroid2();
3953       init_hull();
3954     }
3955   });
3956
3957   // modules/geo/vector.js
3958   var vector_exports = {};
3959   __export(vector_exports, {
3960     geoVecAdd: () => geoVecAdd,
3961     geoVecAngle: () => geoVecAngle,
3962     geoVecCross: () => geoVecCross,
3963     geoVecDot: () => geoVecDot,
3964     geoVecEqual: () => geoVecEqual,
3965     geoVecFloor: () => geoVecFloor,
3966     geoVecInterp: () => geoVecInterp,
3967     geoVecLength: () => geoVecLength,
3968     geoVecLengthSquare: () => geoVecLengthSquare,
3969     geoVecNormalize: () => geoVecNormalize,
3970     geoVecNormalizedDot: () => geoVecNormalizedDot,
3971     geoVecProject: () => geoVecProject,
3972     geoVecScale: () => geoVecScale,
3973     geoVecSubtract: () => geoVecSubtract
3974   });
3975   function geoVecEqual(a2, b2, epsilon3) {
3976     if (epsilon3) {
3977       return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
3978     } else {
3979       return a2[0] === b2[0] && a2[1] === b2[1];
3980     }
3981   }
3982   function geoVecAdd(a2, b2) {
3983     return [a2[0] + b2[0], a2[1] + b2[1]];
3984   }
3985   function geoVecSubtract(a2, b2) {
3986     return [a2[0] - b2[0], a2[1] - b2[1]];
3987   }
3988   function geoVecScale(a2, mag) {
3989     return [a2[0] * mag, a2[1] * mag];
3990   }
3991   function geoVecFloor(a2) {
3992     return [Math.floor(a2[0]), Math.floor(a2[1])];
3993   }
3994   function geoVecInterp(a2, b2, t2) {
3995     return [
3996       a2[0] + (b2[0] - a2[0]) * t2,
3997       a2[1] + (b2[1] - a2[1]) * t2
3998     ];
3999   }
4000   function geoVecLength(a2, b2) {
4001     return Math.sqrt(geoVecLengthSquare(a2, b2));
4002   }
4003   function geoVecLengthSquare(a2, b2) {
4004     b2 = b2 || [0, 0];
4005     var x2 = a2[0] - b2[0];
4006     var y2 = a2[1] - b2[1];
4007     return x2 * x2 + y2 * y2;
4008   }
4009   function geoVecNormalize(a2) {
4010     var length2 = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
4011     if (length2 !== 0) {
4012       return geoVecScale(a2, 1 / length2);
4013     }
4014     return [0, 0];
4015   }
4016   function geoVecAngle(a2, b2) {
4017     return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
4018   }
4019   function geoVecDot(a2, b2, origin) {
4020     origin = origin || [0, 0];
4021     var p2 = geoVecSubtract(a2, origin);
4022     var q2 = geoVecSubtract(b2, origin);
4023     return p2[0] * q2[0] + p2[1] * q2[1];
4024   }
4025   function geoVecNormalizedDot(a2, b2, origin) {
4026     origin = origin || [0, 0];
4027     var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
4028     var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
4029     return geoVecDot(p2, q2);
4030   }
4031   function geoVecCross(a2, b2, origin) {
4032     origin = origin || [0, 0];
4033     var p2 = geoVecSubtract(a2, origin);
4034     var q2 = geoVecSubtract(b2, origin);
4035     return p2[0] * q2[1] - p2[1] * q2[0];
4036   }
4037   function geoVecProject(a2, points) {
4038     var min3 = Infinity;
4039     var idx;
4040     var target;
4041     for (var i3 = 0; i3 < points.length - 1; i3++) {
4042       var o2 = points[i3];
4043       var s2 = geoVecSubtract(points[i3 + 1], o2);
4044       var v2 = geoVecSubtract(a2, o2);
4045       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
4046       var p2;
4047       if (proj < 0) {
4048         p2 = o2;
4049       } else if (proj > 1) {
4050         p2 = points[i3 + 1];
4051       } else {
4052         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
4053       }
4054       var dist = geoVecLength(p2, a2);
4055       if (dist < min3) {
4056         min3 = dist;
4057         idx = i3 + 1;
4058         target = p2;
4059       }
4060     }
4061     if (idx !== void 0) {
4062       return { index: idx, distance: min3, target };
4063     } else {
4064       return null;
4065     }
4066   }
4067   var init_vector = __esm({
4068     "modules/geo/vector.js"() {
4069       "use strict";
4070     }
4071   });
4072
4073   // modules/geo/geom.js
4074   var geom_exports = {};
4075   __export(geom_exports, {
4076     geoAngle: () => geoAngle,
4077     geoChooseEdge: () => geoChooseEdge,
4078     geoEdgeEqual: () => geoEdgeEqual,
4079     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
4080     geoHasLineIntersections: () => geoHasLineIntersections,
4081     geoHasSelfIntersections: () => geoHasSelfIntersections,
4082     geoLineIntersection: () => geoLineIntersection,
4083     geoPathHasIntersections: () => geoPathHasIntersections,
4084     geoPathIntersections: () => geoPathIntersections,
4085     geoPathLength: () => geoPathLength,
4086     geoPointInPolygon: () => geoPointInPolygon,
4087     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
4088     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
4089     geoRotate: () => geoRotate,
4090     geoViewportEdge: () => geoViewportEdge
4091   });
4092   function geoAngle(a2, b2, projection2) {
4093     return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
4094   }
4095   function geoEdgeEqual(a2, b2) {
4096     return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
4097   }
4098   function geoRotate(points, angle2, around) {
4099     return points.map(function(point) {
4100       var radial = geoVecSubtract(point, around);
4101       return [
4102         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
4103         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
4104       ];
4105     });
4106   }
4107   function geoChooseEdge(nodes, point, projection2, activeID) {
4108     var dist = geoVecLength;
4109     var points = nodes.map(function(n3) {
4110       return projection2(n3.loc);
4111     });
4112     var ids = nodes.map(function(n3) {
4113       return n3.id;
4114     });
4115     var min3 = Infinity;
4116     var idx;
4117     var loc;
4118     for (var i3 = 0; i3 < points.length - 1; i3++) {
4119       if (ids[i3] === activeID || ids[i3 + 1] === activeID) continue;
4120       var o2 = points[i3];
4121       var s2 = geoVecSubtract(points[i3 + 1], o2);
4122       var v2 = geoVecSubtract(point, o2);
4123       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
4124       var p2;
4125       if (proj < 0) {
4126         p2 = o2;
4127       } else if (proj > 1) {
4128         p2 = points[i3 + 1];
4129       } else {
4130         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
4131       }
4132       var d2 = dist(p2, point);
4133       if (d2 < min3) {
4134         min3 = d2;
4135         idx = i3 + 1;
4136         loc = projection2.invert(p2);
4137       }
4138     }
4139     if (idx !== void 0) {
4140       return { index: idx, distance: min3, loc };
4141     } else {
4142       return null;
4143     }
4144   }
4145   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
4146     var actives = [];
4147     var inactives = [];
4148     var j2, k2, n1, n22, segment;
4149     for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
4150       n1 = activeNodes[j2];
4151       n22 = activeNodes[j2 + 1];
4152       segment = [n1.loc, n22.loc];
4153       if (n1.id === activeID || n22.id === activeID) {
4154         actives.push(segment);
4155       }
4156     }
4157     for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
4158       n1 = inactiveNodes[j2];
4159       n22 = inactiveNodes[j2 + 1];
4160       segment = [n1.loc, n22.loc];
4161       inactives.push(segment);
4162     }
4163     for (j2 = 0; j2 < actives.length; j2++) {
4164       for (k2 = 0; k2 < inactives.length; k2++) {
4165         var p2 = actives[j2];
4166         var q2 = inactives[k2];
4167         var hit = geoLineIntersection(p2, q2);
4168         if (hit) {
4169           return true;
4170         }
4171       }
4172     }
4173     return false;
4174   }
4175   function geoHasSelfIntersections(nodes, activeID) {
4176     var actives = [];
4177     var inactives = [];
4178     var j2, k2;
4179     for (j2 = 0; j2 < nodes.length - 1; j2++) {
4180       var n1 = nodes[j2];
4181       var n22 = nodes[j2 + 1];
4182       var segment = [n1.loc, n22.loc];
4183       if (n1.id === activeID || n22.id === activeID) {
4184         actives.push(segment);
4185       } else {
4186         inactives.push(segment);
4187       }
4188     }
4189     for (j2 = 0; j2 < actives.length; j2++) {
4190       for (k2 = 0; k2 < inactives.length; k2++) {
4191         var p2 = actives[j2];
4192         var q2 = inactives[k2];
4193         if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
4194           continue;
4195         }
4196         var hit = geoLineIntersection(p2, q2);
4197         if (hit) {
4198           var epsilon3 = 1e-8;
4199           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
4200             continue;
4201           } else {
4202             return true;
4203           }
4204         }
4205       }
4206     }
4207     return false;
4208   }
4209   function geoLineIntersection(a2, b2) {
4210     var p2 = [a2[0][0], a2[0][1]];
4211     var p22 = [a2[1][0], a2[1][1]];
4212     var q2 = [b2[0][0], b2[0][1]];
4213     var q22 = [b2[1][0], b2[1][1]];
4214     var r2 = geoVecSubtract(p22, p2);
4215     var s2 = geoVecSubtract(q22, q2);
4216     var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
4217     var denominator = geoVecCross(r2, s2);
4218     if (uNumerator && denominator) {
4219       var u2 = uNumerator / denominator;
4220       var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
4221       if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
4222         return geoVecInterp(p2, p22, t2);
4223       }
4224     }
4225     return null;
4226   }
4227   function geoPathIntersections(path1, path2) {
4228     var intersections = [];
4229     for (var i3 = 0; i3 < path1.length - 1; i3++) {
4230       for (var j2 = 0; j2 < path2.length - 1; j2++) {
4231         var a2 = [path1[i3], path1[i3 + 1]];
4232         var b2 = [path2[j2], path2[j2 + 1]];
4233         var hit = geoLineIntersection(a2, b2);
4234         if (hit) {
4235           intersections.push(hit);
4236         }
4237       }
4238     }
4239     return intersections;
4240   }
4241   function geoPathHasIntersections(path1, path2) {
4242     for (var i3 = 0; i3 < path1.length - 1; i3++) {
4243       for (var j2 = 0; j2 < path2.length - 1; j2++) {
4244         var a2 = [path1[i3], path1[i3 + 1]];
4245         var b2 = [path2[j2], path2[j2 + 1]];
4246         var hit = geoLineIntersection(a2, b2);
4247         if (hit) {
4248           return true;
4249         }
4250       }
4251     }
4252     return false;
4253   }
4254   function geoPointInPolygon(point, polygon2) {
4255     var x2 = point[0];
4256     var y2 = point[1];
4257     var inside = false;
4258     for (var i3 = 0, j2 = polygon2.length - 1; i3 < polygon2.length; j2 = i3++) {
4259       var xi = polygon2[i3][0];
4260       var yi = polygon2[i3][1];
4261       var xj = polygon2[j2][0];
4262       var yj = polygon2[j2][1];
4263       var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
4264       if (intersect2) inside = !inside;
4265     }
4266     return inside;
4267   }
4268   function geoPolygonContainsPolygon(outer, inner) {
4269     return inner.every(function(point) {
4270       return geoPointInPolygon(point, outer);
4271     });
4272   }
4273   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
4274     function testPoints(outer2, inner2) {
4275       return inner2.some(function(point) {
4276         return geoPointInPolygon(point, outer2);
4277       });
4278     }
4279     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
4280   }
4281   function geoGetSmallestSurroundingRectangle(points) {
4282     var hull = hull_default(points);
4283     var centroid = centroid_default2(hull);
4284     var minArea = Infinity;
4285     var ssrExtent = [];
4286     var ssrAngle = 0;
4287     var c1 = hull[0];
4288     for (var i3 = 0; i3 <= hull.length - 1; i3++) {
4289       var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
4290       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
4291       var poly = geoRotate(hull, -angle2, centroid);
4292       var extent = poly.reduce(function(extent2, point) {
4293         return extent2.extend(geoExtent(point));
4294       }, geoExtent());
4295       var area = extent.area();
4296       if (area < minArea) {
4297         minArea = area;
4298         ssrExtent = extent;
4299         ssrAngle = angle2;
4300       }
4301       c1 = c2;
4302     }
4303     return {
4304       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
4305       angle: ssrAngle
4306     };
4307   }
4308   function geoPathLength(path) {
4309     var length2 = 0;
4310     for (var i3 = 0; i3 < path.length - 1; i3++) {
4311       length2 += geoVecLength(path[i3], path[i3 + 1]);
4312     }
4313     return length2;
4314   }
4315   function geoViewportEdge(point, dimensions) {
4316     var pad3 = [80, 20, 50, 20];
4317     var x2 = 0;
4318     var y2 = 0;
4319     if (point[0] > dimensions[0] - pad3[1]) {
4320       x2 = -10;
4321     }
4322     if (point[0] < pad3[3]) {
4323       x2 = 10;
4324     }
4325     if (point[1] > dimensions[1] - pad3[2]) {
4326       y2 = -10;
4327     }
4328     if (point[1] < pad3[0]) {
4329       y2 = 10;
4330     }
4331     if (x2 || y2) {
4332       return [x2, y2];
4333     } else {
4334       return null;
4335     }
4336   }
4337   var init_geom = __esm({
4338     "modules/geo/geom.js"() {
4339       "use strict";
4340       init_src3();
4341       init_extent();
4342       init_vector();
4343     }
4344   });
4345
4346   // node_modules/d3-dispatch/src/dispatch.js
4347   function dispatch() {
4348     for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
4349       if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
4350       _2[t2] = [];
4351     }
4352     return new Dispatch(_2);
4353   }
4354   function Dispatch(_2) {
4355     this._ = _2;
4356   }
4357   function parseTypenames(typenames, types) {
4358     return typenames.trim().split(/^|\s+/).map(function(t2) {
4359       var name = "", i3 = t2.indexOf(".");
4360       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
4361       if (t2 && !types.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
4362       return { type: t2, name };
4363     });
4364   }
4365   function get(type2, name) {
4366     for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
4367       if ((c2 = type2[i3]).name === name) {
4368         return c2.value;
4369       }
4370     }
4371   }
4372   function set(type2, name, callback) {
4373     for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
4374       if (type2[i3].name === name) {
4375         type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
4376         break;
4377       }
4378     }
4379     if (callback != null) type2.push({ name, value: callback });
4380     return type2;
4381   }
4382   var noop2, dispatch_default;
4383   var init_dispatch = __esm({
4384     "node_modules/d3-dispatch/src/dispatch.js"() {
4385       noop2 = { value: () => {
4386       } };
4387       Dispatch.prototype = dispatch.prototype = {
4388         constructor: Dispatch,
4389         on: function(typename, callback) {
4390           var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
4391           if (arguments.length < 2) {
4392             while (++i3 < n3) if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name))) return t2;
4393             return;
4394           }
4395           if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
4396           while (++i3 < n3) {
4397             if (t2 = (typename = T2[i3]).type) _2[t2] = set(_2[t2], typename.name, callback);
4398             else if (callback == null) for (t2 in _2) _2[t2] = set(_2[t2], typename.name, null);
4399           }
4400           return this;
4401         },
4402         copy: function() {
4403           var copy2 = {}, _2 = this._;
4404           for (var t2 in _2) copy2[t2] = _2[t2].slice();
4405           return new Dispatch(copy2);
4406         },
4407         call: function(type2, that) {
4408           if ((n3 = arguments.length - 2) > 0) for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3) args[i3] = arguments[i3 + 2];
4409           if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
4410           for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
4411         },
4412         apply: function(type2, that, args) {
4413           if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
4414           for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
4415         }
4416       };
4417       dispatch_default = dispatch;
4418     }
4419   });
4420
4421   // node_modules/d3-dispatch/src/index.js
4422   var init_src4 = __esm({
4423     "node_modules/d3-dispatch/src/index.js"() {
4424       init_dispatch();
4425     }
4426   });
4427
4428   // node_modules/d3-selection/src/namespaces.js
4429   var xhtml, namespaces_default;
4430   var init_namespaces = __esm({
4431     "node_modules/d3-selection/src/namespaces.js"() {
4432       xhtml = "http://www.w3.org/1999/xhtml";
4433       namespaces_default = {
4434         svg: "http://www.w3.org/2000/svg",
4435         xhtml,
4436         xlink: "http://www.w3.org/1999/xlink",
4437         xml: "http://www.w3.org/XML/1998/namespace",
4438         xmlns: "http://www.w3.org/2000/xmlns/"
4439       };
4440     }
4441   });
4442
4443   // node_modules/d3-selection/src/namespace.js
4444   function namespace_default(name) {
4445     var prefix = name += "", i3 = prefix.indexOf(":");
4446     if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns") name = name.slice(i3 + 1);
4447     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
4448   }
4449   var init_namespace = __esm({
4450     "node_modules/d3-selection/src/namespace.js"() {
4451       init_namespaces();
4452     }
4453   });
4454
4455   // node_modules/d3-selection/src/creator.js
4456   function creatorInherit(name) {
4457     return function() {
4458       var document2 = this.ownerDocument, uri = this.namespaceURI;
4459       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
4460     };
4461   }
4462   function creatorFixed(fullname) {
4463     return function() {
4464       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
4465     };
4466   }
4467   function creator_default(name) {
4468     var fullname = namespace_default(name);
4469     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
4470   }
4471   var init_creator = __esm({
4472     "node_modules/d3-selection/src/creator.js"() {
4473       init_namespace();
4474       init_namespaces();
4475     }
4476   });
4477
4478   // node_modules/d3-selection/src/selector.js
4479   function none() {
4480   }
4481   function selector_default(selector) {
4482     return selector == null ? none : function() {
4483       return this.querySelector(selector);
4484     };
4485   }
4486   var init_selector = __esm({
4487     "node_modules/d3-selection/src/selector.js"() {
4488     }
4489   });
4490
4491   // node_modules/d3-selection/src/selection/select.js
4492   function select_default(select) {
4493     if (typeof select !== "function") select = selector_default(select);
4494     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4495       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
4496         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
4497           if ("__data__" in node) subnode.__data__ = node.__data__;
4498           subgroup[i3] = subnode;
4499         }
4500       }
4501     }
4502     return new Selection(subgroups, this._parents);
4503   }
4504   var init_select = __esm({
4505     "node_modules/d3-selection/src/selection/select.js"() {
4506       init_selection();
4507       init_selector();
4508     }
4509   });
4510
4511   // node_modules/d3-selection/src/array.js
4512   function array(x2) {
4513     return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
4514   }
4515   var init_array = __esm({
4516     "node_modules/d3-selection/src/array.js"() {
4517     }
4518   });
4519
4520   // node_modules/d3-selection/src/selectorAll.js
4521   function empty() {
4522     return [];
4523   }
4524   function selectorAll_default(selector) {
4525     return selector == null ? empty : function() {
4526       return this.querySelectorAll(selector);
4527     };
4528   }
4529   var init_selectorAll = __esm({
4530     "node_modules/d3-selection/src/selectorAll.js"() {
4531     }
4532   });
4533
4534   // node_modules/d3-selection/src/selection/selectAll.js
4535   function arrayAll(select) {
4536     return function() {
4537       return array(select.apply(this, arguments));
4538     };
4539   }
4540   function selectAll_default(select) {
4541     if (typeof select === "function") select = arrayAll(select);
4542     else select = selectorAll_default(select);
4543     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
4544       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
4545         if (node = group[i3]) {
4546           subgroups.push(select.call(node, node.__data__, i3, group));
4547           parents.push(node);
4548         }
4549       }
4550     }
4551     return new Selection(subgroups, parents);
4552   }
4553   var init_selectAll = __esm({
4554     "node_modules/d3-selection/src/selection/selectAll.js"() {
4555       init_selection();
4556       init_array();
4557       init_selectorAll();
4558     }
4559   });
4560
4561   // node_modules/d3-selection/src/matcher.js
4562   function matcher_default(selector) {
4563     return function() {
4564       return this.matches(selector);
4565     };
4566   }
4567   function childMatcher(selector) {
4568     return function(node) {
4569       return node.matches(selector);
4570     };
4571   }
4572   var init_matcher = __esm({
4573     "node_modules/d3-selection/src/matcher.js"() {
4574     }
4575   });
4576
4577   // node_modules/d3-selection/src/selection/selectChild.js
4578   function childFind(match) {
4579     return function() {
4580       return find.call(this.children, match);
4581     };
4582   }
4583   function childFirst() {
4584     return this.firstElementChild;
4585   }
4586   function selectChild_default(match) {
4587     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
4588   }
4589   var find;
4590   var init_selectChild = __esm({
4591     "node_modules/d3-selection/src/selection/selectChild.js"() {
4592       init_matcher();
4593       find = Array.prototype.find;
4594     }
4595   });
4596
4597   // node_modules/d3-selection/src/selection/selectChildren.js
4598   function children() {
4599     return Array.from(this.children);
4600   }
4601   function childrenFilter(match) {
4602     return function() {
4603       return filter.call(this.children, match);
4604     };
4605   }
4606   function selectChildren_default(match) {
4607     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
4608   }
4609   var filter;
4610   var init_selectChildren = __esm({
4611     "node_modules/d3-selection/src/selection/selectChildren.js"() {
4612       init_matcher();
4613       filter = Array.prototype.filter;
4614     }
4615   });
4616
4617   // node_modules/d3-selection/src/selection/filter.js
4618   function filter_default(match) {
4619     if (typeof match !== "function") match = matcher_default(match);
4620     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4621       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
4622         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
4623           subgroup.push(node);
4624         }
4625       }
4626     }
4627     return new Selection(subgroups, this._parents);
4628   }
4629   var init_filter = __esm({
4630     "node_modules/d3-selection/src/selection/filter.js"() {
4631       init_selection();
4632       init_matcher();
4633     }
4634   });
4635
4636   // node_modules/d3-selection/src/selection/sparse.js
4637   function sparse_default(update) {
4638     return new Array(update.length);
4639   }
4640   var init_sparse = __esm({
4641     "node_modules/d3-selection/src/selection/sparse.js"() {
4642     }
4643   });
4644
4645   // node_modules/d3-selection/src/selection/enter.js
4646   function enter_default() {
4647     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
4648   }
4649   function EnterNode(parent, datum2) {
4650     this.ownerDocument = parent.ownerDocument;
4651     this.namespaceURI = parent.namespaceURI;
4652     this._next = null;
4653     this._parent = parent;
4654     this.__data__ = datum2;
4655   }
4656   var init_enter = __esm({
4657     "node_modules/d3-selection/src/selection/enter.js"() {
4658       init_sparse();
4659       init_selection();
4660       EnterNode.prototype = {
4661         constructor: EnterNode,
4662         appendChild: function(child) {
4663           return this._parent.insertBefore(child, this._next);
4664         },
4665         insertBefore: function(child, next) {
4666           return this._parent.insertBefore(child, next);
4667         },
4668         querySelector: function(selector) {
4669           return this._parent.querySelector(selector);
4670         },
4671         querySelectorAll: function(selector) {
4672           return this._parent.querySelectorAll(selector);
4673         }
4674       };
4675     }
4676   });
4677
4678   // node_modules/d3-selection/src/constant.js
4679   function constant_default(x2) {
4680     return function() {
4681       return x2;
4682     };
4683   }
4684   var init_constant = __esm({
4685     "node_modules/d3-selection/src/constant.js"() {
4686     }
4687   });
4688
4689   // node_modules/d3-selection/src/selection/data.js
4690   function bindIndex(parent, group, enter, update, exit, data) {
4691     var i3 = 0, node, groupLength = group.length, dataLength = data.length;
4692     for (; i3 < dataLength; ++i3) {
4693       if (node = group[i3]) {
4694         node.__data__ = data[i3];
4695         update[i3] = node;
4696       } else {
4697         enter[i3] = new EnterNode(parent, data[i3]);
4698       }
4699     }
4700     for (; i3 < groupLength; ++i3) {
4701       if (node = group[i3]) {
4702         exit[i3] = node;
4703       }
4704     }
4705   }
4706   function bindKey(parent, group, enter, update, exit, data, key) {
4707     var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
4708     for (i3 = 0; i3 < groupLength; ++i3) {
4709       if (node = group[i3]) {
4710         keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
4711         if (nodeByKeyValue.has(keyValue)) {
4712           exit[i3] = node;
4713         } else {
4714           nodeByKeyValue.set(keyValue, node);
4715         }
4716       }
4717     }
4718     for (i3 = 0; i3 < dataLength; ++i3) {
4719       keyValue = key.call(parent, data[i3], i3, data) + "";
4720       if (node = nodeByKeyValue.get(keyValue)) {
4721         update[i3] = node;
4722         node.__data__ = data[i3];
4723         nodeByKeyValue.delete(keyValue);
4724       } else {
4725         enter[i3] = new EnterNode(parent, data[i3]);
4726       }
4727     }
4728     for (i3 = 0; i3 < groupLength; ++i3) {
4729       if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
4730         exit[i3] = node;
4731       }
4732     }
4733   }
4734   function datum(node) {
4735     return node.__data__;
4736   }
4737   function data_default(value, key) {
4738     if (!arguments.length) return Array.from(this, datum);
4739     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
4740     if (typeof value !== "function") value = constant_default(value);
4741     for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4742       var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
4743       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
4744       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
4745         if (previous = enterGroup[i0]) {
4746           if (i0 >= i1) i1 = i0 + 1;
4747           while (!(next = updateGroup[i1]) && ++i1 < dataLength) ;
4748           previous._next = next || null;
4749         }
4750       }
4751     }
4752     update = new Selection(update, parents);
4753     update._enter = enter;
4754     update._exit = exit;
4755     return update;
4756   }
4757   function arraylike(data) {
4758     return typeof data === "object" && "length" in data ? data : Array.from(data);
4759   }
4760   var init_data = __esm({
4761     "node_modules/d3-selection/src/selection/data.js"() {
4762       init_selection();
4763       init_enter();
4764       init_constant();
4765     }
4766   });
4767
4768   // node_modules/d3-selection/src/selection/exit.js
4769   function exit_default() {
4770     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
4771   }
4772   var init_exit = __esm({
4773     "node_modules/d3-selection/src/selection/exit.js"() {
4774       init_sparse();
4775       init_selection();
4776     }
4777   });
4778
4779   // node_modules/d3-selection/src/selection/join.js
4780   function join_default(onenter, onupdate, onexit) {
4781     var enter = this.enter(), update = this, exit = this.exit();
4782     if (typeof onenter === "function") {
4783       enter = onenter(enter);
4784       if (enter) enter = enter.selection();
4785     } else {
4786       enter = enter.append(onenter + "");
4787     }
4788     if (onupdate != null) {
4789       update = onupdate(update);
4790       if (update) update = update.selection();
4791     }
4792     if (onexit == null) exit.remove();
4793     else onexit(exit);
4794     return enter && update ? enter.merge(update).order() : update;
4795   }
4796   var init_join = __esm({
4797     "node_modules/d3-selection/src/selection/join.js"() {
4798     }
4799   });
4800
4801   // node_modules/d3-selection/src/selection/merge.js
4802   function merge_default(context) {
4803     var selection2 = context.selection ? context.selection() : context;
4804     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
4805       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge3 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
4806         if (node = group0[i3] || group1[i3]) {
4807           merge3[i3] = node;
4808         }
4809       }
4810     }
4811     for (; j2 < m0; ++j2) {
4812       merges[j2] = groups0[j2];
4813     }
4814     return new Selection(merges, this._parents);
4815   }
4816   var init_merge2 = __esm({
4817     "node_modules/d3-selection/src/selection/merge.js"() {
4818       init_selection();
4819     }
4820   });
4821
4822   // node_modules/d3-selection/src/selection/order.js
4823   function order_default() {
4824     for (var groups = this._groups, j2 = -1, m2 = groups.length; ++j2 < m2; ) {
4825       for (var group = groups[j2], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
4826         if (node = group[i3]) {
4827           if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
4828           next = node;
4829         }
4830       }
4831     }
4832     return this;
4833   }
4834   var init_order = __esm({
4835     "node_modules/d3-selection/src/selection/order.js"() {
4836     }
4837   });
4838
4839   // node_modules/d3-selection/src/selection/sort.js
4840   function sort_default(compare2) {
4841     if (!compare2) compare2 = ascending2;
4842     function compareNode(a2, b2) {
4843       return a2 && b2 ? compare2(a2.__data__, b2.__data__) : !a2 - !b2;
4844     }
4845     for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
4846       for (var group = groups[j2], n3 = group.length, sortgroup = sortgroups[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
4847         if (node = group[i3]) {
4848           sortgroup[i3] = node;
4849         }
4850       }
4851       sortgroup.sort(compareNode);
4852     }
4853     return new Selection(sortgroups, this._parents).order();
4854   }
4855   function ascending2(a2, b2) {
4856     return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
4857   }
4858   var init_sort2 = __esm({
4859     "node_modules/d3-selection/src/selection/sort.js"() {
4860       init_selection();
4861     }
4862   });
4863
4864   // node_modules/d3-selection/src/selection/call.js
4865   function call_default() {
4866     var callback = arguments[0];
4867     arguments[0] = this;
4868     callback.apply(null, arguments);
4869     return this;
4870   }
4871   var init_call = __esm({
4872     "node_modules/d3-selection/src/selection/call.js"() {
4873     }
4874   });
4875
4876   // node_modules/d3-selection/src/selection/nodes.js
4877   function nodes_default() {
4878     return Array.from(this);
4879   }
4880   var init_nodes = __esm({
4881     "node_modules/d3-selection/src/selection/nodes.js"() {
4882     }
4883   });
4884
4885   // node_modules/d3-selection/src/selection/node.js
4886   function node_default() {
4887     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
4888       for (var group = groups[j2], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
4889         var node = group[i3];
4890         if (node) return node;
4891       }
4892     }
4893     return null;
4894   }
4895   var init_node = __esm({
4896     "node_modules/d3-selection/src/selection/node.js"() {
4897     }
4898   });
4899
4900   // node_modules/d3-selection/src/selection/size.js
4901   function size_default() {
4902     let size = 0;
4903     for (const node of this) ++size;
4904     return size;
4905   }
4906   var init_size = __esm({
4907     "node_modules/d3-selection/src/selection/size.js"() {
4908     }
4909   });
4910
4911   // node_modules/d3-selection/src/selection/empty.js
4912   function empty_default() {
4913     return !this.node();
4914   }
4915   var init_empty = __esm({
4916     "node_modules/d3-selection/src/selection/empty.js"() {
4917     }
4918   });
4919
4920   // node_modules/d3-selection/src/selection/each.js
4921   function each_default(callback) {
4922     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
4923       for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
4924         if (node = group[i3]) callback.call(node, node.__data__, i3, group);
4925       }
4926     }
4927     return this;
4928   }
4929   var init_each = __esm({
4930     "node_modules/d3-selection/src/selection/each.js"() {
4931     }
4932   });
4933
4934   // node_modules/d3-selection/src/selection/attr.js
4935   function attrRemove(name) {
4936     return function() {
4937       this.removeAttribute(name);
4938     };
4939   }
4940   function attrRemoveNS(fullname) {
4941     return function() {
4942       this.removeAttributeNS(fullname.space, fullname.local);
4943     };
4944   }
4945   function attrConstant(name, value) {
4946     return function() {
4947       this.setAttribute(name, value);
4948     };
4949   }
4950   function attrConstantNS(fullname, value) {
4951     return function() {
4952       this.setAttributeNS(fullname.space, fullname.local, value);
4953     };
4954   }
4955   function attrFunction(name, value) {
4956     return function() {
4957       var v2 = value.apply(this, arguments);
4958       if (v2 == null) this.removeAttribute(name);
4959       else this.setAttribute(name, v2);
4960     };
4961   }
4962   function attrFunctionNS(fullname, value) {
4963     return function() {
4964       var v2 = value.apply(this, arguments);
4965       if (v2 == null) this.removeAttributeNS(fullname.space, fullname.local);
4966       else this.setAttributeNS(fullname.space, fullname.local, v2);
4967     };
4968   }
4969   function attr_default(name, value) {
4970     var fullname = namespace_default(name);
4971     if (arguments.length < 2) {
4972       var node = this.node();
4973       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
4974     }
4975     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
4976   }
4977   var init_attr = __esm({
4978     "node_modules/d3-selection/src/selection/attr.js"() {
4979       init_namespace();
4980     }
4981   });
4982
4983   // node_modules/d3-selection/src/window.js
4984   function window_default(node) {
4985     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
4986   }
4987   var init_window = __esm({
4988     "node_modules/d3-selection/src/window.js"() {
4989     }
4990   });
4991
4992   // node_modules/d3-selection/src/selection/style.js
4993   function styleRemove(name) {
4994     return function() {
4995       this.style.removeProperty(name);
4996     };
4997   }
4998   function styleConstant(name, value, priority) {
4999     return function() {
5000       this.style.setProperty(name, value, priority);
5001     };
5002   }
5003   function styleFunction(name, value, priority) {
5004     return function() {
5005       var v2 = value.apply(this, arguments);
5006       if (v2 == null) this.style.removeProperty(name);
5007       else this.style.setProperty(name, v2, priority);
5008     };
5009   }
5010   function style_default(name, value, priority) {
5011     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
5012   }
5013   function styleValue(node, name) {
5014     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
5015   }
5016   var init_style = __esm({
5017     "node_modules/d3-selection/src/selection/style.js"() {
5018       init_window();
5019     }
5020   });
5021
5022   // node_modules/d3-selection/src/selection/property.js
5023   function propertyRemove(name) {
5024     return function() {
5025       delete this[name];
5026     };
5027   }
5028   function propertyConstant(name, value) {
5029     return function() {
5030       this[name] = value;
5031     };
5032   }
5033   function propertyFunction(name, value) {
5034     return function() {
5035       var v2 = value.apply(this, arguments);
5036       if (v2 == null) delete this[name];
5037       else this[name] = v2;
5038     };
5039   }
5040   function property_default(name, value) {
5041     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
5042   }
5043   var init_property = __esm({
5044     "node_modules/d3-selection/src/selection/property.js"() {
5045     }
5046   });
5047
5048   // node_modules/d3-selection/src/selection/classed.js
5049   function classArray(string) {
5050     return string.trim().split(/^|\s+/);
5051   }
5052   function classList(node) {
5053     return node.classList || new ClassList(node);
5054   }
5055   function ClassList(node) {
5056     this._node = node;
5057     this._names = classArray(node.getAttribute("class") || "");
5058   }
5059   function classedAdd(node, names) {
5060     var list2 = classList(node), i3 = -1, n3 = names.length;
5061     while (++i3 < n3) list2.add(names[i3]);
5062   }
5063   function classedRemove(node, names) {
5064     var list2 = classList(node), i3 = -1, n3 = names.length;
5065     while (++i3 < n3) list2.remove(names[i3]);
5066   }
5067   function classedTrue(names) {
5068     return function() {
5069       classedAdd(this, names);
5070     };
5071   }
5072   function classedFalse(names) {
5073     return function() {
5074       classedRemove(this, names);
5075     };
5076   }
5077   function classedFunction(names, value) {
5078     return function() {
5079       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
5080     };
5081   }
5082   function classed_default(name, value) {
5083     var names = classArray(name + "");
5084     if (arguments.length < 2) {
5085       var list2 = classList(this.node()), i3 = -1, n3 = names.length;
5086       while (++i3 < n3) if (!list2.contains(names[i3])) return false;
5087       return true;
5088     }
5089     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
5090   }
5091   var init_classed = __esm({
5092     "node_modules/d3-selection/src/selection/classed.js"() {
5093       ClassList.prototype = {
5094         add: function(name) {
5095           var i3 = this._names.indexOf(name);
5096           if (i3 < 0) {
5097             this._names.push(name);
5098             this._node.setAttribute("class", this._names.join(" "));
5099           }
5100         },
5101         remove: function(name) {
5102           var i3 = this._names.indexOf(name);
5103           if (i3 >= 0) {
5104             this._names.splice(i3, 1);
5105             this._node.setAttribute("class", this._names.join(" "));
5106           }
5107         },
5108         contains: function(name) {
5109           return this._names.indexOf(name) >= 0;
5110         }
5111       };
5112     }
5113   });
5114
5115   // node_modules/d3-selection/src/selection/text.js
5116   function textRemove() {
5117     this.textContent = "";
5118   }
5119   function textConstant(value) {
5120     return function() {
5121       this.textContent = value;
5122     };
5123   }
5124   function textFunction(value) {
5125     return function() {
5126       var v2 = value.apply(this, arguments);
5127       this.textContent = v2 == null ? "" : v2;
5128     };
5129   }
5130   function text_default(value) {
5131     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
5132   }
5133   var init_text = __esm({
5134     "node_modules/d3-selection/src/selection/text.js"() {
5135     }
5136   });
5137
5138   // node_modules/d3-selection/src/selection/html.js
5139   function htmlRemove() {
5140     this.innerHTML = "";
5141   }
5142   function htmlConstant(value) {
5143     return function() {
5144       this.innerHTML = value;
5145     };
5146   }
5147   function htmlFunction(value) {
5148     return function() {
5149       var v2 = value.apply(this, arguments);
5150       this.innerHTML = v2 == null ? "" : v2;
5151     };
5152   }
5153   function html_default(value) {
5154     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
5155   }
5156   var init_html = __esm({
5157     "node_modules/d3-selection/src/selection/html.js"() {
5158     }
5159   });
5160
5161   // node_modules/d3-selection/src/selection/raise.js
5162   function raise() {
5163     if (this.nextSibling) this.parentNode.appendChild(this);
5164   }
5165   function raise_default() {
5166     return this.each(raise);
5167   }
5168   var init_raise = __esm({
5169     "node_modules/d3-selection/src/selection/raise.js"() {
5170     }
5171   });
5172
5173   // node_modules/d3-selection/src/selection/lower.js
5174   function lower() {
5175     if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
5176   }
5177   function lower_default() {
5178     return this.each(lower);
5179   }
5180   var init_lower = __esm({
5181     "node_modules/d3-selection/src/selection/lower.js"() {
5182     }
5183   });
5184
5185   // node_modules/d3-selection/src/selection/append.js
5186   function append_default(name) {
5187     var create2 = typeof name === "function" ? name : creator_default(name);
5188     return this.select(function() {
5189       return this.appendChild(create2.apply(this, arguments));
5190     });
5191   }
5192   var init_append = __esm({
5193     "node_modules/d3-selection/src/selection/append.js"() {
5194       init_creator();
5195     }
5196   });
5197
5198   // node_modules/d3-selection/src/selection/insert.js
5199   function constantNull() {
5200     return null;
5201   }
5202   function insert_default(name, before) {
5203     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
5204     return this.select(function() {
5205       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
5206     });
5207   }
5208   var init_insert = __esm({
5209     "node_modules/d3-selection/src/selection/insert.js"() {
5210       init_creator();
5211       init_selector();
5212     }
5213   });
5214
5215   // node_modules/d3-selection/src/selection/remove.js
5216   function remove() {
5217     var parent = this.parentNode;
5218     if (parent) parent.removeChild(this);
5219   }
5220   function remove_default() {
5221     return this.each(remove);
5222   }
5223   var init_remove = __esm({
5224     "node_modules/d3-selection/src/selection/remove.js"() {
5225     }
5226   });
5227
5228   // node_modules/d3-selection/src/selection/clone.js
5229   function selection_cloneShallow() {
5230     var clone2 = this.cloneNode(false), parent = this.parentNode;
5231     return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
5232   }
5233   function selection_cloneDeep() {
5234     var clone2 = this.cloneNode(true), parent = this.parentNode;
5235     return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
5236   }
5237   function clone_default(deep) {
5238     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
5239   }
5240   var init_clone = __esm({
5241     "node_modules/d3-selection/src/selection/clone.js"() {
5242     }
5243   });
5244
5245   // node_modules/d3-selection/src/selection/datum.js
5246   function datum_default(value) {
5247     return arguments.length ? this.property("__data__", value) : this.node().__data__;
5248   }
5249   var init_datum = __esm({
5250     "node_modules/d3-selection/src/selection/datum.js"() {
5251     }
5252   });
5253
5254   // node_modules/d3-selection/src/selection/on.js
5255   function contextListener(listener) {
5256     return function(event) {
5257       listener.call(this, event, this.__data__);
5258     };
5259   }
5260   function parseTypenames2(typenames) {
5261     return typenames.trim().split(/^|\s+/).map(function(t2) {
5262       var name = "", i3 = t2.indexOf(".");
5263       if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
5264       return { type: t2, name };
5265     });
5266   }
5267   function onRemove(typename) {
5268     return function() {
5269       var on = this.__on;
5270       if (!on) return;
5271       for (var j2 = 0, i3 = -1, m2 = on.length, o2; j2 < m2; ++j2) {
5272         if (o2 = on[j2], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
5273           this.removeEventListener(o2.type, o2.listener, o2.options);
5274         } else {
5275           on[++i3] = o2;
5276         }
5277       }
5278       if (++i3) on.length = i3;
5279       else delete this.__on;
5280     };
5281   }
5282   function onAdd(typename, value, options2) {
5283     return function() {
5284       var on = this.__on, o2, listener = contextListener(value);
5285       if (on) for (var j2 = 0, m2 = on.length; j2 < m2; ++j2) {
5286         if ((o2 = on[j2]).type === typename.type && o2.name === typename.name) {
5287           this.removeEventListener(o2.type, o2.listener, o2.options);
5288           this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
5289           o2.value = value;
5290           return;
5291         }
5292       }
5293       this.addEventListener(typename.type, listener, options2);
5294       o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
5295       if (!on) this.__on = [o2];
5296       else on.push(o2);
5297     };
5298   }
5299   function on_default(typename, value, options2) {
5300     var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
5301     if (arguments.length < 2) {
5302       var on = this.node().__on;
5303       if (on) for (var j2 = 0, m2 = on.length, o2; j2 < m2; ++j2) {
5304         for (i3 = 0, o2 = on[j2]; i3 < n3; ++i3) {
5305           if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
5306             return o2.value;
5307           }
5308         }
5309       }
5310       return;
5311     }
5312     on = value ? onAdd : onRemove;
5313     for (i3 = 0; i3 < n3; ++i3) this.each(on(typenames[i3], value, options2));
5314     return this;
5315   }
5316   var init_on = __esm({
5317     "node_modules/d3-selection/src/selection/on.js"() {
5318     }
5319   });
5320
5321   // node_modules/d3-selection/src/selection/dispatch.js
5322   function dispatchEvent(node, type2, params) {
5323     var window2 = window_default(node), event = window2.CustomEvent;
5324     if (typeof event === "function") {
5325       event = new event(type2, params);
5326     } else {
5327       event = window2.document.createEvent("Event");
5328       if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
5329       else event.initEvent(type2, false, false);
5330     }
5331     node.dispatchEvent(event);
5332   }
5333   function dispatchConstant(type2, params) {
5334     return function() {
5335       return dispatchEvent(this, type2, params);
5336     };
5337   }
5338   function dispatchFunction(type2, params) {
5339     return function() {
5340       return dispatchEvent(this, type2, params.apply(this, arguments));
5341     };
5342   }
5343   function dispatch_default2(type2, params) {
5344     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
5345   }
5346   var init_dispatch2 = __esm({
5347     "node_modules/d3-selection/src/selection/dispatch.js"() {
5348       init_window();
5349     }
5350   });
5351
5352   // node_modules/d3-selection/src/selection/iterator.js
5353   function* iterator_default() {
5354     for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
5355       for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
5356         if (node = group[i3]) yield node;
5357       }
5358     }
5359   }
5360   var init_iterator = __esm({
5361     "node_modules/d3-selection/src/selection/iterator.js"() {
5362     }
5363   });
5364
5365   // node_modules/d3-selection/src/selection/index.js
5366   function Selection(groups, parents) {
5367     this._groups = groups;
5368     this._parents = parents;
5369   }
5370   function selection() {
5371     return new Selection([[document.documentElement]], root);
5372   }
5373   function selection_selection() {
5374     return this;
5375   }
5376   var root, selection_default;
5377   var init_selection = __esm({
5378     "node_modules/d3-selection/src/selection/index.js"() {
5379       init_select();
5380       init_selectAll();
5381       init_selectChild();
5382       init_selectChildren();
5383       init_filter();
5384       init_data();
5385       init_enter();
5386       init_exit();
5387       init_join();
5388       init_merge2();
5389       init_order();
5390       init_sort2();
5391       init_call();
5392       init_nodes();
5393       init_node();
5394       init_size();
5395       init_empty();
5396       init_each();
5397       init_attr();
5398       init_style();
5399       init_property();
5400       init_classed();
5401       init_text();
5402       init_html();
5403       init_raise();
5404       init_lower();
5405       init_append();
5406       init_insert();
5407       init_remove();
5408       init_clone();
5409       init_datum();
5410       init_on();
5411       init_dispatch2();
5412       init_iterator();
5413       root = [null];
5414       Selection.prototype = selection.prototype = {
5415         constructor: Selection,
5416         select: select_default,
5417         selectAll: selectAll_default,
5418         selectChild: selectChild_default,
5419         selectChildren: selectChildren_default,
5420         filter: filter_default,
5421         data: data_default,
5422         enter: enter_default,
5423         exit: exit_default,
5424         join: join_default,
5425         merge: merge_default,
5426         selection: selection_selection,
5427         order: order_default,
5428         sort: sort_default,
5429         call: call_default,
5430         nodes: nodes_default,
5431         node: node_default,
5432         size: size_default,
5433         empty: empty_default,
5434         each: each_default,
5435         attr: attr_default,
5436         style: style_default,
5437         property: property_default,
5438         classed: classed_default,
5439         text: text_default,
5440         html: html_default,
5441         raise: raise_default,
5442         lower: lower_default,
5443         append: append_default,
5444         insert: insert_default,
5445         remove: remove_default,
5446         clone: clone_default,
5447         datum: datum_default,
5448         on: on_default,
5449         dispatch: dispatch_default2,
5450         [Symbol.iterator]: iterator_default
5451       };
5452       selection_default = selection;
5453     }
5454   });
5455
5456   // node_modules/d3-selection/src/select.js
5457   function select_default2(selector) {
5458     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
5459   }
5460   var init_select2 = __esm({
5461     "node_modules/d3-selection/src/select.js"() {
5462       init_selection();
5463     }
5464   });
5465
5466   // node_modules/d3-selection/src/sourceEvent.js
5467   function sourceEvent_default(event) {
5468     let sourceEvent;
5469     while (sourceEvent = event.sourceEvent) event = sourceEvent;
5470     return event;
5471   }
5472   var init_sourceEvent = __esm({
5473     "node_modules/d3-selection/src/sourceEvent.js"() {
5474     }
5475   });
5476
5477   // node_modules/d3-selection/src/pointer.js
5478   function pointer_default(event, node) {
5479     event = sourceEvent_default(event);
5480     if (node === void 0) node = event.currentTarget;
5481     if (node) {
5482       var svg2 = node.ownerSVGElement || node;
5483       if (svg2.createSVGPoint) {
5484         var point = svg2.createSVGPoint();
5485         point.x = event.clientX, point.y = event.clientY;
5486         point = point.matrixTransform(node.getScreenCTM().inverse());
5487         return [point.x, point.y];
5488       }
5489       if (node.getBoundingClientRect) {
5490         var rect = node.getBoundingClientRect();
5491         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
5492       }
5493     }
5494     return [event.pageX, event.pageY];
5495   }
5496   var init_pointer = __esm({
5497     "node_modules/d3-selection/src/pointer.js"() {
5498       init_sourceEvent();
5499     }
5500   });
5501
5502   // node_modules/d3-selection/src/selectAll.js
5503   function selectAll_default2(selector) {
5504     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
5505   }
5506   var init_selectAll2 = __esm({
5507     "node_modules/d3-selection/src/selectAll.js"() {
5508       init_array();
5509       init_selection();
5510     }
5511   });
5512
5513   // node_modules/d3-selection/src/index.js
5514   var init_src5 = __esm({
5515     "node_modules/d3-selection/src/index.js"() {
5516       init_matcher();
5517       init_namespace();
5518       init_pointer();
5519       init_select2();
5520       init_selectAll2();
5521       init_selection();
5522       init_selector();
5523       init_selectorAll();
5524       init_style();
5525     }
5526   });
5527
5528   // node_modules/d3-drag/src/noevent.js
5529   function nopropagation(event) {
5530     event.stopImmediatePropagation();
5531   }
5532   function noevent_default(event) {
5533     event.preventDefault();
5534     event.stopImmediatePropagation();
5535   }
5536   var nonpassive, nonpassivecapture;
5537   var init_noevent = __esm({
5538     "node_modules/d3-drag/src/noevent.js"() {
5539       nonpassive = { passive: false };
5540       nonpassivecapture = { capture: true, passive: false };
5541     }
5542   });
5543
5544   // node_modules/d3-drag/src/nodrag.js
5545   function nodrag_default(view) {
5546     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
5547     if ("onselectstart" in root3) {
5548       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
5549     } else {
5550       root3.__noselect = root3.style.MozUserSelect;
5551       root3.style.MozUserSelect = "none";
5552     }
5553   }
5554   function yesdrag(view, noclick) {
5555     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
5556     if (noclick) {
5557       selection2.on("click.drag", noevent_default, nonpassivecapture);
5558       setTimeout(function() {
5559         selection2.on("click.drag", null);
5560       }, 0);
5561     }
5562     if ("onselectstart" in root3) {
5563       selection2.on("selectstart.drag", null);
5564     } else {
5565       root3.style.MozUserSelect = root3.__noselect;
5566       delete root3.__noselect;
5567     }
5568   }
5569   var init_nodrag = __esm({
5570     "node_modules/d3-drag/src/nodrag.js"() {
5571       init_src5();
5572       init_noevent();
5573     }
5574   });
5575
5576   // node_modules/d3-drag/src/constant.js
5577   var constant_default2;
5578   var init_constant2 = __esm({
5579     "node_modules/d3-drag/src/constant.js"() {
5580       constant_default2 = (x2) => () => x2;
5581     }
5582   });
5583
5584   // node_modules/d3-drag/src/event.js
5585   function DragEvent(type2, {
5586     sourceEvent,
5587     subject,
5588     target,
5589     identifier,
5590     active,
5591     x: x2,
5592     y: y2,
5593     dx,
5594     dy,
5595     dispatch: dispatch14
5596   }) {
5597     Object.defineProperties(this, {
5598       type: { value: type2, enumerable: true, configurable: true },
5599       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
5600       subject: { value: subject, enumerable: true, configurable: true },
5601       target: { value: target, enumerable: true, configurable: true },
5602       identifier: { value: identifier, enumerable: true, configurable: true },
5603       active: { value: active, enumerable: true, configurable: true },
5604       x: { value: x2, enumerable: true, configurable: true },
5605       y: { value: y2, enumerable: true, configurable: true },
5606       dx: { value: dx, enumerable: true, configurable: true },
5607       dy: { value: dy, enumerable: true, configurable: true },
5608       _: { value: dispatch14 }
5609     });
5610   }
5611   var init_event = __esm({
5612     "node_modules/d3-drag/src/event.js"() {
5613       DragEvent.prototype.on = function() {
5614         var value = this._.on.apply(this._, arguments);
5615         return value === this._ ? this : value;
5616       };
5617     }
5618   });
5619
5620   // node_modules/d3-drag/src/drag.js
5621   function defaultFilter(event) {
5622     return !event.ctrlKey && !event.button;
5623   }
5624   function defaultContainer() {
5625     return this.parentNode;
5626   }
5627   function defaultSubject(event, d2) {
5628     return d2 == null ? { x: event.x, y: event.y } : d2;
5629   }
5630   function defaultTouchable() {
5631     return navigator.maxTouchPoints || "ontouchstart" in this;
5632   }
5633   function drag_default() {
5634     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
5635     function drag(selection2) {
5636       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)");
5637     }
5638     function mousedowned(event, d2) {
5639       if (touchending || !filter2.call(this, event, d2)) return;
5640       var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
5641       if (!gesture) return;
5642       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
5643       nodrag_default(event.view);
5644       nopropagation(event);
5645       mousemoving = false;
5646       mousedownx = event.clientX;
5647       mousedowny = event.clientY;
5648       gesture("start", event);
5649     }
5650     function mousemoved(event) {
5651       noevent_default(event);
5652       if (!mousemoving) {
5653         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
5654         mousemoving = dx * dx + dy * dy > clickDistance2;
5655       }
5656       gestures.mouse("drag", event);
5657     }
5658     function mouseupped(event) {
5659       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
5660       yesdrag(event.view, mousemoving);
5661       noevent_default(event);
5662       gestures.mouse("end", event);
5663     }
5664     function touchstarted(event, d2) {
5665       if (!filter2.call(this, event, d2)) return;
5666       var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
5667       for (i3 = 0; i3 < n3; ++i3) {
5668         if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
5669           nopropagation(event);
5670           gesture("start", event, touches[i3]);
5671         }
5672       }
5673     }
5674     function touchmoved(event) {
5675       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
5676       for (i3 = 0; i3 < n3; ++i3) {
5677         if (gesture = gestures[touches[i3].identifier]) {
5678           noevent_default(event);
5679           gesture("drag", event, touches[i3]);
5680         }
5681       }
5682     }
5683     function touchended(event) {
5684       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
5685       if (touchending) clearTimeout(touchending);
5686       touchending = setTimeout(function() {
5687         touchending = null;
5688       }, 500);
5689       for (i3 = 0; i3 < n3; ++i3) {
5690         if (gesture = gestures[touches[i3].identifier]) {
5691           nopropagation(event);
5692           gesture("end", event, touches[i3]);
5693         }
5694       }
5695     }
5696     function beforestart(that, container2, event, d2, identifier, touch) {
5697       var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
5698       if ((s2 = subject.call(that, new DragEvent("beforestart", {
5699         sourceEvent: event,
5700         target: drag,
5701         identifier,
5702         active,
5703         x: p2[0],
5704         y: p2[1],
5705         dx: 0,
5706         dy: 0,
5707         dispatch: dispatch14
5708       }), d2)) == null) return;
5709       dx = s2.x - p2[0] || 0;
5710       dy = s2.y - p2[1] || 0;
5711       return function gesture(type2, event2, touch2) {
5712         var p02 = p2, n3;
5713         switch (type2) {
5714           case "start":
5715             gestures[identifier] = gesture, n3 = active++;
5716             break;
5717           case "end":
5718             delete gestures[identifier], --active;
5719           // falls through
5720           case "drag":
5721             p2 = pointer_default(touch2 || event2, container2), n3 = active;
5722             break;
5723         }
5724         dispatch14.call(
5725           type2,
5726           that,
5727           new DragEvent(type2, {
5728             sourceEvent: event2,
5729             subject: s2,
5730             target: drag,
5731             identifier,
5732             active: n3,
5733             x: p2[0] + dx,
5734             y: p2[1] + dy,
5735             dx: p2[0] - p02[0],
5736             dy: p2[1] - p02[1],
5737             dispatch: dispatch14
5738           }),
5739           d2
5740         );
5741       };
5742     }
5743     drag.filter = function(_2) {
5744       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
5745     };
5746     drag.container = function(_2) {
5747       return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
5748     };
5749     drag.subject = function(_2) {
5750       return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
5751     };
5752     drag.touchable = function(_2) {
5753       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
5754     };
5755     drag.on = function() {
5756       var value = listeners.on.apply(listeners, arguments);
5757       return value === listeners ? drag : value;
5758     };
5759     drag.clickDistance = function(_2) {
5760       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
5761     };
5762     return drag;
5763   }
5764   var init_drag = __esm({
5765     "node_modules/d3-drag/src/drag.js"() {
5766       init_src4();
5767       init_src5();
5768       init_nodrag();
5769       init_noevent();
5770       init_constant2();
5771       init_event();
5772     }
5773   });
5774
5775   // node_modules/d3-drag/src/index.js
5776   var init_src6 = __esm({
5777     "node_modules/d3-drag/src/index.js"() {
5778       init_drag();
5779       init_nodrag();
5780     }
5781   });
5782
5783   // node_modules/d3-color/src/define.js
5784   function define_default(constructor, factory, prototype4) {
5785     constructor.prototype = factory.prototype = prototype4;
5786     prototype4.constructor = constructor;
5787   }
5788   function extend(parent, definition) {
5789     var prototype4 = Object.create(parent.prototype);
5790     for (var key in definition) prototype4[key] = definition[key];
5791     return prototype4;
5792   }
5793   var init_define = __esm({
5794     "node_modules/d3-color/src/define.js"() {
5795     }
5796   });
5797
5798   // node_modules/d3-color/src/color.js
5799   function Color() {
5800   }
5801   function color_formatHex() {
5802     return this.rgb().formatHex();
5803   }
5804   function color_formatHex8() {
5805     return this.rgb().formatHex8();
5806   }
5807   function color_formatHsl() {
5808     return hslConvert(this).formatHsl();
5809   }
5810   function color_formatRgb() {
5811     return this.rgb().formatRgb();
5812   }
5813   function color(format2) {
5814     var m2, l2;
5815     format2 = (format2 + "").trim().toLowerCase();
5816     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;
5817   }
5818   function rgbn(n3) {
5819     return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
5820   }
5821   function rgba(r2, g3, b2, a2) {
5822     if (a2 <= 0) r2 = g3 = b2 = NaN;
5823     return new Rgb(r2, g3, b2, a2);
5824   }
5825   function rgbConvert(o2) {
5826     if (!(o2 instanceof Color)) o2 = color(o2);
5827     if (!o2) return new Rgb();
5828     o2 = o2.rgb();
5829     return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
5830   }
5831   function rgb(r2, g3, b2, opacity) {
5832     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
5833   }
5834   function Rgb(r2, g3, b2, opacity) {
5835     this.r = +r2;
5836     this.g = +g3;
5837     this.b = +b2;
5838     this.opacity = +opacity;
5839   }
5840   function rgb_formatHex() {
5841     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
5842   }
5843   function rgb_formatHex8() {
5844     return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
5845   }
5846   function rgb_formatRgb() {
5847     const a2 = clampa(this.opacity);
5848     return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`;
5849   }
5850   function clampa(opacity) {
5851     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
5852   }
5853   function clampi(value) {
5854     return Math.max(0, Math.min(255, Math.round(value) || 0));
5855   }
5856   function hex(value) {
5857     value = clampi(value);
5858     return (value < 16 ? "0" : "") + value.toString(16);
5859   }
5860   function hsla(h2, s2, l2, a2) {
5861     if (a2 <= 0) h2 = s2 = l2 = NaN;
5862     else if (l2 <= 0 || l2 >= 1) h2 = s2 = NaN;
5863     else if (s2 <= 0) h2 = NaN;
5864     return new Hsl(h2, s2, l2, a2);
5865   }
5866   function hslConvert(o2) {
5867     if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
5868     if (!(o2 instanceof Color)) o2 = color(o2);
5869     if (!o2) return new Hsl();
5870     if (o2 instanceof Hsl) return o2;
5871     o2 = o2.rgb();
5872     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;
5873     if (s2) {
5874       if (r2 === max3) h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
5875       else if (g3 === max3) h2 = (b2 - r2) / s2 + 2;
5876       else h2 = (r2 - g3) / s2 + 4;
5877       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
5878       h2 *= 60;
5879     } else {
5880       s2 = l2 > 0 && l2 < 1 ? 0 : h2;
5881     }
5882     return new Hsl(h2, s2, l2, o2.opacity);
5883   }
5884   function hsl(h2, s2, l2, opacity) {
5885     return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
5886   }
5887   function Hsl(h2, s2, l2, opacity) {
5888     this.h = +h2;
5889     this.s = +s2;
5890     this.l = +l2;
5891     this.opacity = +opacity;
5892   }
5893   function clamph(value) {
5894     value = (value || 0) % 360;
5895     return value < 0 ? value + 360 : value;
5896   }
5897   function clampt(value) {
5898     return Math.max(0, Math.min(1, value || 0));
5899   }
5900   function hsl2rgb(h2, m1, m2) {
5901     return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
5902   }
5903   var darker, brighter, reI, reN, reP, reHex, reRgbInteger, reRgbPercent, reRgbaInteger, reRgbaPercent, reHslPercent, reHslaPercent, named;
5904   var init_color = __esm({
5905     "node_modules/d3-color/src/color.js"() {
5906       init_define();
5907       darker = 0.7;
5908       brighter = 1 / darker;
5909       reI = "\\s*([+-]?\\d+)\\s*";
5910       reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
5911       reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
5912       reHex = /^#([0-9a-f]{3,8})$/;
5913       reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
5914       reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
5915       reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
5916       reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
5917       reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
5918       reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
5919       named = {
5920         aliceblue: 15792383,
5921         antiquewhite: 16444375,
5922         aqua: 65535,
5923         aquamarine: 8388564,
5924         azure: 15794175,
5925         beige: 16119260,
5926         bisque: 16770244,
5927         black: 0,
5928         blanchedalmond: 16772045,
5929         blue: 255,
5930         blueviolet: 9055202,
5931         brown: 10824234,
5932         burlywood: 14596231,
5933         cadetblue: 6266528,
5934         chartreuse: 8388352,
5935         chocolate: 13789470,
5936         coral: 16744272,
5937         cornflowerblue: 6591981,
5938         cornsilk: 16775388,
5939         crimson: 14423100,
5940         cyan: 65535,
5941         darkblue: 139,
5942         darkcyan: 35723,
5943         darkgoldenrod: 12092939,
5944         darkgray: 11119017,
5945         darkgreen: 25600,
5946         darkgrey: 11119017,
5947         darkkhaki: 12433259,
5948         darkmagenta: 9109643,
5949         darkolivegreen: 5597999,
5950         darkorange: 16747520,
5951         darkorchid: 10040012,
5952         darkred: 9109504,
5953         darksalmon: 15308410,
5954         darkseagreen: 9419919,
5955         darkslateblue: 4734347,
5956         darkslategray: 3100495,
5957         darkslategrey: 3100495,
5958         darkturquoise: 52945,
5959         darkviolet: 9699539,
5960         deeppink: 16716947,
5961         deepskyblue: 49151,
5962         dimgray: 6908265,
5963         dimgrey: 6908265,
5964         dodgerblue: 2003199,
5965         firebrick: 11674146,
5966         floralwhite: 16775920,
5967         forestgreen: 2263842,
5968         fuchsia: 16711935,
5969         gainsboro: 14474460,
5970         ghostwhite: 16316671,
5971         gold: 16766720,
5972         goldenrod: 14329120,
5973         gray: 8421504,
5974         green: 32768,
5975         greenyellow: 11403055,
5976         grey: 8421504,
5977         honeydew: 15794160,
5978         hotpink: 16738740,
5979         indianred: 13458524,
5980         indigo: 4915330,
5981         ivory: 16777200,
5982         khaki: 15787660,
5983         lavender: 15132410,
5984         lavenderblush: 16773365,
5985         lawngreen: 8190976,
5986         lemonchiffon: 16775885,
5987         lightblue: 11393254,
5988         lightcoral: 15761536,
5989         lightcyan: 14745599,
5990         lightgoldenrodyellow: 16448210,
5991         lightgray: 13882323,
5992         lightgreen: 9498256,
5993         lightgrey: 13882323,
5994         lightpink: 16758465,
5995         lightsalmon: 16752762,
5996         lightseagreen: 2142890,
5997         lightskyblue: 8900346,
5998         lightslategray: 7833753,
5999         lightslategrey: 7833753,
6000         lightsteelblue: 11584734,
6001         lightyellow: 16777184,
6002         lime: 65280,
6003         limegreen: 3329330,
6004         linen: 16445670,
6005         magenta: 16711935,
6006         maroon: 8388608,
6007         mediumaquamarine: 6737322,
6008         mediumblue: 205,
6009         mediumorchid: 12211667,
6010         mediumpurple: 9662683,
6011         mediumseagreen: 3978097,
6012         mediumslateblue: 8087790,
6013         mediumspringgreen: 64154,
6014         mediumturquoise: 4772300,
6015         mediumvioletred: 13047173,
6016         midnightblue: 1644912,
6017         mintcream: 16121850,
6018         mistyrose: 16770273,
6019         moccasin: 16770229,
6020         navajowhite: 16768685,
6021         navy: 128,
6022         oldlace: 16643558,
6023         olive: 8421376,
6024         olivedrab: 7048739,
6025         orange: 16753920,
6026         orangered: 16729344,
6027         orchid: 14315734,
6028         palegoldenrod: 15657130,
6029         palegreen: 10025880,
6030         paleturquoise: 11529966,
6031         palevioletred: 14381203,
6032         papayawhip: 16773077,
6033         peachpuff: 16767673,
6034         peru: 13468991,
6035         pink: 16761035,
6036         plum: 14524637,
6037         powderblue: 11591910,
6038         purple: 8388736,
6039         rebeccapurple: 6697881,
6040         red: 16711680,
6041         rosybrown: 12357519,
6042         royalblue: 4286945,
6043         saddlebrown: 9127187,
6044         salmon: 16416882,
6045         sandybrown: 16032864,
6046         seagreen: 3050327,
6047         seashell: 16774638,
6048         sienna: 10506797,
6049         silver: 12632256,
6050         skyblue: 8900331,
6051         slateblue: 6970061,
6052         slategray: 7372944,
6053         slategrey: 7372944,
6054         snow: 16775930,
6055         springgreen: 65407,
6056         steelblue: 4620980,
6057         tan: 13808780,
6058         teal: 32896,
6059         thistle: 14204888,
6060         tomato: 16737095,
6061         turquoise: 4251856,
6062         violet: 15631086,
6063         wheat: 16113331,
6064         white: 16777215,
6065         whitesmoke: 16119285,
6066         yellow: 16776960,
6067         yellowgreen: 10145074
6068       };
6069       define_default(Color, color, {
6070         copy(channels) {
6071           return Object.assign(new this.constructor(), this, channels);
6072         },
6073         displayable() {
6074           return this.rgb().displayable();
6075         },
6076         hex: color_formatHex,
6077         // Deprecated! Use color.formatHex.
6078         formatHex: color_formatHex,
6079         formatHex8: color_formatHex8,
6080         formatHsl: color_formatHsl,
6081         formatRgb: color_formatRgb,
6082         toString: color_formatRgb
6083       });
6084       define_default(Rgb, rgb, extend(Color, {
6085         brighter(k2) {
6086           k2 = k2 == null ? brighter : Math.pow(brighter, k2);
6087           return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
6088         },
6089         darker(k2) {
6090           k2 = k2 == null ? darker : Math.pow(darker, k2);
6091           return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
6092         },
6093         rgb() {
6094           return this;
6095         },
6096         clamp() {
6097           return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
6098         },
6099         displayable() {
6100           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);
6101         },
6102         hex: rgb_formatHex,
6103         // Deprecated! Use color.formatHex.
6104         formatHex: rgb_formatHex,
6105         formatHex8: rgb_formatHex8,
6106         formatRgb: rgb_formatRgb,
6107         toString: rgb_formatRgb
6108       }));
6109       define_default(Hsl, hsl, extend(Color, {
6110         brighter(k2) {
6111           k2 = k2 == null ? brighter : Math.pow(brighter, k2);
6112           return new Hsl(this.h, this.s, this.l * k2, this.opacity);
6113         },
6114         darker(k2) {
6115           k2 = k2 == null ? darker : Math.pow(darker, k2);
6116           return new Hsl(this.h, this.s, this.l * k2, this.opacity);
6117         },
6118         rgb() {
6119           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;
6120           return new Rgb(
6121             hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
6122             hsl2rgb(h2, m1, m2),
6123             hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
6124             this.opacity
6125           );
6126         },
6127         clamp() {
6128           return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
6129         },
6130         displayable() {
6131           return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
6132         },
6133         formatHsl() {
6134           const a2 = clampa(this.opacity);
6135           return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`;
6136         }
6137       }));
6138     }
6139   });
6140
6141   // node_modules/d3-color/src/index.js
6142   var init_src7 = __esm({
6143     "node_modules/d3-color/src/index.js"() {
6144       init_color();
6145     }
6146   });
6147
6148   // node_modules/d3-interpolate/src/basis.js
6149   function basis(t12, v0, v1, v2, v3) {
6150     var t2 = t12 * t12, t3 = t2 * t12;
6151     return ((1 - 3 * t12 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t12 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
6152   }
6153   function basis_default(values) {
6154     var n3 = values.length - 1;
6155     return function(t2) {
6156       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;
6157       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
6158     };
6159   }
6160   var init_basis = __esm({
6161     "node_modules/d3-interpolate/src/basis.js"() {
6162     }
6163   });
6164
6165   // node_modules/d3-interpolate/src/basisClosed.js
6166   function basisClosed_default(values) {
6167     var n3 = values.length;
6168     return function(t2) {
6169       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];
6170       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
6171     };
6172   }
6173   var init_basisClosed = __esm({
6174     "node_modules/d3-interpolate/src/basisClosed.js"() {
6175       init_basis();
6176     }
6177   });
6178
6179   // node_modules/d3-interpolate/src/constant.js
6180   var constant_default3;
6181   var init_constant3 = __esm({
6182     "node_modules/d3-interpolate/src/constant.js"() {
6183       constant_default3 = (x2) => () => x2;
6184     }
6185   });
6186
6187   // node_modules/d3-interpolate/src/color.js
6188   function linear(a2, d2) {
6189     return function(t2) {
6190       return a2 + t2 * d2;
6191     };
6192   }
6193   function exponential(a2, b2, y2) {
6194     return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
6195       return Math.pow(a2 + t2 * b2, y2);
6196     };
6197   }
6198   function gamma(y2) {
6199     return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
6200       return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
6201     };
6202   }
6203   function nogamma(a2, b2) {
6204     var d2 = b2 - a2;
6205     return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
6206   }
6207   var init_color2 = __esm({
6208     "node_modules/d3-interpolate/src/color.js"() {
6209       init_constant3();
6210     }
6211   });
6212
6213   // node_modules/d3-interpolate/src/rgb.js
6214   function rgbSpline(spline) {
6215     return function(colors) {
6216       var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
6217       for (i3 = 0; i3 < n3; ++i3) {
6218         color2 = rgb(colors[i3]);
6219         r2[i3] = color2.r || 0;
6220         g3[i3] = color2.g || 0;
6221         b2[i3] = color2.b || 0;
6222       }
6223       r2 = spline(r2);
6224       g3 = spline(g3);
6225       b2 = spline(b2);
6226       color2.opacity = 1;
6227       return function(t2) {
6228         color2.r = r2(t2);
6229         color2.g = g3(t2);
6230         color2.b = b2(t2);
6231         return color2 + "";
6232       };
6233     };
6234   }
6235   var rgb_default, rgbBasis, rgbBasisClosed;
6236   var init_rgb = __esm({
6237     "node_modules/d3-interpolate/src/rgb.js"() {
6238       init_src7();
6239       init_basis();
6240       init_basisClosed();
6241       init_color2();
6242       rgb_default = function rgbGamma(y2) {
6243         var color2 = gamma(y2);
6244         function rgb2(start2, end) {
6245           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);
6246           return function(t2) {
6247             start2.r = r2(t2);
6248             start2.g = g3(t2);
6249             start2.b = b2(t2);
6250             start2.opacity = opacity(t2);
6251             return start2 + "";
6252           };
6253         }
6254         rgb2.gamma = rgbGamma;
6255         return rgb2;
6256       }(1);
6257       rgbBasis = rgbSpline(basis_default);
6258       rgbBasisClosed = rgbSpline(basisClosed_default);
6259     }
6260   });
6261
6262   // node_modules/d3-interpolate/src/numberArray.js
6263   function numberArray_default(a2, b2) {
6264     if (!b2) b2 = [];
6265     var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
6266     return function(t2) {
6267       for (i3 = 0; i3 < n3; ++i3) c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
6268       return c2;
6269     };
6270   }
6271   function isNumberArray(x2) {
6272     return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
6273   }
6274   var init_numberArray = __esm({
6275     "node_modules/d3-interpolate/src/numberArray.js"() {
6276     }
6277   });
6278
6279   // node_modules/d3-interpolate/src/array.js
6280   function genericArray(a2, b2) {
6281     var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
6282     for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a2[i3], b2[i3]);
6283     for (; i3 < nb; ++i3) c2[i3] = b2[i3];
6284     return function(t2) {
6285       for (i3 = 0; i3 < na; ++i3) c2[i3] = x2[i3](t2);
6286       return c2;
6287     };
6288   }
6289   var init_array2 = __esm({
6290     "node_modules/d3-interpolate/src/array.js"() {
6291       init_value();
6292     }
6293   });
6294
6295   // node_modules/d3-interpolate/src/date.js
6296   function date_default(a2, b2) {
6297     var d2 = /* @__PURE__ */ new Date();
6298     return a2 = +a2, b2 = +b2, function(t2) {
6299       return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
6300     };
6301   }
6302   var init_date = __esm({
6303     "node_modules/d3-interpolate/src/date.js"() {
6304     }
6305   });
6306
6307   // node_modules/d3-interpolate/src/number.js
6308   function number_default(a2, b2) {
6309     return a2 = +a2, b2 = +b2, function(t2) {
6310       return a2 * (1 - t2) + b2 * t2;
6311     };
6312   }
6313   var init_number2 = __esm({
6314     "node_modules/d3-interpolate/src/number.js"() {
6315     }
6316   });
6317
6318   // node_modules/d3-interpolate/src/object.js
6319   function object_default(a2, b2) {
6320     var i3 = {}, c2 = {}, k2;
6321     if (a2 === null || typeof a2 !== "object") a2 = {};
6322     if (b2 === null || typeof b2 !== "object") b2 = {};
6323     for (k2 in b2) {
6324       if (k2 in a2) {
6325         i3[k2] = value_default(a2[k2], b2[k2]);
6326       } else {
6327         c2[k2] = b2[k2];
6328       }
6329     }
6330     return function(t2) {
6331       for (k2 in i3) c2[k2] = i3[k2](t2);
6332       return c2;
6333     };
6334   }
6335   var init_object = __esm({
6336     "node_modules/d3-interpolate/src/object.js"() {
6337       init_value();
6338     }
6339   });
6340
6341   // node_modules/d3-interpolate/src/string.js
6342   function zero2(b2) {
6343     return function() {
6344       return b2;
6345     };
6346   }
6347   function one(b2) {
6348     return function(t2) {
6349       return b2(t2) + "";
6350     };
6351   }
6352   function string_default(a2, b2) {
6353     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
6354     a2 = a2 + "", b2 = b2 + "";
6355     while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
6356       if ((bs = bm.index) > bi) {
6357         bs = b2.slice(bi, bs);
6358         if (s2[i3]) s2[i3] += bs;
6359         else s2[++i3] = bs;
6360       }
6361       if ((am = am[0]) === (bm = bm[0])) {
6362         if (s2[i3]) s2[i3] += bm;
6363         else s2[++i3] = bm;
6364       } else {
6365         s2[++i3] = null;
6366         q2.push({ i: i3, x: number_default(am, bm) });
6367       }
6368       bi = reB.lastIndex;
6369     }
6370     if (bi < b2.length) {
6371       bs = b2.slice(bi);
6372       if (s2[i3]) s2[i3] += bs;
6373       else s2[++i3] = bs;
6374     }
6375     return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
6376       for (var i4 = 0, o2; i4 < b2; ++i4) s2[(o2 = q2[i4]).i] = o2.x(t2);
6377       return s2.join("");
6378     });
6379   }
6380   var reA, reB;
6381   var init_string2 = __esm({
6382     "node_modules/d3-interpolate/src/string.js"() {
6383       init_number2();
6384       reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
6385       reB = new RegExp(reA.source, "g");
6386     }
6387   });
6388
6389   // node_modules/d3-interpolate/src/value.js
6390   function value_default(a2, b2) {
6391     var t2 = typeof b2, c2;
6392     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);
6393   }
6394   var init_value = __esm({
6395     "node_modules/d3-interpolate/src/value.js"() {
6396       init_src7();
6397       init_rgb();
6398       init_array2();
6399       init_date();
6400       init_number2();
6401       init_object();
6402       init_string2();
6403       init_constant3();
6404       init_numberArray();
6405     }
6406   });
6407
6408   // node_modules/d3-interpolate/src/round.js
6409   function round_default(a2, b2) {
6410     return a2 = +a2, b2 = +b2, function(t2) {
6411       return Math.round(a2 * (1 - t2) + b2 * t2);
6412     };
6413   }
6414   var init_round = __esm({
6415     "node_modules/d3-interpolate/src/round.js"() {
6416     }
6417   });
6418
6419   // node_modules/d3-interpolate/src/transform/decompose.js
6420   function decompose_default(a2, b2, c2, d2, e3, f2) {
6421     var scaleX, scaleY, skewX;
6422     if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX;
6423     if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX;
6424     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
6425     if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
6426     return {
6427       translateX: e3,
6428       translateY: f2,
6429       rotate: Math.atan2(b2, a2) * degrees2,
6430       skewX: Math.atan(skewX) * degrees2,
6431       scaleX,
6432       scaleY
6433     };
6434   }
6435   var degrees2, identity;
6436   var init_decompose = __esm({
6437     "node_modules/d3-interpolate/src/transform/decompose.js"() {
6438       degrees2 = 180 / Math.PI;
6439       identity = {
6440         translateX: 0,
6441         translateY: 0,
6442         rotate: 0,
6443         skewX: 0,
6444         scaleX: 1,
6445         scaleY: 1
6446       };
6447     }
6448   });
6449
6450   // node_modules/d3-interpolate/src/transform/parse.js
6451   function parseCss(value) {
6452     const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
6453     return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
6454   }
6455   function parseSvg(value) {
6456     if (value == null) return identity;
6457     if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
6458     svgNode.setAttribute("transform", value);
6459     if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
6460     value = value.matrix;
6461     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
6462   }
6463   var svgNode;
6464   var init_parse = __esm({
6465     "node_modules/d3-interpolate/src/transform/parse.js"() {
6466       init_decompose();
6467     }
6468   });
6469
6470   // node_modules/d3-interpolate/src/transform/index.js
6471   function interpolateTransform(parse, pxComma, pxParen, degParen) {
6472     function pop(s2) {
6473       return s2.length ? s2.pop() + " " : "";
6474     }
6475     function translate(xa, ya, xb, yb, s2, q2) {
6476       if (xa !== xb || ya !== yb) {
6477         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
6478         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
6479       } else if (xb || yb) {
6480         s2.push("translate(" + xb + pxComma + yb + pxParen);
6481       }
6482     }
6483     function rotate(a2, b2, s2, q2) {
6484       if (a2 !== b2) {
6485         if (a2 - b2 > 180) b2 += 360;
6486         else if (b2 - a2 > 180) a2 += 360;
6487         q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
6488       } else if (b2) {
6489         s2.push(pop(s2) + "rotate(" + b2 + degParen);
6490       }
6491     }
6492     function skewX(a2, b2, s2, q2) {
6493       if (a2 !== b2) {
6494         q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
6495       } else if (b2) {
6496         s2.push(pop(s2) + "skewX(" + b2 + degParen);
6497       }
6498     }
6499     function scale(xa, ya, xb, yb, s2, q2) {
6500       if (xa !== xb || ya !== yb) {
6501         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
6502         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
6503       } else if (xb !== 1 || yb !== 1) {
6504         s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
6505       }
6506     }
6507     return function(a2, b2) {
6508       var s2 = [], q2 = [];
6509       a2 = parse(a2), b2 = parse(b2);
6510       translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
6511       rotate(a2.rotate, b2.rotate, s2, q2);
6512       skewX(a2.skewX, b2.skewX, s2, q2);
6513       scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
6514       a2 = b2 = null;
6515       return function(t2) {
6516         var i3 = -1, n3 = q2.length, o2;
6517         while (++i3 < n3) s2[(o2 = q2[i3]).i] = o2.x(t2);
6518         return s2.join("");
6519       };
6520     };
6521   }
6522   var interpolateTransformCss, interpolateTransformSvg;
6523   var init_transform2 = __esm({
6524     "node_modules/d3-interpolate/src/transform/index.js"() {
6525       init_number2();
6526       init_parse();
6527       interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
6528       interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
6529     }
6530   });
6531
6532   // node_modules/d3-interpolate/src/zoom.js
6533   function cosh(x2) {
6534     return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
6535   }
6536   function sinh(x2) {
6537     return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
6538   }
6539   function tanh(x2) {
6540     return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
6541   }
6542   var epsilon22, zoom_default;
6543   var init_zoom = __esm({
6544     "node_modules/d3-interpolate/src/zoom.js"() {
6545       epsilon22 = 1e-12;
6546       zoom_default = function zoomRho(rho, rho2, rho4) {
6547         function zoom(p02, p1) {
6548           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;
6549           if (d2 < epsilon22) {
6550             S2 = Math.log(w1 / w0) / rho;
6551             i3 = function(t2) {
6552               return [
6553                 ux0 + t2 * dx,
6554                 uy0 + t2 * dy,
6555                 w0 * Math.exp(rho * t2 * S2)
6556               ];
6557             };
6558           } else {
6559             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);
6560             S2 = (r1 - r0) / rho;
6561             i3 = function(t2) {
6562               var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
6563               return [
6564                 ux0 + u2 * dx,
6565                 uy0 + u2 * dy,
6566                 w0 * coshr0 / cosh(rho * s2 + r0)
6567               ];
6568             };
6569           }
6570           i3.duration = S2 * 1e3 * rho / Math.SQRT2;
6571           return i3;
6572         }
6573         zoom.rho = function(_2) {
6574           var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
6575           return zoomRho(_1, _22, _4);
6576         };
6577         return zoom;
6578       }(Math.SQRT2, 2, 4);
6579     }
6580   });
6581
6582   // node_modules/d3-interpolate/src/quantize.js
6583   function quantize_default(interpolator, n3) {
6584     var samples = new Array(n3);
6585     for (var i3 = 0; i3 < n3; ++i3) samples[i3] = interpolator(i3 / (n3 - 1));
6586     return samples;
6587   }
6588   var init_quantize = __esm({
6589     "node_modules/d3-interpolate/src/quantize.js"() {
6590     }
6591   });
6592
6593   // node_modules/d3-interpolate/src/index.js
6594   var init_src8 = __esm({
6595     "node_modules/d3-interpolate/src/index.js"() {
6596       init_value();
6597       init_number2();
6598       init_round();
6599       init_string2();
6600       init_transform2();
6601       init_zoom();
6602       init_rgb();
6603       init_quantize();
6604     }
6605   });
6606
6607   // node_modules/d3-timer/src/timer.js
6608   function now() {
6609     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
6610   }
6611   function clearNow() {
6612     clockNow = 0;
6613   }
6614   function Timer() {
6615     this._call = this._time = this._next = null;
6616   }
6617   function timer(callback, delay, time) {
6618     var t2 = new Timer();
6619     t2.restart(callback, delay, time);
6620     return t2;
6621   }
6622   function timerFlush() {
6623     now();
6624     ++frame;
6625     var t2 = taskHead, e3;
6626     while (t2) {
6627       if ((e3 = clockNow - t2._time) >= 0) t2._call.call(void 0, e3);
6628       t2 = t2._next;
6629     }
6630     --frame;
6631   }
6632   function wake() {
6633     clockNow = (clockLast = clock.now()) + clockSkew;
6634     frame = timeout = 0;
6635     try {
6636       timerFlush();
6637     } finally {
6638       frame = 0;
6639       nap();
6640       clockNow = 0;
6641     }
6642   }
6643   function poke() {
6644     var now3 = clock.now(), delay = now3 - clockLast;
6645     if (delay > pokeDelay) clockSkew -= delay, clockLast = now3;
6646   }
6647   function nap() {
6648     var t02, t12 = taskHead, t2, time = Infinity;
6649     while (t12) {
6650       if (t12._call) {
6651         if (time > t12._time) time = t12._time;
6652         t02 = t12, t12 = t12._next;
6653       } else {
6654         t2 = t12._next, t12._next = null;
6655         t12 = t02 ? t02._next = t2 : taskHead = t2;
6656       }
6657     }
6658     taskTail = t02;
6659     sleep(time);
6660   }
6661   function sleep(time) {
6662     if (frame) return;
6663     if (timeout) timeout = clearTimeout(timeout);
6664     var delay = time - clockNow;
6665     if (delay > 24) {
6666       if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
6667       if (interval) interval = clearInterval(interval);
6668     } else {
6669       if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
6670       frame = 1, setFrame(wake);
6671     }
6672   }
6673   var frame, timeout, interval, pokeDelay, taskHead, taskTail, clockLast, clockNow, clockSkew, clock, setFrame;
6674   var init_timer = __esm({
6675     "node_modules/d3-timer/src/timer.js"() {
6676       frame = 0;
6677       timeout = 0;
6678       interval = 0;
6679       pokeDelay = 1e3;
6680       clockLast = 0;
6681       clockNow = 0;
6682       clockSkew = 0;
6683       clock = typeof performance === "object" && performance.now ? performance : Date;
6684       setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
6685         setTimeout(f2, 17);
6686       };
6687       Timer.prototype = timer.prototype = {
6688         constructor: Timer,
6689         restart: function(callback, delay, time) {
6690           if (typeof callback !== "function") throw new TypeError("callback is not a function");
6691           time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
6692           if (!this._next && taskTail !== this) {
6693             if (taskTail) taskTail._next = this;
6694             else taskHead = this;
6695             taskTail = this;
6696           }
6697           this._call = callback;
6698           this._time = time;
6699           sleep();
6700         },
6701         stop: function() {
6702           if (this._call) {
6703             this._call = null;
6704             this._time = Infinity;
6705             sleep();
6706           }
6707         }
6708       };
6709     }
6710   });
6711
6712   // node_modules/d3-timer/src/timeout.js
6713   function timeout_default(callback, delay, time) {
6714     var t2 = new Timer();
6715     delay = delay == null ? 0 : +delay;
6716     t2.restart((elapsed) => {
6717       t2.stop();
6718       callback(elapsed + delay);
6719     }, delay, time);
6720     return t2;
6721   }
6722   var init_timeout = __esm({
6723     "node_modules/d3-timer/src/timeout.js"() {
6724       init_timer();
6725     }
6726   });
6727
6728   // node_modules/d3-timer/src/index.js
6729   var init_src9 = __esm({
6730     "node_modules/d3-timer/src/index.js"() {
6731       init_timer();
6732       init_timeout();
6733     }
6734   });
6735
6736   // node_modules/d3-transition/src/transition/schedule.js
6737   function schedule_default(node, name, id2, index, group, timing) {
6738     var schedules = node.__transition;
6739     if (!schedules) node.__transition = {};
6740     else if (id2 in schedules) return;
6741     create(node, id2, {
6742       name,
6743       index,
6744       // For context during callback.
6745       group,
6746       // For context during callback.
6747       on: emptyOn,
6748       tween: emptyTween,
6749       time: timing.time,
6750       delay: timing.delay,
6751       duration: timing.duration,
6752       ease: timing.ease,
6753       timer: null,
6754       state: CREATED
6755     });
6756   }
6757   function init(node, id2) {
6758     var schedule = get2(node, id2);
6759     if (schedule.state > CREATED) throw new Error("too late; already scheduled");
6760     return schedule;
6761   }
6762   function set2(node, id2) {
6763     var schedule = get2(node, id2);
6764     if (schedule.state > STARTED) throw new Error("too late; already running");
6765     return schedule;
6766   }
6767   function get2(node, id2) {
6768     var schedule = node.__transition;
6769     if (!schedule || !(schedule = schedule[id2])) throw new Error("transition not found");
6770     return schedule;
6771   }
6772   function create(node, id2, self2) {
6773     var schedules = node.__transition, tween;
6774     schedules[id2] = self2;
6775     self2.timer = timer(schedule, 0, self2.time);
6776     function schedule(elapsed) {
6777       self2.state = SCHEDULED;
6778       self2.timer.restart(start2, self2.delay, self2.time);
6779       if (self2.delay <= elapsed) start2(elapsed - self2.delay);
6780     }
6781     function start2(elapsed) {
6782       var i3, j2, n3, o2;
6783       if (self2.state !== SCHEDULED) return stop();
6784       for (i3 in schedules) {
6785         o2 = schedules[i3];
6786         if (o2.name !== self2.name) continue;
6787         if (o2.state === STARTED) return timeout_default(start2);
6788         if (o2.state === RUNNING) {
6789           o2.state = ENDED;
6790           o2.timer.stop();
6791           o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
6792           delete schedules[i3];
6793         } else if (+i3 < id2) {
6794           o2.state = ENDED;
6795           o2.timer.stop();
6796           o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
6797           delete schedules[i3];
6798         }
6799       }
6800       timeout_default(function() {
6801         if (self2.state === STARTED) {
6802           self2.state = RUNNING;
6803           self2.timer.restart(tick, self2.delay, self2.time);
6804           tick(elapsed);
6805         }
6806       });
6807       self2.state = STARTING;
6808       self2.on.call("start", node, node.__data__, self2.index, self2.group);
6809       if (self2.state !== STARTING) return;
6810       self2.state = STARTED;
6811       tween = new Array(n3 = self2.tween.length);
6812       for (i3 = 0, j2 = -1; i3 < n3; ++i3) {
6813         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
6814           tween[++j2] = o2;
6815         }
6816       }
6817       tween.length = j2 + 1;
6818     }
6819     function tick(elapsed) {
6820       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;
6821       while (++i3 < n3) {
6822         tween[i3].call(node, t2);
6823       }
6824       if (self2.state === ENDING) {
6825         self2.on.call("end", node, node.__data__, self2.index, self2.group);
6826         stop();
6827       }
6828     }
6829     function stop() {
6830       self2.state = ENDED;
6831       self2.timer.stop();
6832       delete schedules[id2];
6833       for (var i3 in schedules) return;
6834       delete node.__transition;
6835     }
6836   }
6837   var emptyOn, emptyTween, CREATED, SCHEDULED, STARTING, STARTED, RUNNING, ENDING, ENDED;
6838   var init_schedule = __esm({
6839     "node_modules/d3-transition/src/transition/schedule.js"() {
6840       init_src4();
6841       init_src9();
6842       emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
6843       emptyTween = [];
6844       CREATED = 0;
6845       SCHEDULED = 1;
6846       STARTING = 2;
6847       STARTED = 3;
6848       RUNNING = 4;
6849       ENDING = 5;
6850       ENDED = 6;
6851     }
6852   });
6853
6854   // node_modules/d3-transition/src/interrupt.js
6855   function interrupt_default(node, name) {
6856     var schedules = node.__transition, schedule, active, empty2 = true, i3;
6857     if (!schedules) return;
6858     name = name == null ? null : name + "";
6859     for (i3 in schedules) {
6860       if ((schedule = schedules[i3]).name !== name) {
6861         empty2 = false;
6862         continue;
6863       }
6864       active = schedule.state > STARTING && schedule.state < ENDING;
6865       schedule.state = ENDED;
6866       schedule.timer.stop();
6867       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
6868       delete schedules[i3];
6869     }
6870     if (empty2) delete node.__transition;
6871   }
6872   var init_interrupt = __esm({
6873     "node_modules/d3-transition/src/interrupt.js"() {
6874       init_schedule();
6875     }
6876   });
6877
6878   // node_modules/d3-transition/src/selection/interrupt.js
6879   function interrupt_default2(name) {
6880     return this.each(function() {
6881       interrupt_default(this, name);
6882     });
6883   }
6884   var init_interrupt2 = __esm({
6885     "node_modules/d3-transition/src/selection/interrupt.js"() {
6886       init_interrupt();
6887     }
6888   });
6889
6890   // node_modules/d3-transition/src/transition/tween.js
6891   function tweenRemove(id2, name) {
6892     var tween0, tween1;
6893     return function() {
6894       var schedule = set2(this, id2), tween = schedule.tween;
6895       if (tween !== tween0) {
6896         tween1 = tween0 = tween;
6897         for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
6898           if (tween1[i3].name === name) {
6899             tween1 = tween1.slice();
6900             tween1.splice(i3, 1);
6901             break;
6902           }
6903         }
6904       }
6905       schedule.tween = tween1;
6906     };
6907   }
6908   function tweenFunction(id2, name, value) {
6909     var tween0, tween1;
6910     if (typeof value !== "function") throw new Error();
6911     return function() {
6912       var schedule = set2(this, id2), tween = schedule.tween;
6913       if (tween !== tween0) {
6914         tween1 = (tween0 = tween).slice();
6915         for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
6916           if (tween1[i3].name === name) {
6917             tween1[i3] = t2;
6918             break;
6919           }
6920         }
6921         if (i3 === n3) tween1.push(t2);
6922       }
6923       schedule.tween = tween1;
6924     };
6925   }
6926   function tween_default(name, value) {
6927     var id2 = this._id;
6928     name += "";
6929     if (arguments.length < 2) {
6930       var tween = get2(this.node(), id2).tween;
6931       for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
6932         if ((t2 = tween[i3]).name === name) {
6933           return t2.value;
6934         }
6935       }
6936       return null;
6937     }
6938     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
6939   }
6940   function tweenValue(transition2, name, value) {
6941     var id2 = transition2._id;
6942     transition2.each(function() {
6943       var schedule = set2(this, id2);
6944       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
6945     });
6946     return function(node) {
6947       return get2(node, id2).value[name];
6948     };
6949   }
6950   var init_tween = __esm({
6951     "node_modules/d3-transition/src/transition/tween.js"() {
6952       init_schedule();
6953     }
6954   });
6955
6956   // node_modules/d3-transition/src/transition/interpolate.js
6957   function interpolate_default(a2, b2) {
6958     var c2;
6959     return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
6960   }
6961   var init_interpolate = __esm({
6962     "node_modules/d3-transition/src/transition/interpolate.js"() {
6963       init_src7();
6964       init_src8();
6965     }
6966   });
6967
6968   // node_modules/d3-transition/src/transition/attr.js
6969   function attrRemove2(name) {
6970     return function() {
6971       this.removeAttribute(name);
6972     };
6973   }
6974   function attrRemoveNS2(fullname) {
6975     return function() {
6976       this.removeAttributeNS(fullname.space, fullname.local);
6977     };
6978   }
6979   function attrConstant2(name, interpolate, value1) {
6980     var string00, string1 = value1 + "", interpolate0;
6981     return function() {
6982       var string0 = this.getAttribute(name);
6983       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
6984     };
6985   }
6986   function attrConstantNS2(fullname, interpolate, value1) {
6987     var string00, string1 = value1 + "", interpolate0;
6988     return function() {
6989       var string0 = this.getAttributeNS(fullname.space, fullname.local);
6990       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
6991     };
6992   }
6993   function attrFunction2(name, interpolate, value) {
6994     var string00, string10, interpolate0;
6995     return function() {
6996       var string0, value1 = value(this), string1;
6997       if (value1 == null) return void this.removeAttribute(name);
6998       string0 = this.getAttribute(name);
6999       string1 = value1 + "";
7000       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7001     };
7002   }
7003   function attrFunctionNS2(fullname, interpolate, value) {
7004     var string00, string10, interpolate0;
7005     return function() {
7006       var string0, value1 = value(this), string1;
7007       if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
7008       string0 = this.getAttributeNS(fullname.space, fullname.local);
7009       string1 = value1 + "";
7010       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7011     };
7012   }
7013   function attr_default2(name, value) {
7014     var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
7015     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));
7016   }
7017   var init_attr2 = __esm({
7018     "node_modules/d3-transition/src/transition/attr.js"() {
7019       init_src8();
7020       init_src5();
7021       init_tween();
7022       init_interpolate();
7023     }
7024   });
7025
7026   // node_modules/d3-transition/src/transition/attrTween.js
7027   function attrInterpolate(name, i3) {
7028     return function(t2) {
7029       this.setAttribute(name, i3.call(this, t2));
7030     };
7031   }
7032   function attrInterpolateNS(fullname, i3) {
7033     return function(t2) {
7034       this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
7035     };
7036   }
7037   function attrTweenNS(fullname, value) {
7038     var t02, i0;
7039     function tween() {
7040       var i3 = value.apply(this, arguments);
7041       if (i3 !== i0) t02 = (i0 = i3) && attrInterpolateNS(fullname, i3);
7042       return t02;
7043     }
7044     tween._value = value;
7045     return tween;
7046   }
7047   function attrTween(name, value) {
7048     var t02, i0;
7049     function tween() {
7050       var i3 = value.apply(this, arguments);
7051       if (i3 !== i0) t02 = (i0 = i3) && attrInterpolate(name, i3);
7052       return t02;
7053     }
7054     tween._value = value;
7055     return tween;
7056   }
7057   function attrTween_default(name, value) {
7058     var key = "attr." + name;
7059     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
7060     if (value == null) return this.tween(key, null);
7061     if (typeof value !== "function") throw new Error();
7062     var fullname = namespace_default(name);
7063     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
7064   }
7065   var init_attrTween = __esm({
7066     "node_modules/d3-transition/src/transition/attrTween.js"() {
7067       init_src5();
7068     }
7069   });
7070
7071   // node_modules/d3-transition/src/transition/delay.js
7072   function delayFunction(id2, value) {
7073     return function() {
7074       init(this, id2).delay = +value.apply(this, arguments);
7075     };
7076   }
7077   function delayConstant(id2, value) {
7078     return value = +value, function() {
7079       init(this, id2).delay = value;
7080     };
7081   }
7082   function delay_default(value) {
7083     var id2 = this._id;
7084     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
7085   }
7086   var init_delay = __esm({
7087     "node_modules/d3-transition/src/transition/delay.js"() {
7088       init_schedule();
7089     }
7090   });
7091
7092   // node_modules/d3-transition/src/transition/duration.js
7093   function durationFunction(id2, value) {
7094     return function() {
7095       set2(this, id2).duration = +value.apply(this, arguments);
7096     };
7097   }
7098   function durationConstant(id2, value) {
7099     return value = +value, function() {
7100       set2(this, id2).duration = value;
7101     };
7102   }
7103   function duration_default(value) {
7104     var id2 = this._id;
7105     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
7106   }
7107   var init_duration = __esm({
7108     "node_modules/d3-transition/src/transition/duration.js"() {
7109       init_schedule();
7110     }
7111   });
7112
7113   // node_modules/d3-transition/src/transition/ease.js
7114   function easeConstant(id2, value) {
7115     if (typeof value !== "function") throw new Error();
7116     return function() {
7117       set2(this, id2).ease = value;
7118     };
7119   }
7120   function ease_default(value) {
7121     var id2 = this._id;
7122     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
7123   }
7124   var init_ease = __esm({
7125     "node_modules/d3-transition/src/transition/ease.js"() {
7126       init_schedule();
7127     }
7128   });
7129
7130   // node_modules/d3-transition/src/transition/easeVarying.js
7131   function easeVarying(id2, value) {
7132     return function() {
7133       var v2 = value.apply(this, arguments);
7134       if (typeof v2 !== "function") throw new Error();
7135       set2(this, id2).ease = v2;
7136     };
7137   }
7138   function easeVarying_default(value) {
7139     if (typeof value !== "function") throw new Error();
7140     return this.each(easeVarying(this._id, value));
7141   }
7142   var init_easeVarying = __esm({
7143     "node_modules/d3-transition/src/transition/easeVarying.js"() {
7144       init_schedule();
7145     }
7146   });
7147
7148   // node_modules/d3-transition/src/transition/filter.js
7149   function filter_default2(match) {
7150     if (typeof match !== "function") match = matcher_default(match);
7151     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
7152       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
7153         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
7154           subgroup.push(node);
7155         }
7156       }
7157     }
7158     return new Transition(subgroups, this._parents, this._name, this._id);
7159   }
7160   var init_filter2 = __esm({
7161     "node_modules/d3-transition/src/transition/filter.js"() {
7162       init_src5();
7163       init_transition2();
7164     }
7165   });
7166
7167   // node_modules/d3-transition/src/transition/merge.js
7168   function merge_default2(transition2) {
7169     if (transition2._id !== this._id) throw new Error();
7170     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
7171       for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge3 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
7172         if (node = group0[i3] || group1[i3]) {
7173           merge3[i3] = node;
7174         }
7175       }
7176     }
7177     for (; j2 < m0; ++j2) {
7178       merges[j2] = groups0[j2];
7179     }
7180     return new Transition(merges, this._parents, this._name, this._id);
7181   }
7182   var init_merge3 = __esm({
7183     "node_modules/d3-transition/src/transition/merge.js"() {
7184       init_transition2();
7185     }
7186   });
7187
7188   // node_modules/d3-transition/src/transition/on.js
7189   function start(name) {
7190     return (name + "").trim().split(/^|\s+/).every(function(t2) {
7191       var i3 = t2.indexOf(".");
7192       if (i3 >= 0) t2 = t2.slice(0, i3);
7193       return !t2 || t2 === "start";
7194     });
7195   }
7196   function onFunction(id2, name, listener) {
7197     var on0, on1, sit = start(name) ? init : set2;
7198     return function() {
7199       var schedule = sit(this, id2), on = schedule.on;
7200       if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
7201       schedule.on = on1;
7202     };
7203   }
7204   function on_default2(name, listener) {
7205     var id2 = this._id;
7206     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
7207   }
7208   var init_on2 = __esm({
7209     "node_modules/d3-transition/src/transition/on.js"() {
7210       init_schedule();
7211     }
7212   });
7213
7214   // node_modules/d3-transition/src/transition/remove.js
7215   function removeFunction(id2) {
7216     return function() {
7217       var parent = this.parentNode;
7218       for (var i3 in this.__transition) if (+i3 !== id2) return;
7219       if (parent) parent.removeChild(this);
7220     };
7221   }
7222   function remove_default2() {
7223     return this.on("end.remove", removeFunction(this._id));
7224   }
7225   var init_remove2 = __esm({
7226     "node_modules/d3-transition/src/transition/remove.js"() {
7227     }
7228   });
7229
7230   // node_modules/d3-transition/src/transition/select.js
7231   function select_default3(select) {
7232     var name = this._name, id2 = this._id;
7233     if (typeof select !== "function") select = selector_default(select);
7234     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
7235       for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
7236         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
7237           if ("__data__" in node) subnode.__data__ = node.__data__;
7238           subgroup[i3] = subnode;
7239           schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
7240         }
7241       }
7242     }
7243     return new Transition(subgroups, this._parents, name, id2);
7244   }
7245   var init_select3 = __esm({
7246     "node_modules/d3-transition/src/transition/select.js"() {
7247       init_src5();
7248       init_transition2();
7249       init_schedule();
7250     }
7251   });
7252
7253   // node_modules/d3-transition/src/transition/selectAll.js
7254   function selectAll_default3(select) {
7255     var name = this._name, id2 = this._id;
7256     if (typeof select !== "function") select = selectorAll_default(select);
7257     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
7258       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7259         if (node = group[i3]) {
7260           for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
7261             if (child = children2[k2]) {
7262               schedule_default(child, name, id2, k2, children2, inherit2);
7263             }
7264           }
7265           subgroups.push(children2);
7266           parents.push(node);
7267         }
7268       }
7269     }
7270     return new Transition(subgroups, parents, name, id2);
7271   }
7272   var init_selectAll3 = __esm({
7273     "node_modules/d3-transition/src/transition/selectAll.js"() {
7274       init_src5();
7275       init_transition2();
7276       init_schedule();
7277     }
7278   });
7279
7280   // node_modules/d3-transition/src/transition/selection.js
7281   function selection_default2() {
7282     return new Selection2(this._groups, this._parents);
7283   }
7284   var Selection2;
7285   var init_selection2 = __esm({
7286     "node_modules/d3-transition/src/transition/selection.js"() {
7287       init_src5();
7288       Selection2 = selection_default.prototype.constructor;
7289     }
7290   });
7291
7292   // node_modules/d3-transition/src/transition/style.js
7293   function styleNull(name, interpolate) {
7294     var string00, string10, interpolate0;
7295     return function() {
7296       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
7297       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
7298     };
7299   }
7300   function styleRemove2(name) {
7301     return function() {
7302       this.style.removeProperty(name);
7303     };
7304   }
7305   function styleConstant2(name, interpolate, value1) {
7306     var string00, string1 = value1 + "", interpolate0;
7307     return function() {
7308       var string0 = styleValue(this, name);
7309       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
7310     };
7311   }
7312   function styleFunction2(name, interpolate, value) {
7313     var string00, string10, interpolate0;
7314     return function() {
7315       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
7316       if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
7317       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
7318     };
7319   }
7320   function styleMaybeRemove(id2, name) {
7321     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
7322     return function() {
7323       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
7324       if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
7325       schedule.on = on1;
7326     };
7327   }
7328   function style_default2(name, value, priority) {
7329     var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
7330     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);
7331   }
7332   var init_style2 = __esm({
7333     "node_modules/d3-transition/src/transition/style.js"() {
7334       init_src8();
7335       init_src5();
7336       init_schedule();
7337       init_tween();
7338       init_interpolate();
7339     }
7340   });
7341
7342   // node_modules/d3-transition/src/transition/styleTween.js
7343   function styleInterpolate(name, i3, priority) {
7344     return function(t2) {
7345       this.style.setProperty(name, i3.call(this, t2), priority);
7346     };
7347   }
7348   function styleTween(name, value, priority) {
7349     var t2, i0;
7350     function tween() {
7351       var i3 = value.apply(this, arguments);
7352       if (i3 !== i0) t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
7353       return t2;
7354     }
7355     tween._value = value;
7356     return tween;
7357   }
7358   function styleTween_default(name, value, priority) {
7359     var key = "style." + (name += "");
7360     if (arguments.length < 2) return (key = this.tween(key)) && key._value;
7361     if (value == null) return this.tween(key, null);
7362     if (typeof value !== "function") throw new Error();
7363     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
7364   }
7365   var init_styleTween = __esm({
7366     "node_modules/d3-transition/src/transition/styleTween.js"() {
7367     }
7368   });
7369
7370   // node_modules/d3-transition/src/transition/text.js
7371   function textConstant2(value) {
7372     return function() {
7373       this.textContent = value;
7374     };
7375   }
7376   function textFunction2(value) {
7377     return function() {
7378       var value1 = value(this);
7379       this.textContent = value1 == null ? "" : value1;
7380     };
7381   }
7382   function text_default2(value) {
7383     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
7384   }
7385   var init_text2 = __esm({
7386     "node_modules/d3-transition/src/transition/text.js"() {
7387       init_tween();
7388     }
7389   });
7390
7391   // node_modules/d3-transition/src/transition/textTween.js
7392   function textInterpolate(i3) {
7393     return function(t2) {
7394       this.textContent = i3.call(this, t2);
7395     };
7396   }
7397   function textTween(value) {
7398     var t02, i0;
7399     function tween() {
7400       var i3 = value.apply(this, arguments);
7401       if (i3 !== i0) t02 = (i0 = i3) && textInterpolate(i3);
7402       return t02;
7403     }
7404     tween._value = value;
7405     return tween;
7406   }
7407   function textTween_default(value) {
7408     var key = "text";
7409     if (arguments.length < 1) return (key = this.tween(key)) && key._value;
7410     if (value == null) return this.tween(key, null);
7411     if (typeof value !== "function") throw new Error();
7412     return this.tween(key, textTween(value));
7413   }
7414   var init_textTween = __esm({
7415     "node_modules/d3-transition/src/transition/textTween.js"() {
7416     }
7417   });
7418
7419   // node_modules/d3-transition/src/transition/transition.js
7420   function transition_default() {
7421     var name = this._name, id0 = this._id, id1 = newId();
7422     for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
7423       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7424         if (node = group[i3]) {
7425           var inherit2 = get2(node, id0);
7426           schedule_default(node, name, id1, i3, group, {
7427             time: inherit2.time + inherit2.delay + inherit2.duration,
7428             delay: 0,
7429             duration: inherit2.duration,
7430             ease: inherit2.ease
7431           });
7432         }
7433       }
7434     }
7435     return new Transition(groups, this._parents, name, id1);
7436   }
7437   var init_transition = __esm({
7438     "node_modules/d3-transition/src/transition/transition.js"() {
7439       init_transition2();
7440       init_schedule();
7441     }
7442   });
7443
7444   // node_modules/d3-transition/src/transition/end.js
7445   function end_default() {
7446     var on0, on1, that = this, id2 = that._id, size = that.size();
7447     return new Promise(function(resolve, reject) {
7448       var cancel = { value: reject }, end = { value: function() {
7449         if (--size === 0) resolve();
7450       } };
7451       that.each(function() {
7452         var schedule = set2(this, id2), on = schedule.on;
7453         if (on !== on0) {
7454           on1 = (on0 = on).copy();
7455           on1._.cancel.push(cancel);
7456           on1._.interrupt.push(cancel);
7457           on1._.end.push(end);
7458         }
7459         schedule.on = on1;
7460       });
7461       if (size === 0) resolve();
7462     });
7463   }
7464   var init_end = __esm({
7465     "node_modules/d3-transition/src/transition/end.js"() {
7466       init_schedule();
7467     }
7468   });
7469
7470   // node_modules/d3-transition/src/transition/index.js
7471   function Transition(groups, parents, name, id2) {
7472     this._groups = groups;
7473     this._parents = parents;
7474     this._name = name;
7475     this._id = id2;
7476   }
7477   function transition(name) {
7478     return selection_default().transition(name);
7479   }
7480   function newId() {
7481     return ++id;
7482   }
7483   var id, selection_prototype;
7484   var init_transition2 = __esm({
7485     "node_modules/d3-transition/src/transition/index.js"() {
7486       init_src5();
7487       init_attr2();
7488       init_attrTween();
7489       init_delay();
7490       init_duration();
7491       init_ease();
7492       init_easeVarying();
7493       init_filter2();
7494       init_merge3();
7495       init_on2();
7496       init_remove2();
7497       init_select3();
7498       init_selectAll3();
7499       init_selection2();
7500       init_style2();
7501       init_styleTween();
7502       init_text2();
7503       init_textTween();
7504       init_transition();
7505       init_tween();
7506       init_end();
7507       id = 0;
7508       selection_prototype = selection_default.prototype;
7509       Transition.prototype = transition.prototype = {
7510         constructor: Transition,
7511         select: select_default3,
7512         selectAll: selectAll_default3,
7513         selectChild: selection_prototype.selectChild,
7514         selectChildren: selection_prototype.selectChildren,
7515         filter: filter_default2,
7516         merge: merge_default2,
7517         selection: selection_default2,
7518         transition: transition_default,
7519         call: selection_prototype.call,
7520         nodes: selection_prototype.nodes,
7521         node: selection_prototype.node,
7522         size: selection_prototype.size,
7523         empty: selection_prototype.empty,
7524         each: selection_prototype.each,
7525         on: on_default2,
7526         attr: attr_default2,
7527         attrTween: attrTween_default,
7528         style: style_default2,
7529         styleTween: styleTween_default,
7530         text: text_default2,
7531         textTween: textTween_default,
7532         remove: remove_default2,
7533         tween: tween_default,
7534         delay: delay_default,
7535         duration: duration_default,
7536         ease: ease_default,
7537         easeVarying: easeVarying_default,
7538         end: end_default,
7539         [Symbol.iterator]: selection_prototype[Symbol.iterator]
7540       };
7541     }
7542   });
7543
7544   // node_modules/d3-ease/src/linear.js
7545   var linear2;
7546   var init_linear = __esm({
7547     "node_modules/d3-ease/src/linear.js"() {
7548       linear2 = (t2) => +t2;
7549     }
7550   });
7551
7552   // node_modules/d3-ease/src/cubic.js
7553   function cubicInOut(t2) {
7554     return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
7555   }
7556   var init_cubic = __esm({
7557     "node_modules/d3-ease/src/cubic.js"() {
7558     }
7559   });
7560
7561   // node_modules/d3-ease/src/index.js
7562   var init_src10 = __esm({
7563     "node_modules/d3-ease/src/index.js"() {
7564       init_linear();
7565       init_cubic();
7566     }
7567   });
7568
7569   // node_modules/d3-transition/src/selection/transition.js
7570   function inherit(node, id2) {
7571     var timing;
7572     while (!(timing = node.__transition) || !(timing = timing[id2])) {
7573       if (!(node = node.parentNode)) {
7574         throw new Error(`transition ${id2} not found`);
7575       }
7576     }
7577     return timing;
7578   }
7579   function transition_default2(name) {
7580     var id2, timing;
7581     if (name instanceof Transition) {
7582       id2 = name._id, name = name._name;
7583     } else {
7584       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
7585     }
7586     for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
7587       for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
7588         if (node = group[i3]) {
7589           schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
7590         }
7591       }
7592     }
7593     return new Transition(groups, this._parents, name, id2);
7594   }
7595   var defaultTiming;
7596   var init_transition3 = __esm({
7597     "node_modules/d3-transition/src/selection/transition.js"() {
7598       init_transition2();
7599       init_schedule();
7600       init_src10();
7601       init_src9();
7602       defaultTiming = {
7603         time: null,
7604         // Set on use.
7605         delay: 0,
7606         duration: 250,
7607         ease: cubicInOut
7608       };
7609     }
7610   });
7611
7612   // node_modules/d3-transition/src/selection/index.js
7613   var init_selection3 = __esm({
7614     "node_modules/d3-transition/src/selection/index.js"() {
7615       init_src5();
7616       init_interrupt2();
7617       init_transition3();
7618       selection_default.prototype.interrupt = interrupt_default2;
7619       selection_default.prototype.transition = transition_default2;
7620     }
7621   });
7622
7623   // node_modules/d3-transition/src/index.js
7624   var init_src11 = __esm({
7625     "node_modules/d3-transition/src/index.js"() {
7626       init_selection3();
7627       init_interrupt();
7628     }
7629   });
7630
7631   // node_modules/d3-zoom/src/constant.js
7632   var constant_default4;
7633   var init_constant4 = __esm({
7634     "node_modules/d3-zoom/src/constant.js"() {
7635       constant_default4 = (x2) => () => x2;
7636     }
7637   });
7638
7639   // node_modules/d3-zoom/src/event.js
7640   function ZoomEvent(type2, {
7641     sourceEvent,
7642     target,
7643     transform: transform2,
7644     dispatch: dispatch14
7645   }) {
7646     Object.defineProperties(this, {
7647       type: { value: type2, enumerable: true, configurable: true },
7648       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
7649       target: { value: target, enumerable: true, configurable: true },
7650       transform: { value: transform2, enumerable: true, configurable: true },
7651       _: { value: dispatch14 }
7652     });
7653   }
7654   var init_event2 = __esm({
7655     "node_modules/d3-zoom/src/event.js"() {
7656     }
7657   });
7658
7659   // node_modules/d3-zoom/src/transform.js
7660   function Transform(k2, x2, y2) {
7661     this.k = k2;
7662     this.x = x2;
7663     this.y = y2;
7664   }
7665   function transform(node) {
7666     while (!node.__zoom) if (!(node = node.parentNode)) return identity2;
7667     return node.__zoom;
7668   }
7669   var identity2;
7670   var init_transform3 = __esm({
7671     "node_modules/d3-zoom/src/transform.js"() {
7672       Transform.prototype = {
7673         constructor: Transform,
7674         scale: function(k2) {
7675           return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
7676         },
7677         translate: function(x2, y2) {
7678           return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
7679         },
7680         apply: function(point) {
7681           return [point[0] * this.k + this.x, point[1] * this.k + this.y];
7682         },
7683         applyX: function(x2) {
7684           return x2 * this.k + this.x;
7685         },
7686         applyY: function(y2) {
7687           return y2 * this.k + this.y;
7688         },
7689         invert: function(location) {
7690           return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
7691         },
7692         invertX: function(x2) {
7693           return (x2 - this.x) / this.k;
7694         },
7695         invertY: function(y2) {
7696           return (y2 - this.y) / this.k;
7697         },
7698         rescaleX: function(x2) {
7699           return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
7700         },
7701         rescaleY: function(y2) {
7702           return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
7703         },
7704         toString: function() {
7705           return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
7706         }
7707       };
7708       identity2 = new Transform(1, 0, 0);
7709       transform.prototype = Transform.prototype;
7710     }
7711   });
7712
7713   // node_modules/d3-zoom/src/noevent.js
7714   function nopropagation2(event) {
7715     event.stopImmediatePropagation();
7716   }
7717   function noevent_default2(event) {
7718     event.preventDefault();
7719     event.stopImmediatePropagation();
7720   }
7721   var init_noevent2 = __esm({
7722     "node_modules/d3-zoom/src/noevent.js"() {
7723     }
7724   });
7725
7726   // node_modules/d3-zoom/src/zoom.js
7727   function defaultFilter2(event) {
7728     return (!event.ctrlKey || event.type === "wheel") && !event.button;
7729   }
7730   function defaultExtent() {
7731     var e3 = this;
7732     if (e3 instanceof SVGElement) {
7733       e3 = e3.ownerSVGElement || e3;
7734       if (e3.hasAttribute("viewBox")) {
7735         e3 = e3.viewBox.baseVal;
7736         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
7737       }
7738       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
7739     }
7740     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
7741   }
7742   function defaultTransform() {
7743     return this.__zoom || identity2;
7744   }
7745   function defaultWheelDelta(event) {
7746     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
7747   }
7748   function defaultTouchable2() {
7749     return navigator.maxTouchPoints || "ontouchstart" in this;
7750   }
7751   function defaultConstrain(transform2, extent, translateExtent) {
7752     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];
7753     return transform2.translate(
7754       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
7755       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
7756     );
7757   }
7758   function zoom_default2() {
7759     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;
7760     function zoom(selection2) {
7761       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)");
7762     }
7763     zoom.transform = function(collection, transform2, point, event) {
7764       var selection2 = collection.selection ? collection.selection() : collection;
7765       selection2.property("__zoom", defaultTransform);
7766       if (collection !== selection2) {
7767         schedule(collection, transform2, point, event);
7768       } else {
7769         selection2.interrupt().each(function() {
7770           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
7771         });
7772       }
7773     };
7774     zoom.scaleBy = function(selection2, k2, p2, event) {
7775       zoom.scaleTo(selection2, function() {
7776         var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
7777         return k0 * k1;
7778       }, p2, event);
7779     };
7780     zoom.scaleTo = function(selection2, k2, p2, event) {
7781       zoom.transform(selection2, function() {
7782         var e3 = extent.apply(this, arguments), t02 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t02.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
7783         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
7784       }, p2, event);
7785     };
7786     zoom.translateBy = function(selection2, x2, y2, event) {
7787       zoom.transform(selection2, function() {
7788         return constrain(this.__zoom.translate(
7789           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
7790           typeof y2 === "function" ? y2.apply(this, arguments) : y2
7791         ), extent.apply(this, arguments), translateExtent);
7792       }, null, event);
7793     };
7794     zoom.translateTo = function(selection2, x2, y2, p2, event) {
7795       zoom.transform(selection2, function() {
7796         var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
7797         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
7798           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
7799           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
7800         ), e3, translateExtent);
7801       }, p2, event);
7802     };
7803     function scale(transform2, k2) {
7804       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
7805       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
7806     }
7807     function translate(transform2, p02, p1) {
7808       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
7809       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
7810     }
7811     function centroid(extent2) {
7812       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
7813     }
7814     function schedule(transition2, transform2, point, event) {
7815       transition2.on("start.zoom", function() {
7816         gesture(this, arguments).event(event).start();
7817       }).on("interrupt.zoom end.zoom", function() {
7818         gesture(this, arguments).event(event).end();
7819       }).tween("zoom", function() {
7820         var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point == null ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
7821         return function(t2) {
7822           if (t2 === 1) t2 = b2;
7823           else {
7824             var l2 = i3(t2), k2 = w2 / l2[2];
7825             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
7826           }
7827           g3.zoom(null, t2);
7828         };
7829       });
7830     }
7831     function gesture(that, args, clean2) {
7832       return !clean2 && that.__zooming || new Gesture(that, args);
7833     }
7834     function Gesture(that, args) {
7835       this.that = that;
7836       this.args = args;
7837       this.active = 0;
7838       this.sourceEvent = null;
7839       this.extent = extent.apply(that, args);
7840       this.taps = 0;
7841     }
7842     Gesture.prototype = {
7843       event: function(event) {
7844         if (event) this.sourceEvent = event;
7845         return this;
7846       },
7847       start: function() {
7848         if (++this.active === 1) {
7849           this.that.__zooming = this;
7850           this.emit("start");
7851         }
7852         return this;
7853       },
7854       zoom: function(key, transform2) {
7855         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
7856         if (this.touch0 && key !== "touch") this.touch0[1] = transform2.invert(this.touch0[0]);
7857         if (this.touch1 && key !== "touch") this.touch1[1] = transform2.invert(this.touch1[0]);
7858         this.that.__zoom = transform2;
7859         this.emit("zoom");
7860         return this;
7861       },
7862       end: function() {
7863         if (--this.active === 0) {
7864           delete this.that.__zooming;
7865           this.emit("end");
7866         }
7867         return this;
7868       },
7869       emit: function(type2) {
7870         var d2 = select_default2(this.that).datum();
7871         listeners.call(
7872           type2,
7873           this.that,
7874           new ZoomEvent(type2, {
7875             sourceEvent: this.sourceEvent,
7876             target: zoom,
7877             type: type2,
7878             transform: this.that.__zoom,
7879             dispatch: listeners
7880           }),
7881           d2
7882         );
7883       }
7884     };
7885     function wheeled(event, ...args) {
7886       if (!filter2.apply(this, arguments)) return;
7887       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);
7888       if (g3.wheel) {
7889         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
7890           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
7891         }
7892         clearTimeout(g3.wheel);
7893       } else if (t2.k === k2) return;
7894       else {
7895         g3.mouse = [p2, t2.invert(p2)];
7896         interrupt_default(this);
7897         g3.start();
7898       }
7899       noevent_default2(event);
7900       g3.wheel = setTimeout(wheelidled, wheelDelay);
7901       g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
7902       function wheelidled() {
7903         g3.wheel = null;
7904         g3.end();
7905       }
7906     }
7907     function mousedowned(event, ...args) {
7908       if (touchending || !filter2.apply(this, arguments)) return;
7909       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;
7910       nodrag_default(event.view);
7911       nopropagation2(event);
7912       g3.mouse = [p2, this.__zoom.invert(p2)];
7913       interrupt_default(this);
7914       g3.start();
7915       function mousemoved(event2) {
7916         noevent_default2(event2);
7917         if (!g3.moved) {
7918           var dx = event2.clientX - x05, dy = event2.clientY - y05;
7919           g3.moved = dx * dx + dy * dy > clickDistance2;
7920         }
7921         g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
7922       }
7923       function mouseupped(event2) {
7924         v2.on("mousemove.zoom mouseup.zoom", null);
7925         yesdrag(event2.view, g3.moved);
7926         noevent_default2(event2);
7927         g3.event(event2).end();
7928       }
7929     }
7930     function dblclicked(event, ...args) {
7931       if (!filter2.apply(this, arguments)) return;
7932       var t02 = this.__zoom, p02 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t02.invert(p02), k1 = t02.k * (event.shiftKey ? 0.5 : 2), t12 = constrain(translate(scale(t02, k1), p02, p1), extent.apply(this, args), translateExtent);
7933       noevent_default2(event);
7934       if (duration > 0) select_default2(this).transition().duration(duration).call(schedule, t12, p02, event);
7935       else select_default2(this).call(zoom.transform, t12, p02, event);
7936     }
7937     function touchstarted(event, ...args) {
7938       if (!filter2.apply(this, arguments)) return;
7939       var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
7940       nopropagation2(event);
7941       for (i3 = 0; i3 < n3; ++i3) {
7942         t2 = touches[i3], p2 = pointer_default(t2, this);
7943         p2 = [p2, this.__zoom.invert(p2), t2.identifier];
7944         if (!g3.touch0) g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
7945         else if (!g3.touch1 && g3.touch0[2] !== p2[2]) g3.touch1 = p2, g3.taps = 0;
7946       }
7947       if (touchstarting) touchstarting = clearTimeout(touchstarting);
7948       if (started) {
7949         if (g3.taps < 2) touchfirst = p2[0], touchstarting = setTimeout(function() {
7950           touchstarting = null;
7951         }, touchDelay);
7952         interrupt_default(this);
7953         g3.start();
7954       }
7955     }
7956     function touchmoved(event, ...args) {
7957       if (!this.__zooming) return;
7958       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
7959       noevent_default2(event);
7960       for (i3 = 0; i3 < n3; ++i3) {
7961         t2 = touches[i3], p2 = pointer_default(t2, this);
7962         if (g3.touch0 && g3.touch0[2] === t2.identifier) g3.touch0[0] = p2;
7963         else if (g3.touch1 && g3.touch1[2] === t2.identifier) g3.touch1[0] = p2;
7964       }
7965       t2 = g3.that.__zoom;
7966       if (g3.touch1) {
7967         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;
7968         t2 = scale(t2, Math.sqrt(dp / dl));
7969         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
7970         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
7971       } else if (g3.touch0) p2 = g3.touch0[0], l2 = g3.touch0[1];
7972       else return;
7973       g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
7974     }
7975     function touchended(event, ...args) {
7976       if (!this.__zooming) return;
7977       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
7978       nopropagation2(event);
7979       if (touchending) clearTimeout(touchending);
7980       touchending = setTimeout(function() {
7981         touchending = null;
7982       }, touchDelay);
7983       for (i3 = 0; i3 < n3; ++i3) {
7984         t2 = touches[i3];
7985         if (g3.touch0 && g3.touch0[2] === t2.identifier) delete g3.touch0;
7986         else if (g3.touch1 && g3.touch1[2] === t2.identifier) delete g3.touch1;
7987       }
7988       if (g3.touch1 && !g3.touch0) g3.touch0 = g3.touch1, delete g3.touch1;
7989       if (g3.touch0) g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
7990       else {
7991         g3.end();
7992         if (g3.taps === 2) {
7993           t2 = pointer_default(t2, this);
7994           if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
7995             var p2 = select_default2(this).on("dblclick.zoom");
7996             if (p2) p2.apply(this, arguments);
7997           }
7998         }
7999       }
8000     }
8001     zoom.wheelDelta = function(_2) {
8002       return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
8003     };
8004     zoom.filter = function(_2) {
8005       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
8006     };
8007     zoom.touchable = function(_2) {
8008       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
8009     };
8010     zoom.extent = function(_2) {
8011       return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
8012     };
8013     zoom.scaleExtent = function(_2) {
8014       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
8015     };
8016     zoom.translateExtent = function(_2) {
8017       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]]];
8018     };
8019     zoom.constrain = function(_2) {
8020       return arguments.length ? (constrain = _2, zoom) : constrain;
8021     };
8022     zoom.duration = function(_2) {
8023       return arguments.length ? (duration = +_2, zoom) : duration;
8024     };
8025     zoom.interpolate = function(_2) {
8026       return arguments.length ? (interpolate = _2, zoom) : interpolate;
8027     };
8028     zoom.on = function() {
8029       var value = listeners.on.apply(listeners, arguments);
8030       return value === listeners ? zoom : value;
8031     };
8032     zoom.clickDistance = function(_2) {
8033       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
8034     };
8035     zoom.tapDistance = function(_2) {
8036       return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
8037     };
8038     return zoom;
8039   }
8040   var init_zoom2 = __esm({
8041     "node_modules/d3-zoom/src/zoom.js"() {
8042       init_src4();
8043       init_src6();
8044       init_src8();
8045       init_src5();
8046       init_src11();
8047       init_constant4();
8048       init_event2();
8049       init_transform3();
8050       init_noevent2();
8051     }
8052   });
8053
8054   // node_modules/d3-zoom/src/index.js
8055   var init_src12 = __esm({
8056     "node_modules/d3-zoom/src/index.js"() {
8057       init_zoom2();
8058       init_transform3();
8059     }
8060   });
8061
8062   // modules/geo/raw_mercator.js
8063   var raw_mercator_exports = {};
8064   __export(raw_mercator_exports, {
8065     geoRawMercator: () => geoRawMercator
8066   });
8067   function geoRawMercator() {
8068     const project = mercatorRaw;
8069     let k2 = 512 / Math.PI;
8070     let x2 = 0;
8071     let y2 = 0;
8072     let clipExtent = [[0, 0], [0, 0]];
8073     function projection2(point) {
8074       point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
8075       return [point[0] * k2 + x2, y2 - point[1] * k2];
8076     }
8077     projection2.invert = function(point) {
8078       point = project.invert((point[0] - x2) / k2, (y2 - point[1]) / k2);
8079       return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
8080     };
8081     projection2.scale = function(_2) {
8082       if (!arguments.length) return k2;
8083       k2 = +_2;
8084       return projection2;
8085     };
8086     projection2.translate = function(_2) {
8087       if (!arguments.length) return [x2, y2];
8088       x2 = +_2[0];
8089       y2 = +_2[1];
8090       return projection2;
8091     };
8092     projection2.clipExtent = function(_2) {
8093       if (!arguments.length) return clipExtent;
8094       clipExtent = _2;
8095       return projection2;
8096     };
8097     projection2.transform = function(obj) {
8098       if (!arguments.length) return identity2.translate(x2, y2).scale(k2);
8099       x2 = +obj.x;
8100       y2 = +obj.y;
8101       k2 = +obj.k;
8102       return projection2;
8103     };
8104     projection2.stream = transform_default({
8105       point: function(x3, y3) {
8106         const vec = projection2([x3, y3]);
8107         this.stream.point(vec[0], vec[1]);
8108       }
8109     }).stream;
8110     return projection2;
8111   }
8112   var init_raw_mercator = __esm({
8113     "modules/geo/raw_mercator.js"() {
8114       "use strict";
8115       init_src2();
8116       init_src12();
8117     }
8118   });
8119
8120   // modules/geo/ortho.js
8121   var ortho_exports = {};
8122   __export(ortho_exports, {
8123     geoOrthoCalcScore: () => geoOrthoCalcScore,
8124     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
8125     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
8126     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct
8127   });
8128   function geoOrthoNormalizedDotProduct(a2, b2, origin) {
8129     if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
8130       return 1;
8131     }
8132     return geoVecNormalizedDot(a2, b2, origin);
8133   }
8134   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
8135     var val = Math.abs(dotp);
8136     if (val < epsilon3) {
8137       return 0;
8138     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
8139       return 0;
8140     } else if (val < lowerThreshold || val > upperThreshold) {
8141       return dotp;
8142     } else {
8143       return null;
8144     }
8145   }
8146   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
8147     var score = 0;
8148     var first = isClosed ? 0 : 1;
8149     var last = isClosed ? points.length : points.length - 1;
8150     var coords = points.map(function(p2) {
8151       return p2.coord;
8152     });
8153     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
8154     var upperThreshold = Math.cos(threshold * Math.PI / 180);
8155     for (var i3 = first; i3 < last; i3++) {
8156       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8157       var origin = coords[i3];
8158       var b2 = coords[(i3 + 1) % coords.length];
8159       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
8160       if (dotp === null) continue;
8161       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
8162     }
8163     return score;
8164   }
8165   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
8166     var max3 = -Infinity;
8167     var first = isClosed ? 0 : 1;
8168     var last = isClosed ? coords.length : coords.length - 1;
8169     for (var i3 = first; i3 < last; i3++) {
8170       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8171       var origin = coords[i3];
8172       var b2 = coords[(i3 + 1) % coords.length];
8173       var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
8174       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
8175       if (angle2 > 45) angle2 = 90 - angle2;
8176       if (angle2 >= lessThan) continue;
8177       if (angle2 > max3) max3 = angle2;
8178     }
8179     if (max3 === -Infinity) return null;
8180     return max3;
8181   }
8182   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
8183     var score = null;
8184     var first = isClosed ? 0 : 1;
8185     var last = isClosed ? coords.length : coords.length - 1;
8186     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
8187     var upperThreshold = Math.cos(threshold * Math.PI / 180);
8188     for (var i3 = first; i3 < last; i3++) {
8189       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
8190       var origin = coords[i3];
8191       var b2 = coords[(i3 + 1) % coords.length];
8192       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
8193       if (dotp === null) continue;
8194       if (Math.abs(dotp) > 0) return 1;
8195       score = 0;
8196     }
8197     return score;
8198   }
8199   var init_ortho = __esm({
8200     "modules/geo/ortho.js"() {
8201       "use strict";
8202       init_vector();
8203     }
8204   });
8205
8206   // modules/geo/index.js
8207   var geo_exports2 = {};
8208   __export(geo_exports2, {
8209     geoAngle: () => geoAngle,
8210     geoChooseEdge: () => geoChooseEdge,
8211     geoEdgeEqual: () => geoEdgeEqual,
8212     geoExtent: () => geoExtent,
8213     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
8214     geoHasLineIntersections: () => geoHasLineIntersections,
8215     geoHasSelfIntersections: () => geoHasSelfIntersections,
8216     geoLatToMeters: () => geoLatToMeters,
8217     geoLineIntersection: () => geoLineIntersection,
8218     geoLonToMeters: () => geoLonToMeters,
8219     geoMetersToLat: () => geoMetersToLat,
8220     geoMetersToLon: () => geoMetersToLon,
8221     geoMetersToOffset: () => geoMetersToOffset,
8222     geoOffsetToMeters: () => geoOffsetToMeters,
8223     geoOrthoCalcScore: () => geoOrthoCalcScore,
8224     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
8225     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
8226     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
8227     geoPathHasIntersections: () => geoPathHasIntersections,
8228     geoPathIntersections: () => geoPathIntersections,
8229     geoPathLength: () => geoPathLength,
8230     geoPointInPolygon: () => geoPointInPolygon,
8231     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
8232     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
8233     geoRawMercator: () => geoRawMercator,
8234     geoRotate: () => geoRotate,
8235     geoScaleToZoom: () => geoScaleToZoom,
8236     geoSphericalClosestNode: () => geoSphericalClosestNode,
8237     geoSphericalDistance: () => geoSphericalDistance,
8238     geoVecAdd: () => geoVecAdd,
8239     geoVecAngle: () => geoVecAngle,
8240     geoVecCross: () => geoVecCross,
8241     geoVecDot: () => geoVecDot,
8242     geoVecEqual: () => geoVecEqual,
8243     geoVecFloor: () => geoVecFloor,
8244     geoVecInterp: () => geoVecInterp,
8245     geoVecLength: () => geoVecLength,
8246     geoVecLengthSquare: () => geoVecLengthSquare,
8247     geoVecNormalize: () => geoVecNormalize,
8248     geoVecNormalizedDot: () => geoVecNormalizedDot,
8249     geoVecProject: () => geoVecProject,
8250     geoVecScale: () => geoVecScale,
8251     geoVecSubtract: () => geoVecSubtract,
8252     geoViewportEdge: () => geoViewportEdge,
8253     geoZoomToScale: () => geoZoomToScale
8254   });
8255   var init_geo2 = __esm({
8256     "modules/geo/index.js"() {
8257       "use strict";
8258       init_extent();
8259       init_geo();
8260       init_geo();
8261       init_geo();
8262       init_geo();
8263       init_geo();
8264       init_geo();
8265       init_geo();
8266       init_geo();
8267       init_geo();
8268       init_geo();
8269       init_geom();
8270       init_geom();
8271       init_geom();
8272       init_geom();
8273       init_geom();
8274       init_geom();
8275       init_geom();
8276       init_geom();
8277       init_geom();
8278       init_geom();
8279       init_geom();
8280       init_geom();
8281       init_geom();
8282       init_geom();
8283       init_geom();
8284       init_raw_mercator();
8285       init_vector();
8286       init_vector();
8287       init_vector();
8288       init_vector();
8289       init_vector();
8290       init_vector();
8291       init_vector();
8292       init_vector();
8293       init_vector();
8294       init_vector();
8295       init_vector();
8296       init_vector();
8297       init_vector();
8298       init_vector();
8299       init_ortho();
8300       init_ortho();
8301       init_ortho();
8302       init_ortho();
8303     }
8304   });
8305
8306   // node_modules/lodash-es/_freeGlobal.js
8307   var freeGlobal, freeGlobal_default;
8308   var init_freeGlobal = __esm({
8309     "node_modules/lodash-es/_freeGlobal.js"() {
8310       freeGlobal = typeof global == "object" && global && global.Object === Object && global;
8311       freeGlobal_default = freeGlobal;
8312     }
8313   });
8314
8315   // node_modules/lodash-es/_root.js
8316   var freeSelf, root2, root_default;
8317   var init_root = __esm({
8318     "node_modules/lodash-es/_root.js"() {
8319       init_freeGlobal();
8320       freeSelf = typeof self == "object" && self && self.Object === Object && self;
8321       root2 = freeGlobal_default || freeSelf || Function("return this")();
8322       root_default = root2;
8323     }
8324   });
8325
8326   // node_modules/lodash-es/_Symbol.js
8327   var Symbol2, Symbol_default;
8328   var init_Symbol = __esm({
8329     "node_modules/lodash-es/_Symbol.js"() {
8330       init_root();
8331       Symbol2 = root_default.Symbol;
8332       Symbol_default = Symbol2;
8333     }
8334   });
8335
8336   // node_modules/lodash-es/_getRawTag.js
8337   function getRawTag(value) {
8338     var isOwn = hasOwnProperty.call(value, symToStringTag), tag2 = value[symToStringTag];
8339     try {
8340       value[symToStringTag] = void 0;
8341       var unmasked = true;
8342     } catch (e3) {
8343     }
8344     var result = nativeObjectToString.call(value);
8345     if (unmasked) {
8346       if (isOwn) {
8347         value[symToStringTag] = tag2;
8348       } else {
8349         delete value[symToStringTag];
8350       }
8351     }
8352     return result;
8353   }
8354   var objectProto, hasOwnProperty, nativeObjectToString, symToStringTag, getRawTag_default;
8355   var init_getRawTag = __esm({
8356     "node_modules/lodash-es/_getRawTag.js"() {
8357       init_Symbol();
8358       objectProto = Object.prototype;
8359       hasOwnProperty = objectProto.hasOwnProperty;
8360       nativeObjectToString = objectProto.toString;
8361       symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
8362       getRawTag_default = getRawTag;
8363     }
8364   });
8365
8366   // node_modules/lodash-es/_objectToString.js
8367   function objectToString(value) {
8368     return nativeObjectToString2.call(value);
8369   }
8370   var objectProto2, nativeObjectToString2, objectToString_default;
8371   var init_objectToString = __esm({
8372     "node_modules/lodash-es/_objectToString.js"() {
8373       objectProto2 = Object.prototype;
8374       nativeObjectToString2 = objectProto2.toString;
8375       objectToString_default = objectToString;
8376     }
8377   });
8378
8379   // node_modules/lodash-es/_baseGetTag.js
8380   function baseGetTag(value) {
8381     if (value == null) {
8382       return value === void 0 ? undefinedTag : nullTag;
8383     }
8384     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
8385   }
8386   var nullTag, undefinedTag, symToStringTag2, baseGetTag_default;
8387   var init_baseGetTag = __esm({
8388     "node_modules/lodash-es/_baseGetTag.js"() {
8389       init_Symbol();
8390       init_getRawTag();
8391       init_objectToString();
8392       nullTag = "[object Null]";
8393       undefinedTag = "[object Undefined]";
8394       symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
8395       baseGetTag_default = baseGetTag;
8396     }
8397   });
8398
8399   // node_modules/lodash-es/isObjectLike.js
8400   function isObjectLike(value) {
8401     return value != null && typeof value == "object";
8402   }
8403   var isObjectLike_default;
8404   var init_isObjectLike = __esm({
8405     "node_modules/lodash-es/isObjectLike.js"() {
8406       isObjectLike_default = isObjectLike;
8407     }
8408   });
8409
8410   // node_modules/lodash-es/isSymbol.js
8411   function isSymbol(value) {
8412     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
8413   }
8414   var symbolTag, isSymbol_default;
8415   var init_isSymbol = __esm({
8416     "node_modules/lodash-es/isSymbol.js"() {
8417       init_baseGetTag();
8418       init_isObjectLike();
8419       symbolTag = "[object Symbol]";
8420       isSymbol_default = isSymbol;
8421     }
8422   });
8423
8424   // node_modules/lodash-es/_arrayMap.js
8425   function arrayMap(array2, iteratee) {
8426     var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
8427     while (++index < length2) {
8428       result[index] = iteratee(array2[index], index, array2);
8429     }
8430     return result;
8431   }
8432   var arrayMap_default;
8433   var init_arrayMap = __esm({
8434     "node_modules/lodash-es/_arrayMap.js"() {
8435       arrayMap_default = arrayMap;
8436     }
8437   });
8438
8439   // node_modules/lodash-es/isArray.js
8440   var isArray, isArray_default;
8441   var init_isArray = __esm({
8442     "node_modules/lodash-es/isArray.js"() {
8443       isArray = Array.isArray;
8444       isArray_default = isArray;
8445     }
8446   });
8447
8448   // node_modules/lodash-es/_baseToString.js
8449   function baseToString(value) {
8450     if (typeof value == "string") {
8451       return value;
8452     }
8453     if (isArray_default(value)) {
8454       return arrayMap_default(value, baseToString) + "";
8455     }
8456     if (isSymbol_default(value)) {
8457       return symbolToString ? symbolToString.call(value) : "";
8458     }
8459     var result = value + "";
8460     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
8461   }
8462   var INFINITY, symbolProto, symbolToString, baseToString_default;
8463   var init_baseToString = __esm({
8464     "node_modules/lodash-es/_baseToString.js"() {
8465       init_Symbol();
8466       init_arrayMap();
8467       init_isArray();
8468       init_isSymbol();
8469       INFINITY = 1 / 0;
8470       symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
8471       symbolToString = symbolProto ? symbolProto.toString : void 0;
8472       baseToString_default = baseToString;
8473     }
8474   });
8475
8476   // node_modules/lodash-es/_trimmedEndIndex.js
8477   function trimmedEndIndex(string) {
8478     var index = string.length;
8479     while (index-- && reWhitespace.test(string.charAt(index))) {
8480     }
8481     return index;
8482   }
8483   var reWhitespace, trimmedEndIndex_default;
8484   var init_trimmedEndIndex = __esm({
8485     "node_modules/lodash-es/_trimmedEndIndex.js"() {
8486       reWhitespace = /\s/;
8487       trimmedEndIndex_default = trimmedEndIndex;
8488     }
8489   });
8490
8491   // node_modules/lodash-es/_baseTrim.js
8492   function baseTrim(string) {
8493     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
8494   }
8495   var reTrimStart, baseTrim_default;
8496   var init_baseTrim = __esm({
8497     "node_modules/lodash-es/_baseTrim.js"() {
8498       init_trimmedEndIndex();
8499       reTrimStart = /^\s+/;
8500       baseTrim_default = baseTrim;
8501     }
8502   });
8503
8504   // node_modules/lodash-es/isObject.js
8505   function isObject(value) {
8506     var type2 = typeof value;
8507     return value != null && (type2 == "object" || type2 == "function");
8508   }
8509   var isObject_default;
8510   var init_isObject = __esm({
8511     "node_modules/lodash-es/isObject.js"() {
8512       isObject_default = isObject;
8513     }
8514   });
8515
8516   // node_modules/lodash-es/toNumber.js
8517   function toNumber(value) {
8518     if (typeof value == "number") {
8519       return value;
8520     }
8521     if (isSymbol_default(value)) {
8522       return NAN;
8523     }
8524     if (isObject_default(value)) {
8525       var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
8526       value = isObject_default(other2) ? other2 + "" : other2;
8527     }
8528     if (typeof value != "string") {
8529       return value === 0 ? value : +value;
8530     }
8531     value = baseTrim_default(value);
8532     var isBinary = reIsBinary.test(value);
8533     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
8534   }
8535   var NAN, reIsBadHex, reIsBinary, reIsOctal, freeParseInt, toNumber_default;
8536   var init_toNumber = __esm({
8537     "node_modules/lodash-es/toNumber.js"() {
8538       init_baseTrim();
8539       init_isObject();
8540       init_isSymbol();
8541       NAN = 0 / 0;
8542       reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
8543       reIsBinary = /^0b[01]+$/i;
8544       reIsOctal = /^0o[0-7]+$/i;
8545       freeParseInt = parseInt;
8546       toNumber_default = toNumber;
8547     }
8548   });
8549
8550   // node_modules/lodash-es/identity.js
8551   function identity3(value) {
8552     return value;
8553   }
8554   var identity_default3;
8555   var init_identity3 = __esm({
8556     "node_modules/lodash-es/identity.js"() {
8557       identity_default3 = identity3;
8558     }
8559   });
8560
8561   // node_modules/lodash-es/isFunction.js
8562   function isFunction(value) {
8563     if (!isObject_default(value)) {
8564       return false;
8565     }
8566     var tag2 = baseGetTag_default(value);
8567     return tag2 == funcTag || tag2 == genTag || tag2 == asyncTag || tag2 == proxyTag;
8568   }
8569   var asyncTag, funcTag, genTag, proxyTag, isFunction_default;
8570   var init_isFunction = __esm({
8571     "node_modules/lodash-es/isFunction.js"() {
8572       init_baseGetTag();
8573       init_isObject();
8574       asyncTag = "[object AsyncFunction]";
8575       funcTag = "[object Function]";
8576       genTag = "[object GeneratorFunction]";
8577       proxyTag = "[object Proxy]";
8578       isFunction_default = isFunction;
8579     }
8580   });
8581
8582   // node_modules/lodash-es/_coreJsData.js
8583   var coreJsData, coreJsData_default;
8584   var init_coreJsData = __esm({
8585     "node_modules/lodash-es/_coreJsData.js"() {
8586       init_root();
8587       coreJsData = root_default["__core-js_shared__"];
8588       coreJsData_default = coreJsData;
8589     }
8590   });
8591
8592   // node_modules/lodash-es/_isMasked.js
8593   function isMasked(func) {
8594     return !!maskSrcKey && maskSrcKey in func;
8595   }
8596   var maskSrcKey, isMasked_default;
8597   var init_isMasked = __esm({
8598     "node_modules/lodash-es/_isMasked.js"() {
8599       init_coreJsData();
8600       maskSrcKey = function() {
8601         var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
8602         return uid ? "Symbol(src)_1." + uid : "";
8603       }();
8604       isMasked_default = isMasked;
8605     }
8606   });
8607
8608   // node_modules/lodash-es/_toSource.js
8609   function toSource(func) {
8610     if (func != null) {
8611       try {
8612         return funcToString.call(func);
8613       } catch (e3) {
8614       }
8615       try {
8616         return func + "";
8617       } catch (e3) {
8618       }
8619     }
8620     return "";
8621   }
8622   var funcProto, funcToString, toSource_default;
8623   var init_toSource = __esm({
8624     "node_modules/lodash-es/_toSource.js"() {
8625       funcProto = Function.prototype;
8626       funcToString = funcProto.toString;
8627       toSource_default = toSource;
8628     }
8629   });
8630
8631   // node_modules/lodash-es/_baseIsNative.js
8632   function baseIsNative(value) {
8633     if (!isObject_default(value) || isMasked_default(value)) {
8634       return false;
8635     }
8636     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
8637     return pattern.test(toSource_default(value));
8638   }
8639   var reRegExpChar, reIsHostCtor, funcProto2, objectProto3, funcToString2, hasOwnProperty2, reIsNative, baseIsNative_default;
8640   var init_baseIsNative = __esm({
8641     "node_modules/lodash-es/_baseIsNative.js"() {
8642       init_isFunction();
8643       init_isMasked();
8644       init_isObject();
8645       init_toSource();
8646       reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
8647       reIsHostCtor = /^\[object .+?Constructor\]$/;
8648       funcProto2 = Function.prototype;
8649       objectProto3 = Object.prototype;
8650       funcToString2 = funcProto2.toString;
8651       hasOwnProperty2 = objectProto3.hasOwnProperty;
8652       reIsNative = RegExp(
8653         "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
8654       );
8655       baseIsNative_default = baseIsNative;
8656     }
8657   });
8658
8659   // node_modules/lodash-es/_getValue.js
8660   function getValue(object, key) {
8661     return object == null ? void 0 : object[key];
8662   }
8663   var getValue_default;
8664   var init_getValue = __esm({
8665     "node_modules/lodash-es/_getValue.js"() {
8666       getValue_default = getValue;
8667     }
8668   });
8669
8670   // node_modules/lodash-es/_getNative.js
8671   function getNative(object, key) {
8672     var value = getValue_default(object, key);
8673     return baseIsNative_default(value) ? value : void 0;
8674   }
8675   var getNative_default;
8676   var init_getNative = __esm({
8677     "node_modules/lodash-es/_getNative.js"() {
8678       init_baseIsNative();
8679       init_getValue();
8680       getNative_default = getNative;
8681     }
8682   });
8683
8684   // node_modules/lodash-es/_WeakMap.js
8685   var WeakMap, WeakMap_default;
8686   var init_WeakMap = __esm({
8687     "node_modules/lodash-es/_WeakMap.js"() {
8688       init_getNative();
8689       init_root();
8690       WeakMap = getNative_default(root_default, "WeakMap");
8691       WeakMap_default = WeakMap;
8692     }
8693   });
8694
8695   // node_modules/lodash-es/_baseCreate.js
8696   var objectCreate, baseCreate, baseCreate_default;
8697   var init_baseCreate = __esm({
8698     "node_modules/lodash-es/_baseCreate.js"() {
8699       init_isObject();
8700       objectCreate = Object.create;
8701       baseCreate = /* @__PURE__ */ function() {
8702         function object() {
8703         }
8704         return function(proto) {
8705           if (!isObject_default(proto)) {
8706             return {};
8707           }
8708           if (objectCreate) {
8709             return objectCreate(proto);
8710           }
8711           object.prototype = proto;
8712           var result = new object();
8713           object.prototype = void 0;
8714           return result;
8715         };
8716       }();
8717       baseCreate_default = baseCreate;
8718     }
8719   });
8720
8721   // node_modules/lodash-es/_apply.js
8722   function apply(func, thisArg, args) {
8723     switch (args.length) {
8724       case 0:
8725         return func.call(thisArg);
8726       case 1:
8727         return func.call(thisArg, args[0]);
8728       case 2:
8729         return func.call(thisArg, args[0], args[1]);
8730       case 3:
8731         return func.call(thisArg, args[0], args[1], args[2]);
8732     }
8733     return func.apply(thisArg, args);
8734   }
8735   var apply_default;
8736   var init_apply = __esm({
8737     "node_modules/lodash-es/_apply.js"() {
8738       apply_default = apply;
8739     }
8740   });
8741
8742   // node_modules/lodash-es/_copyArray.js
8743   function copyArray(source, array2) {
8744     var index = -1, length2 = source.length;
8745     array2 || (array2 = Array(length2));
8746     while (++index < length2) {
8747       array2[index] = source[index];
8748     }
8749     return array2;
8750   }
8751   var copyArray_default;
8752   var init_copyArray = __esm({
8753     "node_modules/lodash-es/_copyArray.js"() {
8754       copyArray_default = copyArray;
8755     }
8756   });
8757
8758   // node_modules/lodash-es/_shortOut.js
8759   function shortOut(func) {
8760     var count = 0, lastCalled = 0;
8761     return function() {
8762       var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
8763       lastCalled = stamp;
8764       if (remaining > 0) {
8765         if (++count >= HOT_COUNT) {
8766           return arguments[0];
8767         }
8768       } else {
8769         count = 0;
8770       }
8771       return func.apply(void 0, arguments);
8772     };
8773   }
8774   var HOT_COUNT, HOT_SPAN, nativeNow, shortOut_default;
8775   var init_shortOut = __esm({
8776     "node_modules/lodash-es/_shortOut.js"() {
8777       HOT_COUNT = 800;
8778       HOT_SPAN = 16;
8779       nativeNow = Date.now;
8780       shortOut_default = shortOut;
8781     }
8782   });
8783
8784   // node_modules/lodash-es/constant.js
8785   function constant(value) {
8786     return function() {
8787       return value;
8788     };
8789   }
8790   var constant_default5;
8791   var init_constant5 = __esm({
8792     "node_modules/lodash-es/constant.js"() {
8793       constant_default5 = constant;
8794     }
8795   });
8796
8797   // node_modules/lodash-es/_defineProperty.js
8798   var defineProperty, defineProperty_default;
8799   var init_defineProperty = __esm({
8800     "node_modules/lodash-es/_defineProperty.js"() {
8801       init_getNative();
8802       defineProperty = function() {
8803         try {
8804           var func = getNative_default(Object, "defineProperty");
8805           func({}, "", {});
8806           return func;
8807         } catch (e3) {
8808         }
8809       }();
8810       defineProperty_default = defineProperty;
8811     }
8812   });
8813
8814   // node_modules/lodash-es/_baseSetToString.js
8815   var baseSetToString, baseSetToString_default;
8816   var init_baseSetToString = __esm({
8817     "node_modules/lodash-es/_baseSetToString.js"() {
8818       init_constant5();
8819       init_defineProperty();
8820       init_identity3();
8821       baseSetToString = !defineProperty_default ? identity_default3 : function(func, string) {
8822         return defineProperty_default(func, "toString", {
8823           "configurable": true,
8824           "enumerable": false,
8825           "value": constant_default5(string),
8826           "writable": true
8827         });
8828       };
8829       baseSetToString_default = baseSetToString;
8830     }
8831   });
8832
8833   // node_modules/lodash-es/_setToString.js
8834   var setToString, setToString_default;
8835   var init_setToString = __esm({
8836     "node_modules/lodash-es/_setToString.js"() {
8837       init_baseSetToString();
8838       init_shortOut();
8839       setToString = shortOut_default(baseSetToString_default);
8840       setToString_default = setToString;
8841     }
8842   });
8843
8844   // node_modules/lodash-es/_isIndex.js
8845   function isIndex(value, length2) {
8846     var type2 = typeof value;
8847     length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
8848     return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
8849   }
8850   var MAX_SAFE_INTEGER, reIsUint, isIndex_default;
8851   var init_isIndex = __esm({
8852     "node_modules/lodash-es/_isIndex.js"() {
8853       MAX_SAFE_INTEGER = 9007199254740991;
8854       reIsUint = /^(?:0|[1-9]\d*)$/;
8855       isIndex_default = isIndex;
8856     }
8857   });
8858
8859   // node_modules/lodash-es/_baseAssignValue.js
8860   function baseAssignValue(object, key, value) {
8861     if (key == "__proto__" && defineProperty_default) {
8862       defineProperty_default(object, key, {
8863         "configurable": true,
8864         "enumerable": true,
8865         "value": value,
8866         "writable": true
8867       });
8868     } else {
8869       object[key] = value;
8870     }
8871   }
8872   var baseAssignValue_default;
8873   var init_baseAssignValue = __esm({
8874     "node_modules/lodash-es/_baseAssignValue.js"() {
8875       init_defineProperty();
8876       baseAssignValue_default = baseAssignValue;
8877     }
8878   });
8879
8880   // node_modules/lodash-es/eq.js
8881   function eq(value, other2) {
8882     return value === other2 || value !== value && other2 !== other2;
8883   }
8884   var eq_default;
8885   var init_eq = __esm({
8886     "node_modules/lodash-es/eq.js"() {
8887       eq_default = eq;
8888     }
8889   });
8890
8891   // node_modules/lodash-es/_assignValue.js
8892   function assignValue(object, key, value) {
8893     var objValue = object[key];
8894     if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) {
8895       baseAssignValue_default(object, key, value);
8896     }
8897   }
8898   var objectProto4, hasOwnProperty3, assignValue_default;
8899   var init_assignValue = __esm({
8900     "node_modules/lodash-es/_assignValue.js"() {
8901       init_baseAssignValue();
8902       init_eq();
8903       objectProto4 = Object.prototype;
8904       hasOwnProperty3 = objectProto4.hasOwnProperty;
8905       assignValue_default = assignValue;
8906     }
8907   });
8908
8909   // node_modules/lodash-es/_copyObject.js
8910   function copyObject(source, props, object, customizer) {
8911     var isNew = !object;
8912     object || (object = {});
8913     var index = -1, length2 = props.length;
8914     while (++index < length2) {
8915       var key = props[index];
8916       var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
8917       if (newValue === void 0) {
8918         newValue = source[key];
8919       }
8920       if (isNew) {
8921         baseAssignValue_default(object, key, newValue);
8922       } else {
8923         assignValue_default(object, key, newValue);
8924       }
8925     }
8926     return object;
8927   }
8928   var copyObject_default;
8929   var init_copyObject = __esm({
8930     "node_modules/lodash-es/_copyObject.js"() {
8931       init_assignValue();
8932       init_baseAssignValue();
8933       copyObject_default = copyObject;
8934     }
8935   });
8936
8937   // node_modules/lodash-es/_overRest.js
8938   function overRest(func, start2, transform2) {
8939     start2 = nativeMax(start2 === void 0 ? func.length - 1 : start2, 0);
8940     return function() {
8941       var args = arguments, index = -1, length2 = nativeMax(args.length - start2, 0), array2 = Array(length2);
8942       while (++index < length2) {
8943         array2[index] = args[start2 + index];
8944       }
8945       index = -1;
8946       var otherArgs = Array(start2 + 1);
8947       while (++index < start2) {
8948         otherArgs[index] = args[index];
8949       }
8950       otherArgs[start2] = transform2(array2);
8951       return apply_default(func, this, otherArgs);
8952     };
8953   }
8954   var nativeMax, overRest_default;
8955   var init_overRest = __esm({
8956     "node_modules/lodash-es/_overRest.js"() {
8957       init_apply();
8958       nativeMax = Math.max;
8959       overRest_default = overRest;
8960     }
8961   });
8962
8963   // node_modules/lodash-es/_baseRest.js
8964   function baseRest(func, start2) {
8965     return setToString_default(overRest_default(func, start2, identity_default3), func + "");
8966   }
8967   var baseRest_default;
8968   var init_baseRest = __esm({
8969     "node_modules/lodash-es/_baseRest.js"() {
8970       init_identity3();
8971       init_overRest();
8972       init_setToString();
8973       baseRest_default = baseRest;
8974     }
8975   });
8976
8977   // node_modules/lodash-es/isLength.js
8978   function isLength(value) {
8979     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
8980   }
8981   var MAX_SAFE_INTEGER2, isLength_default;
8982   var init_isLength = __esm({
8983     "node_modules/lodash-es/isLength.js"() {
8984       MAX_SAFE_INTEGER2 = 9007199254740991;
8985       isLength_default = isLength;
8986     }
8987   });
8988
8989   // node_modules/lodash-es/isArrayLike.js
8990   function isArrayLike(value) {
8991     return value != null && isLength_default(value.length) && !isFunction_default(value);
8992   }
8993   var isArrayLike_default;
8994   var init_isArrayLike = __esm({
8995     "node_modules/lodash-es/isArrayLike.js"() {
8996       init_isFunction();
8997       init_isLength();
8998       isArrayLike_default = isArrayLike;
8999     }
9000   });
9001
9002   // node_modules/lodash-es/_isIterateeCall.js
9003   function isIterateeCall(value, index, object) {
9004     if (!isObject_default(object)) {
9005       return false;
9006     }
9007     var type2 = typeof index;
9008     if (type2 == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type2 == "string" && index in object) {
9009       return eq_default(object[index], value);
9010     }
9011     return false;
9012   }
9013   var isIterateeCall_default;
9014   var init_isIterateeCall = __esm({
9015     "node_modules/lodash-es/_isIterateeCall.js"() {
9016       init_eq();
9017       init_isArrayLike();
9018       init_isIndex();
9019       init_isObject();
9020       isIterateeCall_default = isIterateeCall;
9021     }
9022   });
9023
9024   // node_modules/lodash-es/_createAssigner.js
9025   function createAssigner(assigner) {
9026     return baseRest_default(function(object, sources) {
9027       var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
9028       customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
9029       if (guard && isIterateeCall_default(sources[0], sources[1], guard)) {
9030         customizer = length2 < 3 ? void 0 : customizer;
9031         length2 = 1;
9032       }
9033       object = Object(object);
9034       while (++index < length2) {
9035         var source = sources[index];
9036         if (source) {
9037           assigner(object, source, index, customizer);
9038         }
9039       }
9040       return object;
9041     });
9042   }
9043   var createAssigner_default;
9044   var init_createAssigner = __esm({
9045     "node_modules/lodash-es/_createAssigner.js"() {
9046       init_baseRest();
9047       init_isIterateeCall();
9048       createAssigner_default = createAssigner;
9049     }
9050   });
9051
9052   // node_modules/lodash-es/_isPrototype.js
9053   function isPrototype(value) {
9054     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5;
9055     return value === proto;
9056   }
9057   var objectProto5, isPrototype_default;
9058   var init_isPrototype = __esm({
9059     "node_modules/lodash-es/_isPrototype.js"() {
9060       objectProto5 = Object.prototype;
9061       isPrototype_default = isPrototype;
9062     }
9063   });
9064
9065   // node_modules/lodash-es/_baseTimes.js
9066   function baseTimes(n3, iteratee) {
9067     var index = -1, result = Array(n3);
9068     while (++index < n3) {
9069       result[index] = iteratee(index);
9070     }
9071     return result;
9072   }
9073   var baseTimes_default;
9074   var init_baseTimes = __esm({
9075     "node_modules/lodash-es/_baseTimes.js"() {
9076       baseTimes_default = baseTimes;
9077     }
9078   });
9079
9080   // node_modules/lodash-es/_baseIsArguments.js
9081   function baseIsArguments(value) {
9082     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
9083   }
9084   var argsTag, baseIsArguments_default;
9085   var init_baseIsArguments = __esm({
9086     "node_modules/lodash-es/_baseIsArguments.js"() {
9087       init_baseGetTag();
9088       init_isObjectLike();
9089       argsTag = "[object Arguments]";
9090       baseIsArguments_default = baseIsArguments;
9091     }
9092   });
9093
9094   // node_modules/lodash-es/isArguments.js
9095   var objectProto6, hasOwnProperty4, propertyIsEnumerable, isArguments, isArguments_default;
9096   var init_isArguments = __esm({
9097     "node_modules/lodash-es/isArguments.js"() {
9098       init_baseIsArguments();
9099       init_isObjectLike();
9100       objectProto6 = Object.prototype;
9101       hasOwnProperty4 = objectProto6.hasOwnProperty;
9102       propertyIsEnumerable = objectProto6.propertyIsEnumerable;
9103       isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
9104         return arguments;
9105       }()) ? baseIsArguments_default : function(value) {
9106         return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
9107       };
9108       isArguments_default = isArguments;
9109     }
9110   });
9111
9112   // node_modules/lodash-es/stubFalse.js
9113   function stubFalse() {
9114     return false;
9115   }
9116   var stubFalse_default;
9117   var init_stubFalse = __esm({
9118     "node_modules/lodash-es/stubFalse.js"() {
9119       stubFalse_default = stubFalse;
9120     }
9121   });
9122
9123   // node_modules/lodash-es/isBuffer.js
9124   var freeExports, freeModule, moduleExports, Buffer2, nativeIsBuffer, isBuffer, isBuffer_default;
9125   var init_isBuffer = __esm({
9126     "node_modules/lodash-es/isBuffer.js"() {
9127       init_root();
9128       init_stubFalse();
9129       freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
9130       freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
9131       moduleExports = freeModule && freeModule.exports === freeExports;
9132       Buffer2 = moduleExports ? root_default.Buffer : void 0;
9133       nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
9134       isBuffer = nativeIsBuffer || stubFalse_default;
9135       isBuffer_default = isBuffer;
9136     }
9137   });
9138
9139   // node_modules/lodash-es/_baseIsTypedArray.js
9140   function baseIsTypedArray(value) {
9141     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
9142   }
9143   var argsTag2, arrayTag, boolTag, dateTag, errorTag, funcTag2, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, weakMapTag, arrayBufferTag, dataViewTag, float32Tag, float64Tag, int8Tag, int16Tag, int32Tag, uint8Tag, uint8ClampedTag, uint16Tag, uint32Tag, typedArrayTags, baseIsTypedArray_default;
9144   var init_baseIsTypedArray = __esm({
9145     "node_modules/lodash-es/_baseIsTypedArray.js"() {
9146       init_baseGetTag();
9147       init_isLength();
9148       init_isObjectLike();
9149       argsTag2 = "[object Arguments]";
9150       arrayTag = "[object Array]";
9151       boolTag = "[object Boolean]";
9152       dateTag = "[object Date]";
9153       errorTag = "[object Error]";
9154       funcTag2 = "[object Function]";
9155       mapTag = "[object Map]";
9156       numberTag = "[object Number]";
9157       objectTag = "[object Object]";
9158       regexpTag = "[object RegExp]";
9159       setTag = "[object Set]";
9160       stringTag = "[object String]";
9161       weakMapTag = "[object WeakMap]";
9162       arrayBufferTag = "[object ArrayBuffer]";
9163       dataViewTag = "[object DataView]";
9164       float32Tag = "[object Float32Array]";
9165       float64Tag = "[object Float64Array]";
9166       int8Tag = "[object Int8Array]";
9167       int16Tag = "[object Int16Array]";
9168       int32Tag = "[object Int32Array]";
9169       uint8Tag = "[object Uint8Array]";
9170       uint8ClampedTag = "[object Uint8ClampedArray]";
9171       uint16Tag = "[object Uint16Array]";
9172       uint32Tag = "[object Uint32Array]";
9173       typedArrayTags = {};
9174       typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
9175       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;
9176       baseIsTypedArray_default = baseIsTypedArray;
9177     }
9178   });
9179
9180   // node_modules/lodash-es/_baseUnary.js
9181   function baseUnary(func) {
9182     return function(value) {
9183       return func(value);
9184     };
9185   }
9186   var baseUnary_default;
9187   var init_baseUnary = __esm({
9188     "node_modules/lodash-es/_baseUnary.js"() {
9189       baseUnary_default = baseUnary;
9190     }
9191   });
9192
9193   // node_modules/lodash-es/_nodeUtil.js
9194   var freeExports2, freeModule2, moduleExports2, freeProcess, nodeUtil, nodeUtil_default;
9195   var init_nodeUtil = __esm({
9196     "node_modules/lodash-es/_nodeUtil.js"() {
9197       init_freeGlobal();
9198       freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
9199       freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
9200       moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
9201       freeProcess = moduleExports2 && freeGlobal_default.process;
9202       nodeUtil = function() {
9203         try {
9204           var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
9205           if (types) {
9206             return types;
9207           }
9208           return freeProcess && freeProcess.binding && freeProcess.binding("util");
9209         } catch (e3) {
9210         }
9211       }();
9212       nodeUtil_default = nodeUtil;
9213     }
9214   });
9215
9216   // node_modules/lodash-es/isTypedArray.js
9217   var nodeIsTypedArray, isTypedArray, isTypedArray_default;
9218   var init_isTypedArray = __esm({
9219     "node_modules/lodash-es/isTypedArray.js"() {
9220       init_baseIsTypedArray();
9221       init_baseUnary();
9222       init_nodeUtil();
9223       nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
9224       isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
9225       isTypedArray_default = isTypedArray;
9226     }
9227   });
9228
9229   // node_modules/lodash-es/_arrayLikeKeys.js
9230   function arrayLikeKeys(value, inherited) {
9231     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length2 = result.length;
9232     for (var key in value) {
9233       if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
9234       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
9235       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
9236       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
9237       isIndex_default(key, length2)))) {
9238         result.push(key);
9239       }
9240     }
9241     return result;
9242   }
9243   var objectProto7, hasOwnProperty5, arrayLikeKeys_default;
9244   var init_arrayLikeKeys = __esm({
9245     "node_modules/lodash-es/_arrayLikeKeys.js"() {
9246       init_baseTimes();
9247       init_isArguments();
9248       init_isArray();
9249       init_isBuffer();
9250       init_isIndex();
9251       init_isTypedArray();
9252       objectProto7 = Object.prototype;
9253       hasOwnProperty5 = objectProto7.hasOwnProperty;
9254       arrayLikeKeys_default = arrayLikeKeys;
9255     }
9256   });
9257
9258   // node_modules/lodash-es/_overArg.js
9259   function overArg(func, transform2) {
9260     return function(arg) {
9261       return func(transform2(arg));
9262     };
9263   }
9264   var overArg_default;
9265   var init_overArg = __esm({
9266     "node_modules/lodash-es/_overArg.js"() {
9267       overArg_default = overArg;
9268     }
9269   });
9270
9271   // node_modules/lodash-es/_nativeKeys.js
9272   var nativeKeys, nativeKeys_default;
9273   var init_nativeKeys = __esm({
9274     "node_modules/lodash-es/_nativeKeys.js"() {
9275       init_overArg();
9276       nativeKeys = overArg_default(Object.keys, Object);
9277       nativeKeys_default = nativeKeys;
9278     }
9279   });
9280
9281   // node_modules/lodash-es/_baseKeys.js
9282   function baseKeys(object) {
9283     if (!isPrototype_default(object)) {
9284       return nativeKeys_default(object);
9285     }
9286     var result = [];
9287     for (var key in Object(object)) {
9288       if (hasOwnProperty6.call(object, key) && key != "constructor") {
9289         result.push(key);
9290       }
9291     }
9292     return result;
9293   }
9294   var objectProto8, hasOwnProperty6, baseKeys_default;
9295   var init_baseKeys = __esm({
9296     "node_modules/lodash-es/_baseKeys.js"() {
9297       init_isPrototype();
9298       init_nativeKeys();
9299       objectProto8 = Object.prototype;
9300       hasOwnProperty6 = objectProto8.hasOwnProperty;
9301       baseKeys_default = baseKeys;
9302     }
9303   });
9304
9305   // node_modules/lodash-es/keys.js
9306   function keys(object) {
9307     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
9308   }
9309   var keys_default;
9310   var init_keys = __esm({
9311     "node_modules/lodash-es/keys.js"() {
9312       init_arrayLikeKeys();
9313       init_baseKeys();
9314       init_isArrayLike();
9315       keys_default = keys;
9316     }
9317   });
9318
9319   // node_modules/lodash-es/_nativeKeysIn.js
9320   function nativeKeysIn(object) {
9321     var result = [];
9322     if (object != null) {
9323       for (var key in Object(object)) {
9324         result.push(key);
9325       }
9326     }
9327     return result;
9328   }
9329   var nativeKeysIn_default;
9330   var init_nativeKeysIn = __esm({
9331     "node_modules/lodash-es/_nativeKeysIn.js"() {
9332       nativeKeysIn_default = nativeKeysIn;
9333     }
9334   });
9335
9336   // node_modules/lodash-es/_baseKeysIn.js
9337   function baseKeysIn(object) {
9338     if (!isObject_default(object)) {
9339       return nativeKeysIn_default(object);
9340     }
9341     var isProto = isPrototype_default(object), result = [];
9342     for (var key in object) {
9343       if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object, key)))) {
9344         result.push(key);
9345       }
9346     }
9347     return result;
9348   }
9349   var objectProto9, hasOwnProperty7, baseKeysIn_default;
9350   var init_baseKeysIn = __esm({
9351     "node_modules/lodash-es/_baseKeysIn.js"() {
9352       init_isObject();
9353       init_isPrototype();
9354       init_nativeKeysIn();
9355       objectProto9 = Object.prototype;
9356       hasOwnProperty7 = objectProto9.hasOwnProperty;
9357       baseKeysIn_default = baseKeysIn;
9358     }
9359   });
9360
9361   // node_modules/lodash-es/keysIn.js
9362   function keysIn(object) {
9363     return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
9364   }
9365   var keysIn_default;
9366   var init_keysIn = __esm({
9367     "node_modules/lodash-es/keysIn.js"() {
9368       init_arrayLikeKeys();
9369       init_baseKeysIn();
9370       init_isArrayLike();
9371       keysIn_default = keysIn;
9372     }
9373   });
9374
9375   // node_modules/lodash-es/_nativeCreate.js
9376   var nativeCreate, nativeCreate_default;
9377   var init_nativeCreate = __esm({
9378     "node_modules/lodash-es/_nativeCreate.js"() {
9379       init_getNative();
9380       nativeCreate = getNative_default(Object, "create");
9381       nativeCreate_default = nativeCreate;
9382     }
9383   });
9384
9385   // node_modules/lodash-es/_hashClear.js
9386   function hashClear() {
9387     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
9388     this.size = 0;
9389   }
9390   var hashClear_default;
9391   var init_hashClear = __esm({
9392     "node_modules/lodash-es/_hashClear.js"() {
9393       init_nativeCreate();
9394       hashClear_default = hashClear;
9395     }
9396   });
9397
9398   // node_modules/lodash-es/_hashDelete.js
9399   function hashDelete(key) {
9400     var result = this.has(key) && delete this.__data__[key];
9401     this.size -= result ? 1 : 0;
9402     return result;
9403   }
9404   var hashDelete_default;
9405   var init_hashDelete = __esm({
9406     "node_modules/lodash-es/_hashDelete.js"() {
9407       hashDelete_default = hashDelete;
9408     }
9409   });
9410
9411   // node_modules/lodash-es/_hashGet.js
9412   function hashGet(key) {
9413     var data = this.__data__;
9414     if (nativeCreate_default) {
9415       var result = data[key];
9416       return result === HASH_UNDEFINED ? void 0 : result;
9417     }
9418     return hasOwnProperty8.call(data, key) ? data[key] : void 0;
9419   }
9420   var HASH_UNDEFINED, objectProto10, hasOwnProperty8, hashGet_default;
9421   var init_hashGet = __esm({
9422     "node_modules/lodash-es/_hashGet.js"() {
9423       init_nativeCreate();
9424       HASH_UNDEFINED = "__lodash_hash_undefined__";
9425       objectProto10 = Object.prototype;
9426       hasOwnProperty8 = objectProto10.hasOwnProperty;
9427       hashGet_default = hashGet;
9428     }
9429   });
9430
9431   // node_modules/lodash-es/_hashHas.js
9432   function hashHas(key) {
9433     var data = this.__data__;
9434     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty9.call(data, key);
9435   }
9436   var objectProto11, hasOwnProperty9, hashHas_default;
9437   var init_hashHas = __esm({
9438     "node_modules/lodash-es/_hashHas.js"() {
9439       init_nativeCreate();
9440       objectProto11 = Object.prototype;
9441       hasOwnProperty9 = objectProto11.hasOwnProperty;
9442       hashHas_default = hashHas;
9443     }
9444   });
9445
9446   // node_modules/lodash-es/_hashSet.js
9447   function hashSet(key, value) {
9448     var data = this.__data__;
9449     this.size += this.has(key) ? 0 : 1;
9450     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
9451     return this;
9452   }
9453   var HASH_UNDEFINED2, hashSet_default;
9454   var init_hashSet = __esm({
9455     "node_modules/lodash-es/_hashSet.js"() {
9456       init_nativeCreate();
9457       HASH_UNDEFINED2 = "__lodash_hash_undefined__";
9458       hashSet_default = hashSet;
9459     }
9460   });
9461
9462   // node_modules/lodash-es/_Hash.js
9463   function Hash(entries) {
9464     var index = -1, length2 = entries == null ? 0 : entries.length;
9465     this.clear();
9466     while (++index < length2) {
9467       var entry = entries[index];
9468       this.set(entry[0], entry[1]);
9469     }
9470   }
9471   var Hash_default;
9472   var init_Hash = __esm({
9473     "node_modules/lodash-es/_Hash.js"() {
9474       init_hashClear();
9475       init_hashDelete();
9476       init_hashGet();
9477       init_hashHas();
9478       init_hashSet();
9479       Hash.prototype.clear = hashClear_default;
9480       Hash.prototype["delete"] = hashDelete_default;
9481       Hash.prototype.get = hashGet_default;
9482       Hash.prototype.has = hashHas_default;
9483       Hash.prototype.set = hashSet_default;
9484       Hash_default = Hash;
9485     }
9486   });
9487
9488   // node_modules/lodash-es/_listCacheClear.js
9489   function listCacheClear() {
9490     this.__data__ = [];
9491     this.size = 0;
9492   }
9493   var listCacheClear_default;
9494   var init_listCacheClear = __esm({
9495     "node_modules/lodash-es/_listCacheClear.js"() {
9496       listCacheClear_default = listCacheClear;
9497     }
9498   });
9499
9500   // node_modules/lodash-es/_assocIndexOf.js
9501   function assocIndexOf(array2, key) {
9502     var length2 = array2.length;
9503     while (length2--) {
9504       if (eq_default(array2[length2][0], key)) {
9505         return length2;
9506       }
9507     }
9508     return -1;
9509   }
9510   var assocIndexOf_default;
9511   var init_assocIndexOf = __esm({
9512     "node_modules/lodash-es/_assocIndexOf.js"() {
9513       init_eq();
9514       assocIndexOf_default = assocIndexOf;
9515     }
9516   });
9517
9518   // node_modules/lodash-es/_listCacheDelete.js
9519   function listCacheDelete(key) {
9520     var data = this.__data__, index = assocIndexOf_default(data, key);
9521     if (index < 0) {
9522       return false;
9523     }
9524     var lastIndex = data.length - 1;
9525     if (index == lastIndex) {
9526       data.pop();
9527     } else {
9528       splice.call(data, index, 1);
9529     }
9530     --this.size;
9531     return true;
9532   }
9533   var arrayProto, splice, listCacheDelete_default;
9534   var init_listCacheDelete = __esm({
9535     "node_modules/lodash-es/_listCacheDelete.js"() {
9536       init_assocIndexOf();
9537       arrayProto = Array.prototype;
9538       splice = arrayProto.splice;
9539       listCacheDelete_default = listCacheDelete;
9540     }
9541   });
9542
9543   // node_modules/lodash-es/_listCacheGet.js
9544   function listCacheGet(key) {
9545     var data = this.__data__, index = assocIndexOf_default(data, key);
9546     return index < 0 ? void 0 : data[index][1];
9547   }
9548   var listCacheGet_default;
9549   var init_listCacheGet = __esm({
9550     "node_modules/lodash-es/_listCacheGet.js"() {
9551       init_assocIndexOf();
9552       listCacheGet_default = listCacheGet;
9553     }
9554   });
9555
9556   // node_modules/lodash-es/_listCacheHas.js
9557   function listCacheHas(key) {
9558     return assocIndexOf_default(this.__data__, key) > -1;
9559   }
9560   var listCacheHas_default;
9561   var init_listCacheHas = __esm({
9562     "node_modules/lodash-es/_listCacheHas.js"() {
9563       init_assocIndexOf();
9564       listCacheHas_default = listCacheHas;
9565     }
9566   });
9567
9568   // node_modules/lodash-es/_listCacheSet.js
9569   function listCacheSet(key, value) {
9570     var data = this.__data__, index = assocIndexOf_default(data, key);
9571     if (index < 0) {
9572       ++this.size;
9573       data.push([key, value]);
9574     } else {
9575       data[index][1] = value;
9576     }
9577     return this;
9578   }
9579   var listCacheSet_default;
9580   var init_listCacheSet = __esm({
9581     "node_modules/lodash-es/_listCacheSet.js"() {
9582       init_assocIndexOf();
9583       listCacheSet_default = listCacheSet;
9584     }
9585   });
9586
9587   // node_modules/lodash-es/_ListCache.js
9588   function ListCache(entries) {
9589     var index = -1, length2 = entries == null ? 0 : entries.length;
9590     this.clear();
9591     while (++index < length2) {
9592       var entry = entries[index];
9593       this.set(entry[0], entry[1]);
9594     }
9595   }
9596   var ListCache_default;
9597   var init_ListCache = __esm({
9598     "node_modules/lodash-es/_ListCache.js"() {
9599       init_listCacheClear();
9600       init_listCacheDelete();
9601       init_listCacheGet();
9602       init_listCacheHas();
9603       init_listCacheSet();
9604       ListCache.prototype.clear = listCacheClear_default;
9605       ListCache.prototype["delete"] = listCacheDelete_default;
9606       ListCache.prototype.get = listCacheGet_default;
9607       ListCache.prototype.has = listCacheHas_default;
9608       ListCache.prototype.set = listCacheSet_default;
9609       ListCache_default = ListCache;
9610     }
9611   });
9612
9613   // node_modules/lodash-es/_Map.js
9614   var Map2, Map_default;
9615   var init_Map = __esm({
9616     "node_modules/lodash-es/_Map.js"() {
9617       init_getNative();
9618       init_root();
9619       Map2 = getNative_default(root_default, "Map");
9620       Map_default = Map2;
9621     }
9622   });
9623
9624   // node_modules/lodash-es/_mapCacheClear.js
9625   function mapCacheClear() {
9626     this.size = 0;
9627     this.__data__ = {
9628       "hash": new Hash_default(),
9629       "map": new (Map_default || ListCache_default)(),
9630       "string": new Hash_default()
9631     };
9632   }
9633   var mapCacheClear_default;
9634   var init_mapCacheClear = __esm({
9635     "node_modules/lodash-es/_mapCacheClear.js"() {
9636       init_Hash();
9637       init_ListCache();
9638       init_Map();
9639       mapCacheClear_default = mapCacheClear;
9640     }
9641   });
9642
9643   // node_modules/lodash-es/_isKeyable.js
9644   function isKeyable(value) {
9645     var type2 = typeof value;
9646     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9647   }
9648   var isKeyable_default;
9649   var init_isKeyable = __esm({
9650     "node_modules/lodash-es/_isKeyable.js"() {
9651       isKeyable_default = isKeyable;
9652     }
9653   });
9654
9655   // node_modules/lodash-es/_getMapData.js
9656   function getMapData(map2, key) {
9657     var data = map2.__data__;
9658     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9659   }
9660   var getMapData_default;
9661   var init_getMapData = __esm({
9662     "node_modules/lodash-es/_getMapData.js"() {
9663       init_isKeyable();
9664       getMapData_default = getMapData;
9665     }
9666   });
9667
9668   // node_modules/lodash-es/_mapCacheDelete.js
9669   function mapCacheDelete(key) {
9670     var result = getMapData_default(this, key)["delete"](key);
9671     this.size -= result ? 1 : 0;
9672     return result;
9673   }
9674   var mapCacheDelete_default;
9675   var init_mapCacheDelete = __esm({
9676     "node_modules/lodash-es/_mapCacheDelete.js"() {
9677       init_getMapData();
9678       mapCacheDelete_default = mapCacheDelete;
9679     }
9680   });
9681
9682   // node_modules/lodash-es/_mapCacheGet.js
9683   function mapCacheGet(key) {
9684     return getMapData_default(this, key).get(key);
9685   }
9686   var mapCacheGet_default;
9687   var init_mapCacheGet = __esm({
9688     "node_modules/lodash-es/_mapCacheGet.js"() {
9689       init_getMapData();
9690       mapCacheGet_default = mapCacheGet;
9691     }
9692   });
9693
9694   // node_modules/lodash-es/_mapCacheHas.js
9695   function mapCacheHas(key) {
9696     return getMapData_default(this, key).has(key);
9697   }
9698   var mapCacheHas_default;
9699   var init_mapCacheHas = __esm({
9700     "node_modules/lodash-es/_mapCacheHas.js"() {
9701       init_getMapData();
9702       mapCacheHas_default = mapCacheHas;
9703     }
9704   });
9705
9706   // node_modules/lodash-es/_mapCacheSet.js
9707   function mapCacheSet(key, value) {
9708     var data = getMapData_default(this, key), size = data.size;
9709     data.set(key, value);
9710     this.size += data.size == size ? 0 : 1;
9711     return this;
9712   }
9713   var mapCacheSet_default;
9714   var init_mapCacheSet = __esm({
9715     "node_modules/lodash-es/_mapCacheSet.js"() {
9716       init_getMapData();
9717       mapCacheSet_default = mapCacheSet;
9718     }
9719   });
9720
9721   // node_modules/lodash-es/_MapCache.js
9722   function MapCache(entries) {
9723     var index = -1, length2 = entries == null ? 0 : entries.length;
9724     this.clear();
9725     while (++index < length2) {
9726       var entry = entries[index];
9727       this.set(entry[0], entry[1]);
9728     }
9729   }
9730   var MapCache_default;
9731   var init_MapCache = __esm({
9732     "node_modules/lodash-es/_MapCache.js"() {
9733       init_mapCacheClear();
9734       init_mapCacheDelete();
9735       init_mapCacheGet();
9736       init_mapCacheHas();
9737       init_mapCacheSet();
9738       MapCache.prototype.clear = mapCacheClear_default;
9739       MapCache.prototype["delete"] = mapCacheDelete_default;
9740       MapCache.prototype.get = mapCacheGet_default;
9741       MapCache.prototype.has = mapCacheHas_default;
9742       MapCache.prototype.set = mapCacheSet_default;
9743       MapCache_default = MapCache;
9744     }
9745   });
9746
9747   // node_modules/lodash-es/toString.js
9748   function toString(value) {
9749     return value == null ? "" : baseToString_default(value);
9750   }
9751   var toString_default;
9752   var init_toString = __esm({
9753     "node_modules/lodash-es/toString.js"() {
9754       init_baseToString();
9755       toString_default = toString;
9756     }
9757   });
9758
9759   // node_modules/lodash-es/_arrayPush.js
9760   function arrayPush(array2, values) {
9761     var index = -1, length2 = values.length, offset = array2.length;
9762     while (++index < length2) {
9763       array2[offset + index] = values[index];
9764     }
9765     return array2;
9766   }
9767   var arrayPush_default;
9768   var init_arrayPush = __esm({
9769     "node_modules/lodash-es/_arrayPush.js"() {
9770       arrayPush_default = arrayPush;
9771     }
9772   });
9773
9774   // node_modules/lodash-es/_getPrototype.js
9775   var getPrototype, getPrototype_default;
9776   var init_getPrototype = __esm({
9777     "node_modules/lodash-es/_getPrototype.js"() {
9778       init_overArg();
9779       getPrototype = overArg_default(Object.getPrototypeOf, Object);
9780       getPrototype_default = getPrototype;
9781     }
9782   });
9783
9784   // node_modules/lodash-es/isPlainObject.js
9785   function isPlainObject(value) {
9786     if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) {
9787       return false;
9788     }
9789     var proto = getPrototype_default(value);
9790     if (proto === null) {
9791       return true;
9792     }
9793     var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
9794     return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
9795   }
9796   var objectTag2, funcProto3, objectProto12, funcToString3, hasOwnProperty10, objectCtorString, isPlainObject_default;
9797   var init_isPlainObject = __esm({
9798     "node_modules/lodash-es/isPlainObject.js"() {
9799       init_baseGetTag();
9800       init_getPrototype();
9801       init_isObjectLike();
9802       objectTag2 = "[object Object]";
9803       funcProto3 = Function.prototype;
9804       objectProto12 = Object.prototype;
9805       funcToString3 = funcProto3.toString;
9806       hasOwnProperty10 = objectProto12.hasOwnProperty;
9807       objectCtorString = funcToString3.call(Object);
9808       isPlainObject_default = isPlainObject;
9809     }
9810   });
9811
9812   // node_modules/lodash-es/_basePropertyOf.js
9813   function basePropertyOf(object) {
9814     return function(key) {
9815       return object == null ? void 0 : object[key];
9816     };
9817   }
9818   var basePropertyOf_default;
9819   var init_basePropertyOf = __esm({
9820     "node_modules/lodash-es/_basePropertyOf.js"() {
9821       basePropertyOf_default = basePropertyOf;
9822     }
9823   });
9824
9825   // node_modules/lodash-es/_stackClear.js
9826   function stackClear() {
9827     this.__data__ = new ListCache_default();
9828     this.size = 0;
9829   }
9830   var stackClear_default;
9831   var init_stackClear = __esm({
9832     "node_modules/lodash-es/_stackClear.js"() {
9833       init_ListCache();
9834       stackClear_default = stackClear;
9835     }
9836   });
9837
9838   // node_modules/lodash-es/_stackDelete.js
9839   function stackDelete(key) {
9840     var data = this.__data__, result = data["delete"](key);
9841     this.size = data.size;
9842     return result;
9843   }
9844   var stackDelete_default;
9845   var init_stackDelete = __esm({
9846     "node_modules/lodash-es/_stackDelete.js"() {
9847       stackDelete_default = stackDelete;
9848     }
9849   });
9850
9851   // node_modules/lodash-es/_stackGet.js
9852   function stackGet(key) {
9853     return this.__data__.get(key);
9854   }
9855   var stackGet_default;
9856   var init_stackGet = __esm({
9857     "node_modules/lodash-es/_stackGet.js"() {
9858       stackGet_default = stackGet;
9859     }
9860   });
9861
9862   // node_modules/lodash-es/_stackHas.js
9863   function stackHas(key) {
9864     return this.__data__.has(key);
9865   }
9866   var stackHas_default;
9867   var init_stackHas = __esm({
9868     "node_modules/lodash-es/_stackHas.js"() {
9869       stackHas_default = stackHas;
9870     }
9871   });
9872
9873   // node_modules/lodash-es/_stackSet.js
9874   function stackSet(key, value) {
9875     var data = this.__data__;
9876     if (data instanceof ListCache_default) {
9877       var pairs2 = data.__data__;
9878       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
9879         pairs2.push([key, value]);
9880         this.size = ++data.size;
9881         return this;
9882       }
9883       data = this.__data__ = new MapCache_default(pairs2);
9884     }
9885     data.set(key, value);
9886     this.size = data.size;
9887     return this;
9888   }
9889   var LARGE_ARRAY_SIZE, stackSet_default;
9890   var init_stackSet = __esm({
9891     "node_modules/lodash-es/_stackSet.js"() {
9892       init_ListCache();
9893       init_Map();
9894       init_MapCache();
9895       LARGE_ARRAY_SIZE = 200;
9896       stackSet_default = stackSet;
9897     }
9898   });
9899
9900   // node_modules/lodash-es/_Stack.js
9901   function Stack(entries) {
9902     var data = this.__data__ = new ListCache_default(entries);
9903     this.size = data.size;
9904   }
9905   var Stack_default;
9906   var init_Stack = __esm({
9907     "node_modules/lodash-es/_Stack.js"() {
9908       init_ListCache();
9909       init_stackClear();
9910       init_stackDelete();
9911       init_stackGet();
9912       init_stackHas();
9913       init_stackSet();
9914       Stack.prototype.clear = stackClear_default;
9915       Stack.prototype["delete"] = stackDelete_default;
9916       Stack.prototype.get = stackGet_default;
9917       Stack.prototype.has = stackHas_default;
9918       Stack.prototype.set = stackSet_default;
9919       Stack_default = Stack;
9920     }
9921   });
9922
9923   // node_modules/lodash-es/_cloneBuffer.js
9924   function cloneBuffer(buffer, isDeep) {
9925     if (isDeep) {
9926       return buffer.slice();
9927     }
9928     var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
9929     buffer.copy(result);
9930     return result;
9931   }
9932   var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default;
9933   var init_cloneBuffer = __esm({
9934     "node_modules/lodash-es/_cloneBuffer.js"() {
9935       init_root();
9936       freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports;
9937       freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module;
9938       moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
9939       Buffer3 = moduleExports3 ? root_default.Buffer : void 0;
9940       allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : void 0;
9941       cloneBuffer_default = cloneBuffer;
9942     }
9943   });
9944
9945   // node_modules/lodash-es/_arrayFilter.js
9946   function arrayFilter(array2, predicate) {
9947     var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
9948     while (++index < length2) {
9949       var value = array2[index];
9950       if (predicate(value, index, array2)) {
9951         result[resIndex++] = value;
9952       }
9953     }
9954     return result;
9955   }
9956   var arrayFilter_default;
9957   var init_arrayFilter = __esm({
9958     "node_modules/lodash-es/_arrayFilter.js"() {
9959       arrayFilter_default = arrayFilter;
9960     }
9961   });
9962
9963   // node_modules/lodash-es/stubArray.js
9964   function stubArray() {
9965     return [];
9966   }
9967   var stubArray_default;
9968   var init_stubArray = __esm({
9969     "node_modules/lodash-es/stubArray.js"() {
9970       stubArray_default = stubArray;
9971     }
9972   });
9973
9974   // node_modules/lodash-es/_getSymbols.js
9975   var objectProto13, propertyIsEnumerable2, nativeGetSymbols, getSymbols, getSymbols_default;
9976   var init_getSymbols = __esm({
9977     "node_modules/lodash-es/_getSymbols.js"() {
9978       init_arrayFilter();
9979       init_stubArray();
9980       objectProto13 = Object.prototype;
9981       propertyIsEnumerable2 = objectProto13.propertyIsEnumerable;
9982       nativeGetSymbols = Object.getOwnPropertySymbols;
9983       getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
9984         if (object == null) {
9985           return [];
9986         }
9987         object = Object(object);
9988         return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
9989           return propertyIsEnumerable2.call(object, symbol);
9990         });
9991       };
9992       getSymbols_default = getSymbols;
9993     }
9994   });
9995
9996   // node_modules/lodash-es/_baseGetAllKeys.js
9997   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
9998     var result = keysFunc(object);
9999     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
10000   }
10001   var baseGetAllKeys_default;
10002   var init_baseGetAllKeys = __esm({
10003     "node_modules/lodash-es/_baseGetAllKeys.js"() {
10004       init_arrayPush();
10005       init_isArray();
10006       baseGetAllKeys_default = baseGetAllKeys;
10007     }
10008   });
10009
10010   // node_modules/lodash-es/_getAllKeys.js
10011   function getAllKeys(object) {
10012     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
10013   }
10014   var getAllKeys_default;
10015   var init_getAllKeys = __esm({
10016     "node_modules/lodash-es/_getAllKeys.js"() {
10017       init_baseGetAllKeys();
10018       init_getSymbols();
10019       init_keys();
10020       getAllKeys_default = getAllKeys;
10021     }
10022   });
10023
10024   // node_modules/lodash-es/_DataView.js
10025   var DataView2, DataView_default;
10026   var init_DataView = __esm({
10027     "node_modules/lodash-es/_DataView.js"() {
10028       init_getNative();
10029       init_root();
10030       DataView2 = getNative_default(root_default, "DataView");
10031       DataView_default = DataView2;
10032     }
10033   });
10034
10035   // node_modules/lodash-es/_Promise.js
10036   var Promise2, Promise_default;
10037   var init_Promise = __esm({
10038     "node_modules/lodash-es/_Promise.js"() {
10039       init_getNative();
10040       init_root();
10041       Promise2 = getNative_default(root_default, "Promise");
10042       Promise_default = Promise2;
10043     }
10044   });
10045
10046   // node_modules/lodash-es/_Set.js
10047   var Set2, Set_default;
10048   var init_Set = __esm({
10049     "node_modules/lodash-es/_Set.js"() {
10050       init_getNative();
10051       init_root();
10052       Set2 = getNative_default(root_default, "Set");
10053       Set_default = Set2;
10054     }
10055   });
10056
10057   // node_modules/lodash-es/_getTag.js
10058   var mapTag2, objectTag3, promiseTag, setTag2, weakMapTag2, dataViewTag2, dataViewCtorString, mapCtorString, promiseCtorString, setCtorString, weakMapCtorString, getTag, getTag_default;
10059   var init_getTag = __esm({
10060     "node_modules/lodash-es/_getTag.js"() {
10061       init_DataView();
10062       init_Map();
10063       init_Promise();
10064       init_Set();
10065       init_WeakMap();
10066       init_baseGetTag();
10067       init_toSource();
10068       mapTag2 = "[object Map]";
10069       objectTag3 = "[object Object]";
10070       promiseTag = "[object Promise]";
10071       setTag2 = "[object Set]";
10072       weakMapTag2 = "[object WeakMap]";
10073       dataViewTag2 = "[object DataView]";
10074       dataViewCtorString = toSource_default(DataView_default);
10075       mapCtorString = toSource_default(Map_default);
10076       promiseCtorString = toSource_default(Promise_default);
10077       setCtorString = toSource_default(Set_default);
10078       weakMapCtorString = toSource_default(WeakMap_default);
10079       getTag = baseGetTag_default;
10080       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) {
10081         getTag = function(value) {
10082           var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
10083           if (ctorString) {
10084             switch (ctorString) {
10085               case dataViewCtorString:
10086                 return dataViewTag2;
10087               case mapCtorString:
10088                 return mapTag2;
10089               case promiseCtorString:
10090                 return promiseTag;
10091               case setCtorString:
10092                 return setTag2;
10093               case weakMapCtorString:
10094                 return weakMapTag2;
10095             }
10096           }
10097           return result;
10098         };
10099       }
10100       getTag_default = getTag;
10101     }
10102   });
10103
10104   // node_modules/lodash-es/_Uint8Array.js
10105   var Uint8Array2, Uint8Array_default;
10106   var init_Uint8Array = __esm({
10107     "node_modules/lodash-es/_Uint8Array.js"() {
10108       init_root();
10109       Uint8Array2 = root_default.Uint8Array;
10110       Uint8Array_default = Uint8Array2;
10111     }
10112   });
10113
10114   // node_modules/lodash-es/_cloneArrayBuffer.js
10115   function cloneArrayBuffer(arrayBuffer) {
10116     var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
10117     new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
10118     return result;
10119   }
10120   var cloneArrayBuffer_default;
10121   var init_cloneArrayBuffer = __esm({
10122     "node_modules/lodash-es/_cloneArrayBuffer.js"() {
10123       init_Uint8Array();
10124       cloneArrayBuffer_default = cloneArrayBuffer;
10125     }
10126   });
10127
10128   // node_modules/lodash-es/_cloneTypedArray.js
10129   function cloneTypedArray(typedArray, isDeep) {
10130     var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
10131     return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
10132   }
10133   var cloneTypedArray_default;
10134   var init_cloneTypedArray = __esm({
10135     "node_modules/lodash-es/_cloneTypedArray.js"() {
10136       init_cloneArrayBuffer();
10137       cloneTypedArray_default = cloneTypedArray;
10138     }
10139   });
10140
10141   // node_modules/lodash-es/_initCloneObject.js
10142   function initCloneObject(object) {
10143     return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
10144   }
10145   var initCloneObject_default;
10146   var init_initCloneObject = __esm({
10147     "node_modules/lodash-es/_initCloneObject.js"() {
10148       init_baseCreate();
10149       init_getPrototype();
10150       init_isPrototype();
10151       initCloneObject_default = initCloneObject;
10152     }
10153   });
10154
10155   // node_modules/lodash-es/_setCacheAdd.js
10156   function setCacheAdd(value) {
10157     this.__data__.set(value, HASH_UNDEFINED3);
10158     return this;
10159   }
10160   var HASH_UNDEFINED3, setCacheAdd_default;
10161   var init_setCacheAdd = __esm({
10162     "node_modules/lodash-es/_setCacheAdd.js"() {
10163       HASH_UNDEFINED3 = "__lodash_hash_undefined__";
10164       setCacheAdd_default = setCacheAdd;
10165     }
10166   });
10167
10168   // node_modules/lodash-es/_setCacheHas.js
10169   function setCacheHas(value) {
10170     return this.__data__.has(value);
10171   }
10172   var setCacheHas_default;
10173   var init_setCacheHas = __esm({
10174     "node_modules/lodash-es/_setCacheHas.js"() {
10175       setCacheHas_default = setCacheHas;
10176     }
10177   });
10178
10179   // node_modules/lodash-es/_SetCache.js
10180   function SetCache(values) {
10181     var index = -1, length2 = values == null ? 0 : values.length;
10182     this.__data__ = new MapCache_default();
10183     while (++index < length2) {
10184       this.add(values[index]);
10185     }
10186   }
10187   var SetCache_default;
10188   var init_SetCache = __esm({
10189     "node_modules/lodash-es/_SetCache.js"() {
10190       init_MapCache();
10191       init_setCacheAdd();
10192       init_setCacheHas();
10193       SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
10194       SetCache.prototype.has = setCacheHas_default;
10195       SetCache_default = SetCache;
10196     }
10197   });
10198
10199   // node_modules/lodash-es/_arraySome.js
10200   function arraySome(array2, predicate) {
10201     var index = -1, length2 = array2 == null ? 0 : array2.length;
10202     while (++index < length2) {
10203       if (predicate(array2[index], index, array2)) {
10204         return true;
10205       }
10206     }
10207     return false;
10208   }
10209   var arraySome_default;
10210   var init_arraySome = __esm({
10211     "node_modules/lodash-es/_arraySome.js"() {
10212       arraySome_default = arraySome;
10213     }
10214   });
10215
10216   // node_modules/lodash-es/_cacheHas.js
10217   function cacheHas(cache, key) {
10218     return cache.has(key);
10219   }
10220   var cacheHas_default;
10221   var init_cacheHas = __esm({
10222     "node_modules/lodash-es/_cacheHas.js"() {
10223       cacheHas_default = cacheHas;
10224     }
10225   });
10226
10227   // node_modules/lodash-es/_equalArrays.js
10228   function equalArrays(array2, other2, bitmask, customizer, equalFunc, stack) {
10229     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other2.length;
10230     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
10231       return false;
10232     }
10233     var arrStacked = stack.get(array2);
10234     var othStacked = stack.get(other2);
10235     if (arrStacked && othStacked) {
10236       return arrStacked == other2 && othStacked == array2;
10237     }
10238     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
10239     stack.set(array2, other2);
10240     stack.set(other2, array2);
10241     while (++index < arrLength) {
10242       var arrValue = array2[index], othValue = other2[index];
10243       if (customizer) {
10244         var compared = isPartial ? customizer(othValue, arrValue, index, other2, array2, stack) : customizer(arrValue, othValue, index, array2, other2, stack);
10245       }
10246       if (compared !== void 0) {
10247         if (compared) {
10248           continue;
10249         }
10250         result = false;
10251         break;
10252       }
10253       if (seen) {
10254         if (!arraySome_default(other2, function(othValue2, othIndex) {
10255           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
10256             return seen.push(othIndex);
10257           }
10258         })) {
10259           result = false;
10260           break;
10261         }
10262       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
10263         result = false;
10264         break;
10265       }
10266     }
10267     stack["delete"](array2);
10268     stack["delete"](other2);
10269     return result;
10270   }
10271   var COMPARE_PARTIAL_FLAG, COMPARE_UNORDERED_FLAG, equalArrays_default;
10272   var init_equalArrays = __esm({
10273     "node_modules/lodash-es/_equalArrays.js"() {
10274       init_SetCache();
10275       init_arraySome();
10276       init_cacheHas();
10277       COMPARE_PARTIAL_FLAG = 1;
10278       COMPARE_UNORDERED_FLAG = 2;
10279       equalArrays_default = equalArrays;
10280     }
10281   });
10282
10283   // node_modules/lodash-es/_mapToArray.js
10284   function mapToArray(map2) {
10285     var index = -1, result = Array(map2.size);
10286     map2.forEach(function(value, key) {
10287       result[++index] = [key, value];
10288     });
10289     return result;
10290   }
10291   var mapToArray_default;
10292   var init_mapToArray = __esm({
10293     "node_modules/lodash-es/_mapToArray.js"() {
10294       mapToArray_default = mapToArray;
10295     }
10296   });
10297
10298   // node_modules/lodash-es/_setToArray.js
10299   function setToArray(set4) {
10300     var index = -1, result = Array(set4.size);
10301     set4.forEach(function(value) {
10302       result[++index] = value;
10303     });
10304     return result;
10305   }
10306   var setToArray_default;
10307   var init_setToArray = __esm({
10308     "node_modules/lodash-es/_setToArray.js"() {
10309       setToArray_default = setToArray;
10310     }
10311   });
10312
10313   // node_modules/lodash-es/_equalByTag.js
10314   function equalByTag(object, other2, tag2, bitmask, customizer, equalFunc, stack) {
10315     switch (tag2) {
10316       case dataViewTag3:
10317         if (object.byteLength != other2.byteLength || object.byteOffset != other2.byteOffset) {
10318           return false;
10319         }
10320         object = object.buffer;
10321         other2 = other2.buffer;
10322       case arrayBufferTag2:
10323         if (object.byteLength != other2.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other2))) {
10324           return false;
10325         }
10326         return true;
10327       case boolTag2:
10328       case dateTag2:
10329       case numberTag2:
10330         return eq_default(+object, +other2);
10331       case errorTag2:
10332         return object.name == other2.name && object.message == other2.message;
10333       case regexpTag2:
10334       case stringTag2:
10335         return object == other2 + "";
10336       case mapTag3:
10337         var convert = mapToArray_default;
10338       case setTag3:
10339         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
10340         convert || (convert = setToArray_default);
10341         if (object.size != other2.size && !isPartial) {
10342           return false;
10343         }
10344         var stacked = stack.get(object);
10345         if (stacked) {
10346           return stacked == other2;
10347         }
10348         bitmask |= COMPARE_UNORDERED_FLAG2;
10349         stack.set(object, other2);
10350         var result = equalArrays_default(convert(object), convert(other2), bitmask, customizer, equalFunc, stack);
10351         stack["delete"](object);
10352         return result;
10353       case symbolTag2:
10354         if (symbolValueOf) {
10355           return symbolValueOf.call(object) == symbolValueOf.call(other2);
10356         }
10357     }
10358     return false;
10359   }
10360   var COMPARE_PARTIAL_FLAG2, COMPARE_UNORDERED_FLAG2, boolTag2, dateTag2, errorTag2, mapTag3, numberTag2, regexpTag2, setTag3, stringTag2, symbolTag2, arrayBufferTag2, dataViewTag3, symbolProto2, symbolValueOf, equalByTag_default;
10361   var init_equalByTag = __esm({
10362     "node_modules/lodash-es/_equalByTag.js"() {
10363       init_Symbol();
10364       init_Uint8Array();
10365       init_eq();
10366       init_equalArrays();
10367       init_mapToArray();
10368       init_setToArray();
10369       COMPARE_PARTIAL_FLAG2 = 1;
10370       COMPARE_UNORDERED_FLAG2 = 2;
10371       boolTag2 = "[object Boolean]";
10372       dateTag2 = "[object Date]";
10373       errorTag2 = "[object Error]";
10374       mapTag3 = "[object Map]";
10375       numberTag2 = "[object Number]";
10376       regexpTag2 = "[object RegExp]";
10377       setTag3 = "[object Set]";
10378       stringTag2 = "[object String]";
10379       symbolTag2 = "[object Symbol]";
10380       arrayBufferTag2 = "[object ArrayBuffer]";
10381       dataViewTag3 = "[object DataView]";
10382       symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
10383       symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
10384       equalByTag_default = equalByTag;
10385     }
10386   });
10387
10388   // node_modules/lodash-es/_equalObjects.js
10389   function equalObjects(object, other2, bitmask, customizer, equalFunc, stack) {
10390     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other2), othLength = othProps.length;
10391     if (objLength != othLength && !isPartial) {
10392       return false;
10393     }
10394     var index = objLength;
10395     while (index--) {
10396       var key = objProps[index];
10397       if (!(isPartial ? key in other2 : hasOwnProperty11.call(other2, key))) {
10398         return false;
10399       }
10400     }
10401     var objStacked = stack.get(object);
10402     var othStacked = stack.get(other2);
10403     if (objStacked && othStacked) {
10404       return objStacked == other2 && othStacked == object;
10405     }
10406     var result = true;
10407     stack.set(object, other2);
10408     stack.set(other2, object);
10409     var skipCtor = isPartial;
10410     while (++index < objLength) {
10411       key = objProps[index];
10412       var objValue = object[key], othValue = other2[key];
10413       if (customizer) {
10414         var compared = isPartial ? customizer(othValue, objValue, key, other2, object, stack) : customizer(objValue, othValue, key, object, other2, stack);
10415       }
10416       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
10417         result = false;
10418         break;
10419       }
10420       skipCtor || (skipCtor = key == "constructor");
10421     }
10422     if (result && !skipCtor) {
10423       var objCtor = object.constructor, othCtor = other2.constructor;
10424       if (objCtor != othCtor && ("constructor" in object && "constructor" in other2) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
10425         result = false;
10426       }
10427     }
10428     stack["delete"](object);
10429     stack["delete"](other2);
10430     return result;
10431   }
10432   var COMPARE_PARTIAL_FLAG3, objectProto14, hasOwnProperty11, equalObjects_default;
10433   var init_equalObjects = __esm({
10434     "node_modules/lodash-es/_equalObjects.js"() {
10435       init_getAllKeys();
10436       COMPARE_PARTIAL_FLAG3 = 1;
10437       objectProto14 = Object.prototype;
10438       hasOwnProperty11 = objectProto14.hasOwnProperty;
10439       equalObjects_default = equalObjects;
10440     }
10441   });
10442
10443   // node_modules/lodash-es/_baseIsEqualDeep.js
10444   function baseIsEqualDeep(object, other2, bitmask, customizer, equalFunc, stack) {
10445     var objIsArr = isArray_default(object), othIsArr = isArray_default(other2), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other2);
10446     objTag = objTag == argsTag3 ? objectTag4 : objTag;
10447     othTag = othTag == argsTag3 ? objectTag4 : othTag;
10448     var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
10449     if (isSameTag && isBuffer_default(object)) {
10450       if (!isBuffer_default(other2)) {
10451         return false;
10452       }
10453       objIsArr = true;
10454       objIsObj = false;
10455     }
10456     if (isSameTag && !objIsObj) {
10457       stack || (stack = new Stack_default());
10458       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other2, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other2, objTag, bitmask, customizer, equalFunc, stack);
10459     }
10460     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
10461       var objIsWrapped = objIsObj && hasOwnProperty12.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty12.call(other2, "__wrapped__");
10462       if (objIsWrapped || othIsWrapped) {
10463         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other2.value() : other2;
10464         stack || (stack = new Stack_default());
10465         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
10466       }
10467     }
10468     if (!isSameTag) {
10469       return false;
10470     }
10471     stack || (stack = new Stack_default());
10472     return equalObjects_default(object, other2, bitmask, customizer, equalFunc, stack);
10473   }
10474   var COMPARE_PARTIAL_FLAG4, argsTag3, arrayTag2, objectTag4, objectProto15, hasOwnProperty12, baseIsEqualDeep_default;
10475   var init_baseIsEqualDeep = __esm({
10476     "node_modules/lodash-es/_baseIsEqualDeep.js"() {
10477       init_Stack();
10478       init_equalArrays();
10479       init_equalByTag();
10480       init_equalObjects();
10481       init_getTag();
10482       init_isArray();
10483       init_isBuffer();
10484       init_isTypedArray();
10485       COMPARE_PARTIAL_FLAG4 = 1;
10486       argsTag3 = "[object Arguments]";
10487       arrayTag2 = "[object Array]";
10488       objectTag4 = "[object Object]";
10489       objectProto15 = Object.prototype;
10490       hasOwnProperty12 = objectProto15.hasOwnProperty;
10491       baseIsEqualDeep_default = baseIsEqualDeep;
10492     }
10493   });
10494
10495   // node_modules/lodash-es/_baseIsEqual.js
10496   function baseIsEqual(value, other2, bitmask, customizer, stack) {
10497     if (value === other2) {
10498       return true;
10499     }
10500     if (value == null || other2 == null || !isObjectLike_default(value) && !isObjectLike_default(other2)) {
10501       return value !== value && other2 !== other2;
10502     }
10503     return baseIsEqualDeep_default(value, other2, bitmask, customizer, baseIsEqual, stack);
10504   }
10505   var baseIsEqual_default;
10506   var init_baseIsEqual = __esm({
10507     "node_modules/lodash-es/_baseIsEqual.js"() {
10508       init_baseIsEqualDeep();
10509       init_isObjectLike();
10510       baseIsEqual_default = baseIsEqual;
10511     }
10512   });
10513
10514   // node_modules/lodash-es/_createBaseFor.js
10515   function createBaseFor(fromRight) {
10516     return function(object, iteratee, keysFunc) {
10517       var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
10518       while (length2--) {
10519         var key = props[fromRight ? length2 : ++index];
10520         if (iteratee(iterable[key], key, iterable) === false) {
10521           break;
10522         }
10523       }
10524       return object;
10525     };
10526   }
10527   var createBaseFor_default;
10528   var init_createBaseFor = __esm({
10529     "node_modules/lodash-es/_createBaseFor.js"() {
10530       createBaseFor_default = createBaseFor;
10531     }
10532   });
10533
10534   // node_modules/lodash-es/_baseFor.js
10535   var baseFor, baseFor_default;
10536   var init_baseFor = __esm({
10537     "node_modules/lodash-es/_baseFor.js"() {
10538       init_createBaseFor();
10539       baseFor = createBaseFor_default();
10540       baseFor_default = baseFor;
10541     }
10542   });
10543
10544   // node_modules/lodash-es/now.js
10545   var now2, now_default;
10546   var init_now = __esm({
10547     "node_modules/lodash-es/now.js"() {
10548       init_root();
10549       now2 = function() {
10550         return root_default.Date.now();
10551       };
10552       now_default = now2;
10553     }
10554   });
10555
10556   // node_modules/lodash-es/debounce.js
10557   function debounce(func, wait, options2) {
10558     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10559     if (typeof func != "function") {
10560       throw new TypeError(FUNC_ERROR_TEXT);
10561     }
10562     wait = toNumber_default(wait) || 0;
10563     if (isObject_default(options2)) {
10564       leading = !!options2.leading;
10565       maxing = "maxWait" in options2;
10566       maxWait = maxing ? nativeMax2(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
10567       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10568     }
10569     function invokeFunc(time) {
10570       var args = lastArgs, thisArg = lastThis;
10571       lastArgs = lastThis = void 0;
10572       lastInvokeTime = time;
10573       result = func.apply(thisArg, args);
10574       return result;
10575     }
10576     function leadingEdge(time) {
10577       lastInvokeTime = time;
10578       timerId = setTimeout(timerExpired, wait);
10579       return leading ? invokeFunc(time) : result;
10580     }
10581     function remainingWait(time) {
10582       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10583       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10584     }
10585     function shouldInvoke(time) {
10586       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10587       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10588     }
10589     function timerExpired() {
10590       var time = now_default();
10591       if (shouldInvoke(time)) {
10592         return trailingEdge(time);
10593       }
10594       timerId = setTimeout(timerExpired, remainingWait(time));
10595     }
10596     function trailingEdge(time) {
10597       timerId = void 0;
10598       if (trailing && lastArgs) {
10599         return invokeFunc(time);
10600       }
10601       lastArgs = lastThis = void 0;
10602       return result;
10603     }
10604     function cancel() {
10605       if (timerId !== void 0) {
10606         clearTimeout(timerId);
10607       }
10608       lastInvokeTime = 0;
10609       lastArgs = lastCallTime = lastThis = timerId = void 0;
10610     }
10611     function flush() {
10612       return timerId === void 0 ? result : trailingEdge(now_default());
10613     }
10614     function debounced() {
10615       var time = now_default(), isInvoking = shouldInvoke(time);
10616       lastArgs = arguments;
10617       lastThis = this;
10618       lastCallTime = time;
10619       if (isInvoking) {
10620         if (timerId === void 0) {
10621           return leadingEdge(lastCallTime);
10622         }
10623         if (maxing) {
10624           clearTimeout(timerId);
10625           timerId = setTimeout(timerExpired, wait);
10626           return invokeFunc(lastCallTime);
10627         }
10628       }
10629       if (timerId === void 0) {
10630         timerId = setTimeout(timerExpired, wait);
10631       }
10632       return result;
10633     }
10634     debounced.cancel = cancel;
10635     debounced.flush = flush;
10636     return debounced;
10637   }
10638   var FUNC_ERROR_TEXT, nativeMax2, nativeMin, debounce_default;
10639   var init_debounce = __esm({
10640     "node_modules/lodash-es/debounce.js"() {
10641       init_isObject();
10642       init_now();
10643       init_toNumber();
10644       FUNC_ERROR_TEXT = "Expected a function";
10645       nativeMax2 = Math.max;
10646       nativeMin = Math.min;
10647       debounce_default = debounce;
10648     }
10649   });
10650
10651   // node_modules/lodash-es/_assignMergeValue.js
10652   function assignMergeValue(object, key, value) {
10653     if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
10654       baseAssignValue_default(object, key, value);
10655     }
10656   }
10657   var assignMergeValue_default;
10658   var init_assignMergeValue = __esm({
10659     "node_modules/lodash-es/_assignMergeValue.js"() {
10660       init_baseAssignValue();
10661       init_eq();
10662       assignMergeValue_default = assignMergeValue;
10663     }
10664   });
10665
10666   // node_modules/lodash-es/isArrayLikeObject.js
10667   function isArrayLikeObject(value) {
10668     return isObjectLike_default(value) && isArrayLike_default(value);
10669   }
10670   var isArrayLikeObject_default;
10671   var init_isArrayLikeObject = __esm({
10672     "node_modules/lodash-es/isArrayLikeObject.js"() {
10673       init_isArrayLike();
10674       init_isObjectLike();
10675       isArrayLikeObject_default = isArrayLikeObject;
10676     }
10677   });
10678
10679   // node_modules/lodash-es/_safeGet.js
10680   function safeGet(object, key) {
10681     if (key === "constructor" && typeof object[key] === "function") {
10682       return;
10683     }
10684     if (key == "__proto__") {
10685       return;
10686     }
10687     return object[key];
10688   }
10689   var safeGet_default;
10690   var init_safeGet = __esm({
10691     "node_modules/lodash-es/_safeGet.js"() {
10692       safeGet_default = safeGet;
10693     }
10694   });
10695
10696   // node_modules/lodash-es/toPlainObject.js
10697   function toPlainObject(value) {
10698     return copyObject_default(value, keysIn_default(value));
10699   }
10700   var toPlainObject_default;
10701   var init_toPlainObject = __esm({
10702     "node_modules/lodash-es/toPlainObject.js"() {
10703       init_copyObject();
10704       init_keysIn();
10705       toPlainObject_default = toPlainObject;
10706     }
10707   });
10708
10709   // node_modules/lodash-es/_baseMergeDeep.js
10710   function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
10711     var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue);
10712     if (stacked) {
10713       assignMergeValue_default(object, key, stacked);
10714       return;
10715     }
10716     var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
10717     var isCommon = newValue === void 0;
10718     if (isCommon) {
10719       var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue);
10720       newValue = srcValue;
10721       if (isArr || isBuff || isTyped) {
10722         if (isArray_default(objValue)) {
10723           newValue = objValue;
10724         } else if (isArrayLikeObject_default(objValue)) {
10725           newValue = copyArray_default(objValue);
10726         } else if (isBuff) {
10727           isCommon = false;
10728           newValue = cloneBuffer_default(srcValue, true);
10729         } else if (isTyped) {
10730           isCommon = false;
10731           newValue = cloneTypedArray_default(srcValue, true);
10732         } else {
10733           newValue = [];
10734         }
10735       } else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) {
10736         newValue = objValue;
10737         if (isArguments_default(objValue)) {
10738           newValue = toPlainObject_default(objValue);
10739         } else if (!isObject_default(objValue) || isFunction_default(objValue)) {
10740           newValue = initCloneObject_default(srcValue);
10741         }
10742       } else {
10743         isCommon = false;
10744       }
10745     }
10746     if (isCommon) {
10747       stack.set(srcValue, newValue);
10748       mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
10749       stack["delete"](srcValue);
10750     }
10751     assignMergeValue_default(object, key, newValue);
10752   }
10753   var baseMergeDeep_default;
10754   var init_baseMergeDeep = __esm({
10755     "node_modules/lodash-es/_baseMergeDeep.js"() {
10756       init_assignMergeValue();
10757       init_cloneBuffer();
10758       init_cloneTypedArray();
10759       init_copyArray();
10760       init_initCloneObject();
10761       init_isArguments();
10762       init_isArray();
10763       init_isArrayLikeObject();
10764       init_isBuffer();
10765       init_isFunction();
10766       init_isObject();
10767       init_isPlainObject();
10768       init_isTypedArray();
10769       init_safeGet();
10770       init_toPlainObject();
10771       baseMergeDeep_default = baseMergeDeep;
10772     }
10773   });
10774
10775   // node_modules/lodash-es/_baseMerge.js
10776   function baseMerge(object, source, srcIndex, customizer, stack) {
10777     if (object === source) {
10778       return;
10779     }
10780     baseFor_default(source, function(srcValue, key) {
10781       stack || (stack = new Stack_default());
10782       if (isObject_default(srcValue)) {
10783         baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack);
10784       } else {
10785         var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0;
10786         if (newValue === void 0) {
10787           newValue = srcValue;
10788         }
10789         assignMergeValue_default(object, key, newValue);
10790       }
10791     }, keysIn_default);
10792   }
10793   var baseMerge_default;
10794   var init_baseMerge = __esm({
10795     "node_modules/lodash-es/_baseMerge.js"() {
10796       init_Stack();
10797       init_assignMergeValue();
10798       init_baseFor();
10799       init_baseMergeDeep();
10800       init_isObject();
10801       init_keysIn();
10802       init_safeGet();
10803       baseMerge_default = baseMerge;
10804     }
10805   });
10806
10807   // node_modules/lodash-es/_escapeHtmlChar.js
10808   var htmlEscapes, escapeHtmlChar, escapeHtmlChar_default;
10809   var init_escapeHtmlChar = __esm({
10810     "node_modules/lodash-es/_escapeHtmlChar.js"() {
10811       init_basePropertyOf();
10812       htmlEscapes = {
10813         "&": "&amp;",
10814         "<": "&lt;",
10815         ">": "&gt;",
10816         '"': "&quot;",
10817         "'": "&#39;"
10818       };
10819       escapeHtmlChar = basePropertyOf_default(htmlEscapes);
10820       escapeHtmlChar_default = escapeHtmlChar;
10821     }
10822   });
10823
10824   // node_modules/lodash-es/escape.js
10825   function escape2(string) {
10826     string = toString_default(string);
10827     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
10828   }
10829   var reUnescapedHtml, reHasUnescapedHtml, escape_default;
10830   var init_escape = __esm({
10831     "node_modules/lodash-es/escape.js"() {
10832       init_escapeHtmlChar();
10833       init_toString();
10834       reUnescapedHtml = /[&<>"']/g;
10835       reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
10836       escape_default = escape2;
10837     }
10838   });
10839
10840   // node_modules/lodash-es/isEqual.js
10841   function isEqual(value, other2) {
10842     return baseIsEqual_default(value, other2);
10843   }
10844   var isEqual_default;
10845   var init_isEqual = __esm({
10846     "node_modules/lodash-es/isEqual.js"() {
10847       init_baseIsEqual();
10848       isEqual_default = isEqual;
10849     }
10850   });
10851
10852   // node_modules/lodash-es/isNumber.js
10853   function isNumber(value) {
10854     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
10855   }
10856   var numberTag3, isNumber_default;
10857   var init_isNumber = __esm({
10858     "node_modules/lodash-es/isNumber.js"() {
10859       init_baseGetTag();
10860       init_isObjectLike();
10861       numberTag3 = "[object Number]";
10862       isNumber_default = isNumber;
10863     }
10864   });
10865
10866   // node_modules/lodash-es/merge.js
10867   var merge2, merge_default3;
10868   var init_merge4 = __esm({
10869     "node_modules/lodash-es/merge.js"() {
10870       init_baseMerge();
10871       init_createAssigner();
10872       merge2 = createAssigner_default(function(object, source, srcIndex) {
10873         baseMerge_default(object, source, srcIndex);
10874       });
10875       merge_default3 = merge2;
10876     }
10877   });
10878
10879   // node_modules/lodash-es/throttle.js
10880   function throttle(func, wait, options2) {
10881     var leading = true, trailing = true;
10882     if (typeof func != "function") {
10883       throw new TypeError(FUNC_ERROR_TEXT2);
10884     }
10885     if (isObject_default(options2)) {
10886       leading = "leading" in options2 ? !!options2.leading : leading;
10887       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10888     }
10889     return debounce_default(func, wait, {
10890       "leading": leading,
10891       "maxWait": wait,
10892       "trailing": trailing
10893     });
10894   }
10895   var FUNC_ERROR_TEXT2, throttle_default;
10896   var init_throttle = __esm({
10897     "node_modules/lodash-es/throttle.js"() {
10898       init_debounce();
10899       init_isObject();
10900       FUNC_ERROR_TEXT2 = "Expected a function";
10901       throttle_default = throttle;
10902     }
10903   });
10904
10905   // node_modules/lodash-es/_unescapeHtmlChar.js
10906   var htmlUnescapes, unescapeHtmlChar, unescapeHtmlChar_default;
10907   var init_unescapeHtmlChar = __esm({
10908     "node_modules/lodash-es/_unescapeHtmlChar.js"() {
10909       init_basePropertyOf();
10910       htmlUnescapes = {
10911         "&amp;": "&",
10912         "&lt;": "<",
10913         "&gt;": ">",
10914         "&quot;": '"',
10915         "&#39;": "'"
10916       };
10917       unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
10918       unescapeHtmlChar_default = unescapeHtmlChar;
10919     }
10920   });
10921
10922   // node_modules/lodash-es/unescape.js
10923   function unescape(string) {
10924     string = toString_default(string);
10925     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
10926   }
10927   var reEscapedHtml, reHasEscapedHtml, unescape_default;
10928   var init_unescape = __esm({
10929     "node_modules/lodash-es/unescape.js"() {
10930       init_toString();
10931       init_unescapeHtmlChar();
10932       reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
10933       reHasEscapedHtml = RegExp(reEscapedHtml.source);
10934       unescape_default = unescape;
10935     }
10936   });
10937
10938   // node_modules/lodash-es/lodash.js
10939   var init_lodash = __esm({
10940     "node_modules/lodash-es/lodash.js"() {
10941       init_escape();
10942       init_isArray();
10943       init_isEqual();
10944       init_isNumber();
10945       init_merge4();
10946       init_unescape();
10947     }
10948   });
10949
10950   // modules/osm/tags.js
10951   var tags_exports = {};
10952   __export(tags_exports, {
10953     allowUpperCaseTagValues: () => allowUpperCaseTagValues,
10954     isColourValid: () => isColourValid,
10955     osmAreaKeys: () => osmAreaKeys,
10956     osmAreaKeysExceptions: () => osmAreaKeysExceptions,
10957     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
10958     osmIsInterestingTag: () => osmIsInterestingTag,
10959     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
10960     osmLineTags: () => osmLineTags,
10961     osmMutuallyExclusiveTagPairs: () => osmMutuallyExclusiveTagPairs,
10962     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
10963     osmOneWayBackwardTags: () => osmOneWayBackwardTags,
10964     osmOneWayBiDirectionalTags: () => osmOneWayBiDirectionalTags,
10965     osmOneWayForwardTags: () => osmOneWayForwardTags,
10966     osmOneWayTags: () => osmOneWayTags,
10967     osmPathHighwayTagValues: () => osmPathHighwayTagValues,
10968     osmPavedTags: () => osmPavedTags,
10969     osmPointTags: () => osmPointTags,
10970     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
10971     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
10972     osmRightSideIsInsideTags: () => osmRightSideIsInsideTags,
10973     osmRoutableAerowayTags: () => osmRoutableAerowayTags,
10974     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
10975     osmSemipavedTags: () => osmSemipavedTags,
10976     osmSetAreaKeys: () => osmSetAreaKeys,
10977     osmSetLineTags: () => osmSetLineTags,
10978     osmSetPointTags: () => osmSetPointTags,
10979     osmSetVertexTags: () => osmSetVertexTags,
10980     osmShouldRenderDirection: () => osmShouldRenderDirection,
10981     osmSummableTags: () => osmSummableTags,
10982     osmTagSuggestingArea: () => osmTagSuggestingArea,
10983     osmVertexTags: () => osmVertexTags
10984   });
10985   function osmIsInterestingTag(key) {
10986     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
10987     key.indexOf("tiger:") !== 0;
10988   }
10989   function osmRemoveLifecyclePrefix(key) {
10990     const keySegments = key.split(":");
10991     if (keySegments.length === 1) return key;
10992     if (keySegments[0] in osmLifecyclePrefixes) {
10993       return key.slice(keySegments[0].length + 1);
10994     }
10995     return key;
10996   }
10997   function osmSetAreaKeys(value) {
10998     osmAreaKeys = value;
10999   }
11000   function osmTagSuggestingArea(tags) {
11001     if (tags.area === "yes") return { area: "yes" };
11002     if (tags.area === "no") return null;
11003     var returnTags = {};
11004     for (var realKey in tags) {
11005       const key = osmRemoveLifecyclePrefix(realKey);
11006       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
11007         returnTags[realKey] = tags[realKey];
11008         return returnTags;
11009       }
11010       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
11011         returnTags[realKey] = tags[realKey];
11012         return returnTags;
11013       }
11014     }
11015     return null;
11016   }
11017   function osmSetLineTags(value) {
11018     osmLineTags = value;
11019   }
11020   function osmSetPointTags(value) {
11021     osmPointTags = value;
11022   }
11023   function osmSetVertexTags(value) {
11024     osmVertexTags = value;
11025   }
11026   function osmNodeGeometriesForTags(nodeTags) {
11027     var geometries = {};
11028     for (var key in nodeTags) {
11029       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
11030         geometries.point = true;
11031       }
11032       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
11033         geometries.vertex = true;
11034       }
11035       if (geometries.point && geometries.vertex) break;
11036     }
11037     return geometries;
11038   }
11039   function isColourValid(value) {
11040     if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
11041       return false;
11042     }
11043     if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
11044       return false;
11045     }
11046     return true;
11047   }
11048   function osmShouldRenderDirection(vertexTags, wayTags) {
11049     if (vertexTags.highway || vertexTags.traffic_sign || vertexTags.traffic_calming || vertexTags.barrier) {
11050       return !!(wayTags.highway || wayTags.railway);
11051     }
11052     if (vertexTags.railway) return !!wayTags.railway;
11053     if (vertexTags.waterway) return !!wayTags.waterway;
11054     if (vertexTags.cycleway === "asl") return !!wayTags.highway;
11055     return true;
11056   }
11057   var osmLifecyclePrefixes, osmAreaKeys, osmAreaKeysExceptions, osmLineTags, osmPointTags, osmVertexTags, osmOneWayForwardTags, osmOneWayBackwardTags, osmOneWayBiDirectionalTags, osmOneWayTags, osmPavedTags, osmSemipavedTags, osmRightSideIsInsideTags, osmRoutableHighwayTagValues, osmRoutableAerowayTags, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmFlowingWaterwayTagValues, allowUpperCaseTagValues, osmMutuallyExclusiveTagPairs, osmSummableTags;
11058   var init_tags = __esm({
11059     "modules/osm/tags.js"() {
11060       "use strict";
11061       init_lodash();
11062       osmLifecyclePrefixes = {
11063         // nonexistent, might be built
11064         proposed: true,
11065         planned: true,
11066         // under maintenance or between groundbreaking and opening
11067         construction: true,
11068         // existent but not functional
11069         disused: true,
11070         // dilapidated to nonexistent
11071         abandoned: true,
11072         was: true,
11073         // nonexistent, still may appear in imagery
11074         dismantled: true,
11075         razed: true,
11076         demolished: true,
11077         destroyed: true,
11078         removed: true,
11079         obliterated: true,
11080         // existent occasionally, e.g. stormwater drainage basin
11081         intermittent: true
11082       };
11083       osmAreaKeys = {};
11084       osmAreaKeysExceptions = {
11085         highway: {
11086           elevator: true,
11087           rest_area: true,
11088           services: true
11089         },
11090         public_transport: {
11091           platform: true
11092         },
11093         railway: {
11094           platform: true,
11095           roundhouse: true,
11096           station: true,
11097           traverser: true,
11098           turntable: true,
11099           wash: true,
11100           ventilation_shaft: true
11101         },
11102         waterway: {
11103           dam: true
11104         },
11105         amenity: {
11106           bicycle_parking: true
11107         }
11108       };
11109       osmLineTags = {};
11110       osmPointTags = {};
11111       osmVertexTags = {};
11112       osmOneWayForwardTags = {
11113         "aerialway": {
11114           "chair_lift": true,
11115           "drag_lift": true,
11116           "j-bar": true,
11117           "magic_carpet": true,
11118           "mixed_lift": true,
11119           "platter": true,
11120           "rope_tow": true,
11121           "t-bar": true,
11122           "zip_line": true
11123         },
11124         "conveying": {
11125           "forward": true
11126         },
11127         "highway": {
11128           "motorway": true
11129         },
11130         "junction": {
11131           "circular": true,
11132           "roundabout": true
11133         },
11134         "man_made": {
11135           "goods_conveyor": true,
11136           "piste:halfpipe": true
11137         },
11138         "oneway": {
11139           "yes": true
11140         },
11141         "piste:type": {
11142           "downhill": true,
11143           "sled": true,
11144           "yes": true
11145         },
11146         "seamark:type": {
11147           "two-way_route": true,
11148           "recommended_traffic_lane": true,
11149           "separation_lane": true,
11150           "separation_roundabout": true
11151         },
11152         "waterway": {
11153           "canal": true,
11154           "ditch": true,
11155           "drain": true,
11156           "fish_pass": true,
11157           "flowline": true,
11158           "pressurised": true,
11159           "river": true,
11160           "spillway": true,
11161           "stream": true,
11162           "tidal_channel": true
11163         }
11164       };
11165       osmOneWayBackwardTags = {
11166         "conveying": {
11167           "backward": true
11168         },
11169         "oneway": {
11170           "-1": true
11171         }
11172       };
11173       osmOneWayBiDirectionalTags = {
11174         "conveying": {
11175           "reversible": true
11176         },
11177         "oneway": {
11178           "alternating": true,
11179           "reversible": true
11180         }
11181       };
11182       osmOneWayTags = merge_default3(
11183         osmOneWayForwardTags,
11184         osmOneWayBackwardTags,
11185         osmOneWayBiDirectionalTags
11186       );
11187       osmPavedTags = {
11188         "surface": {
11189           "paved": true,
11190           "asphalt": true,
11191           "concrete": true,
11192           "chipseal": true,
11193           "concrete:lanes": true,
11194           "concrete:plates": true
11195         },
11196         "tracktype": {
11197           "grade1": true
11198         }
11199       };
11200       osmSemipavedTags = {
11201         "surface": {
11202           "cobblestone": true,
11203           "cobblestone:flattened": true,
11204           "unhewn_cobblestone": true,
11205           "sett": true,
11206           "paving_stones": true,
11207           "metal": true,
11208           "wood": true
11209         }
11210       };
11211       osmRightSideIsInsideTags = {
11212         "natural": {
11213           "cliff": true,
11214           "coastline": "coastline"
11215         },
11216         "barrier": {
11217           "retaining_wall": true,
11218           "kerb": true,
11219           "guard_rail": true,
11220           "city_wall": true
11221         },
11222         "man_made": {
11223           "embankment": true,
11224           "quay": true
11225         },
11226         "waterway": {
11227           "weir": true
11228         }
11229       };
11230       osmRoutableHighwayTagValues = {
11231         motorway: true,
11232         trunk: true,
11233         primary: true,
11234         secondary: true,
11235         tertiary: true,
11236         residential: true,
11237         motorway_link: true,
11238         trunk_link: true,
11239         primary_link: true,
11240         secondary_link: true,
11241         tertiary_link: true,
11242         unclassified: true,
11243         road: true,
11244         service: true,
11245         track: true,
11246         living_street: true,
11247         bus_guideway: true,
11248         busway: true,
11249         path: true,
11250         footway: true,
11251         cycleway: true,
11252         bridleway: true,
11253         pedestrian: true,
11254         corridor: true,
11255         steps: true,
11256         ladder: true
11257       };
11258       osmRoutableAerowayTags = {
11259         runway: true,
11260         taxiway: true
11261       };
11262       osmPathHighwayTagValues = {
11263         path: true,
11264         footway: true,
11265         cycleway: true,
11266         bridleway: true,
11267         pedestrian: true,
11268         corridor: true,
11269         steps: true,
11270         ladder: true
11271       };
11272       osmRailwayTrackTagValues = {
11273         rail: true,
11274         light_rail: true,
11275         tram: true,
11276         subway: true,
11277         monorail: true,
11278         funicular: true,
11279         miniature: true,
11280         narrow_gauge: true,
11281         disused: true,
11282         preserved: true
11283       };
11284       osmFlowingWaterwayTagValues = {
11285         canal: true,
11286         ditch: true,
11287         drain: true,
11288         fish_pass: true,
11289         flowline: true,
11290         river: true,
11291         stream: true,
11292         tidal_channel: true
11293       };
11294       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/;
11295       osmMutuallyExclusiveTagPairs = [
11296         ["noname", "name"],
11297         ["noref", "ref"],
11298         ["nohousenumber", "addr:housenumber"],
11299         ["noaddress", "addr:housenumber"],
11300         ["noaddress", "addr:housename"],
11301         ["noaddress", "addr:unit"],
11302         ["addr:nostreet", "addr:street"]
11303       ];
11304       osmSummableTags = /* @__PURE__ */ new Set([
11305         "step_count",
11306         "parking:both:capacity",
11307         "parking:left:capacity",
11308         "parking:left:capacity"
11309       ]);
11310     }
11311   });
11312
11313   // modules/util/array.js
11314   var array_exports = {};
11315   __export(array_exports, {
11316     utilArrayChunk: () => utilArrayChunk,
11317     utilArrayDifference: () => utilArrayDifference,
11318     utilArrayFlatten: () => utilArrayFlatten,
11319     utilArrayGroupBy: () => utilArrayGroupBy,
11320     utilArrayIdentical: () => utilArrayIdentical,
11321     utilArrayIntersection: () => utilArrayIntersection,
11322     utilArrayUnion: () => utilArrayUnion,
11323     utilArrayUniq: () => utilArrayUniq,
11324     utilArrayUniqBy: () => utilArrayUniqBy
11325   });
11326   function utilArrayIdentical(a2, b2) {
11327     if (a2 === b2) return true;
11328     var i3 = a2.length;
11329     if (i3 !== b2.length) return false;
11330     while (i3--) {
11331       if (a2[i3] !== b2[i3]) return false;
11332     }
11333     return true;
11334   }
11335   function utilArrayDifference(a2, b2) {
11336     var other2 = new Set(b2);
11337     return Array.from(new Set(a2)).filter(function(v2) {
11338       return !other2.has(v2);
11339     });
11340   }
11341   function utilArrayIntersection(a2, b2) {
11342     var other2 = new Set(b2);
11343     return Array.from(new Set(a2)).filter(function(v2) {
11344       return other2.has(v2);
11345     });
11346   }
11347   function utilArrayUnion(a2, b2) {
11348     var result = new Set(a2);
11349     b2.forEach(function(v2) {
11350       result.add(v2);
11351     });
11352     return Array.from(result);
11353   }
11354   function utilArrayUniq(a2) {
11355     return Array.from(new Set(a2));
11356   }
11357   function utilArrayChunk(a2, chunkSize) {
11358     if (!chunkSize || chunkSize < 0) return [a2.slice()];
11359     var result = new Array(Math.ceil(a2.length / chunkSize));
11360     return Array.from(result, function(item, i3) {
11361       return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
11362     });
11363   }
11364   function utilArrayFlatten(a2) {
11365     return a2.reduce(function(acc, val) {
11366       return acc.concat(val);
11367     }, []);
11368   }
11369   function utilArrayGroupBy(a2, key) {
11370     return a2.reduce(function(acc, item) {
11371       var group = typeof key === "function" ? key(item) : item[key];
11372       (acc[group] = acc[group] || []).push(item);
11373       return acc;
11374     }, {});
11375   }
11376   function utilArrayUniqBy(a2, key) {
11377     var seen = /* @__PURE__ */ new Set();
11378     return a2.reduce(function(acc, item) {
11379       var val = typeof key === "function" ? key(item) : item[key];
11380       if (val && !seen.has(val)) {
11381         seen.add(val);
11382         acc.push(item);
11383       }
11384       return acc;
11385     }, []);
11386   }
11387   var init_array3 = __esm({
11388     "modules/util/array.js"() {
11389       "use strict";
11390     }
11391   });
11392
11393   // node_modules/diacritics/index.js
11394   var require_diacritics = __commonJS({
11395     "node_modules/diacritics/index.js"(exports2) {
11396       exports2.remove = removeDiacritics2;
11397       var replacementList = [
11398         {
11399           base: " ",
11400           chars: "\xA0"
11401         },
11402         {
11403           base: "0",
11404           chars: "\u07C0"
11405         },
11406         {
11407           base: "A",
11408           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"
11409         },
11410         {
11411           base: "AA",
11412           chars: "\uA732"
11413         },
11414         {
11415           base: "AE",
11416           chars: "\xC6\u01FC\u01E2"
11417         },
11418         {
11419           base: "AO",
11420           chars: "\uA734"
11421         },
11422         {
11423           base: "AU",
11424           chars: "\uA736"
11425         },
11426         {
11427           base: "AV",
11428           chars: "\uA738\uA73A"
11429         },
11430         {
11431           base: "AY",
11432           chars: "\uA73C"
11433         },
11434         {
11435           base: "B",
11436           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
11437         },
11438         {
11439           base: "C",
11440           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
11441         },
11442         {
11443           base: "D",
11444           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
11445         },
11446         {
11447           base: "Dh",
11448           chars: "\xD0"
11449         },
11450         {
11451           base: "DZ",
11452           chars: "\u01F1\u01C4"
11453         },
11454         {
11455           base: "Dz",
11456           chars: "\u01F2\u01C5"
11457         },
11458         {
11459           base: "E",
11460           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"
11461         },
11462         {
11463           base: "F",
11464           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
11465         },
11466         {
11467           base: "G",
11468           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
11469         },
11470         {
11471           base: "H",
11472           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
11473         },
11474         {
11475           base: "I",
11476           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
11477         },
11478         {
11479           base: "J",
11480           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
11481         },
11482         {
11483           base: "K",
11484           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
11485         },
11486         {
11487           base: "L",
11488           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
11489         },
11490         {
11491           base: "LJ",
11492           chars: "\u01C7"
11493         },
11494         {
11495           base: "Lj",
11496           chars: "\u01C8"
11497         },
11498         {
11499           base: "M",
11500           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
11501         },
11502         {
11503           base: "N",
11504           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
11505         },
11506         {
11507           base: "NJ",
11508           chars: "\u01CA"
11509         },
11510         {
11511           base: "Nj",
11512           chars: "\u01CB"
11513         },
11514         {
11515           base: "O",
11516           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"
11517         },
11518         {
11519           base: "OE",
11520           chars: "\u0152"
11521         },
11522         {
11523           base: "OI",
11524           chars: "\u01A2"
11525         },
11526         {
11527           base: "OO",
11528           chars: "\uA74E"
11529         },
11530         {
11531           base: "OU",
11532           chars: "\u0222"
11533         },
11534         {
11535           base: "P",
11536           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
11537         },
11538         {
11539           base: "Q",
11540           chars: "\u24C6\uFF31\uA756\uA758\u024A"
11541         },
11542         {
11543           base: "R",
11544           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
11545         },
11546         {
11547           base: "S",
11548           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
11549         },
11550         {
11551           base: "T",
11552           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
11553         },
11554         {
11555           base: "Th",
11556           chars: "\xDE"
11557         },
11558         {
11559           base: "TZ",
11560           chars: "\uA728"
11561         },
11562         {
11563           base: "U",
11564           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"
11565         },
11566         {
11567           base: "V",
11568           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
11569         },
11570         {
11571           base: "VY",
11572           chars: "\uA760"
11573         },
11574         {
11575           base: "W",
11576           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
11577         },
11578         {
11579           base: "X",
11580           chars: "\u24CD\uFF38\u1E8A\u1E8C"
11581         },
11582         {
11583           base: "Y",
11584           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
11585         },
11586         {
11587           base: "Z",
11588           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
11589         },
11590         {
11591           base: "a",
11592           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"
11593         },
11594         {
11595           base: "aa",
11596           chars: "\uA733"
11597         },
11598         {
11599           base: "ae",
11600           chars: "\xE6\u01FD\u01E3"
11601         },
11602         {
11603           base: "ao",
11604           chars: "\uA735"
11605         },
11606         {
11607           base: "au",
11608           chars: "\uA737"
11609         },
11610         {
11611           base: "av",
11612           chars: "\uA739\uA73B"
11613         },
11614         {
11615           base: "ay",
11616           chars: "\uA73D"
11617         },
11618         {
11619           base: "b",
11620           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
11621         },
11622         {
11623           base: "c",
11624           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
11625         },
11626         {
11627           base: "d",
11628           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
11629         },
11630         {
11631           base: "dh",
11632           chars: "\xF0"
11633         },
11634         {
11635           base: "dz",
11636           chars: "\u01F3\u01C6"
11637         },
11638         {
11639           base: "e",
11640           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"
11641         },
11642         {
11643           base: "f",
11644           chars: "\u24D5\uFF46\u1E1F\u0192"
11645         },
11646         {
11647           base: "ff",
11648           chars: "\uFB00"
11649         },
11650         {
11651           base: "fi",
11652           chars: "\uFB01"
11653         },
11654         {
11655           base: "fl",
11656           chars: "\uFB02"
11657         },
11658         {
11659           base: "ffi",
11660           chars: "\uFB03"
11661         },
11662         {
11663           base: "ffl",
11664           chars: "\uFB04"
11665         },
11666         {
11667           base: "g",
11668           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
11669         },
11670         {
11671           base: "h",
11672           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
11673         },
11674         {
11675           base: "hv",
11676           chars: "\u0195"
11677         },
11678         {
11679           base: "i",
11680           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
11681         },
11682         {
11683           base: "j",
11684           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
11685         },
11686         {
11687           base: "k",
11688           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
11689         },
11690         {
11691           base: "l",
11692           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
11693         },
11694         {
11695           base: "lj",
11696           chars: "\u01C9"
11697         },
11698         {
11699           base: "m",
11700           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
11701         },
11702         {
11703           base: "n",
11704           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
11705         },
11706         {
11707           base: "nj",
11708           chars: "\u01CC"
11709         },
11710         {
11711           base: "o",
11712           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"
11713         },
11714         {
11715           base: "oe",
11716           chars: "\u0153"
11717         },
11718         {
11719           base: "oi",
11720           chars: "\u01A3"
11721         },
11722         {
11723           base: "oo",
11724           chars: "\uA74F"
11725         },
11726         {
11727           base: "ou",
11728           chars: "\u0223"
11729         },
11730         {
11731           base: "p",
11732           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
11733         },
11734         {
11735           base: "q",
11736           chars: "\u24E0\uFF51\u024B\uA757\uA759"
11737         },
11738         {
11739           base: "r",
11740           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
11741         },
11742         {
11743           base: "s",
11744           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
11745         },
11746         {
11747           base: "ss",
11748           chars: "\xDF"
11749         },
11750         {
11751           base: "t",
11752           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
11753         },
11754         {
11755           base: "th",
11756           chars: "\xFE"
11757         },
11758         {
11759           base: "tz",
11760           chars: "\uA729"
11761         },
11762         {
11763           base: "u",
11764           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"
11765         },
11766         {
11767           base: "v",
11768           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
11769         },
11770         {
11771           base: "vy",
11772           chars: "\uA761"
11773         },
11774         {
11775           base: "w",
11776           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
11777         },
11778         {
11779           base: "x",
11780           chars: "\u24E7\uFF58\u1E8B\u1E8D"
11781         },
11782         {
11783           base: "y",
11784           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
11785         },
11786         {
11787           base: "z",
11788           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
11789         }
11790       ];
11791       var diacriticsMap = {};
11792       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
11793         chars = replacementList[i3].chars;
11794         for (j2 = 0; j2 < chars.length; j2 += 1) {
11795           diacriticsMap[chars[j2]] = replacementList[i3].base;
11796         }
11797       }
11798       var chars;
11799       var j2;
11800       var i3;
11801       function removeDiacritics2(str) {
11802         return str.replace(/[^\u0000-\u007e]/g, function(c2) {
11803           return diacriticsMap[c2] || c2;
11804         });
11805       }
11806       exports2.replacementList = replacementList;
11807       exports2.diacriticsMap = diacriticsMap;
11808     }
11809   });
11810
11811   // node_modules/alif-toolkit/lib/isArabic.js
11812   var require_isArabic = __commonJS({
11813     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
11814       "use strict";
11815       Object.defineProperty(exports2, "__esModule", { value: true });
11816       exports2.isArabic = isArabic;
11817       exports2.isMath = isMath;
11818       var arabicBlocks = [
11819         [1536, 1791],
11820         // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
11821         [1872, 1919],
11822         // supplement https://www.unicode.org/charts/PDF/U0750.pdf
11823         [2208, 2303],
11824         // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
11825         [64336, 65023],
11826         // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
11827         [65136, 65279],
11828         // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
11829         [69216, 69247],
11830         // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
11831         [126064, 126143],
11832         // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
11833         [126464, 126719]
11834         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
11835       ];
11836       function isArabic(char) {
11837         if (char.length > 1) {
11838           throw new Error("isArabic works on only one-character strings");
11839         }
11840         let code = char.charCodeAt(0);
11841         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
11842           let block2 = arabicBlocks[i3];
11843           if (code >= block2[0] && code <= block2[1]) {
11844             return true;
11845           }
11846         }
11847         return false;
11848       }
11849       function isMath(char) {
11850         if (char.length > 2) {
11851           throw new Error("isMath works on only one-character strings");
11852         }
11853         let code = char.charCodeAt(0);
11854         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
11855       }
11856     }
11857   });
11858
11859   // node_modules/alif-toolkit/lib/unicode-arabic.js
11860   var require_unicode_arabic = __commonJS({
11861     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
11862       "use strict";
11863       Object.defineProperty(exports2, "__esModule", { value: true });
11864       var arabicReference = {
11865         "alef": {
11866           "normal": [
11867             "\u0627"
11868           ],
11869           "madda_above": {
11870             "normal": [
11871               "\u0627\u0653",
11872               "\u0622"
11873             ],
11874             "isolated": "\uFE81",
11875             "final": "\uFE82"
11876           },
11877           "hamza_above": {
11878             "normal": [
11879               "\u0627\u0654",
11880               "\u0623"
11881             ],
11882             "isolated": "\uFE83",
11883             "final": "\uFE84"
11884           },
11885           "hamza_below": {
11886             "normal": [
11887               "\u0627\u0655",
11888               "\u0625"
11889             ],
11890             "isolated": "\uFE87",
11891             "final": "\uFE88"
11892           },
11893           "wasla": {
11894             "normal": "\u0671",
11895             "isolated": "\uFB50",
11896             "final": "\uFB51"
11897           },
11898           "wavy_hamza_above": [
11899             "\u0672"
11900           ],
11901           "wavy_hamza_below": [
11902             "\u0627\u065F",
11903             "\u0673"
11904           ],
11905           "high_hamza": [
11906             "\u0675",
11907             "\u0627\u0674"
11908           ],
11909           "indic_two_above": [
11910             "\u0773"
11911           ],
11912           "indic_three_above": [
11913             "\u0774"
11914           ],
11915           "fathatan": {
11916             "normal": [
11917               "\u0627\u064B"
11918             ],
11919             "final": "\uFD3C",
11920             "isolated": "\uFD3D"
11921           },
11922           "isolated": "\uFE8D",
11923           "final": "\uFE8E"
11924         },
11925         "beh": {
11926           "normal": [
11927             "\u0628"
11928           ],
11929           "dotless": [
11930             "\u066E"
11931           ],
11932           "three_dots_horizontally_below": [
11933             "\u0750"
11934           ],
11935           "dot_below_three_dots_above": [
11936             "\u0751"
11937           ],
11938           "three_dots_pointing_upwards_below": [
11939             "\u0752"
11940           ],
11941           "three_dots_pointing_upwards_below_two_dots_above": [
11942             "\u0753"
11943           ],
11944           "two_dots_below_dot_above": [
11945             "\u0754"
11946           ],
11947           "inverted_small_v_below": [
11948             "\u0755"
11949           ],
11950           "small_v": [
11951             "\u0756"
11952           ],
11953           "small_v_below": [
11954             "\u08A0"
11955           ],
11956           "hamza_above": [
11957             "\u08A1"
11958           ],
11959           "small_meem_above": [
11960             "\u08B6"
11961           ],
11962           "isolated": "\uFE8F",
11963           "final": "\uFE90",
11964           "initial": "\uFE91",
11965           "medial": "\uFE92"
11966         },
11967         "teh marbuta": {
11968           "normal": [
11969             "\u0629"
11970           ],
11971           "isolated": "\uFE93",
11972           "final": "\uFE94"
11973         },
11974         "teh": {
11975           "normal": [
11976             "\u062A"
11977           ],
11978           "ring": [
11979             "\u067C"
11980           ],
11981           "three_dots_above_downwards": [
11982             "\u067D"
11983           ],
11984           "small_teh_above": [
11985             "\u08B8"
11986           ],
11987           "isolated": "\uFE95",
11988           "final": "\uFE96",
11989           "initial": "\uFE97",
11990           "medial": "\uFE98"
11991         },
11992         "theh": {
11993           "normal": [
11994             "\u062B"
11995           ],
11996           "isolated": "\uFE99",
11997           "final": "\uFE9A",
11998           "initial": "\uFE9B",
11999           "medial": "\uFE9C"
12000         },
12001         "jeem": {
12002           "normal": [
12003             "\u062C"
12004           ],
12005           "two_dots_above": [
12006             "\u08A2"
12007           ],
12008           "isolated": "\uFE9D",
12009           "final": "\uFE9E",
12010           "initial": "\uFE9F",
12011           "medial": "\uFEA0"
12012         },
12013         "hah": {
12014           "normal": [
12015             "\u062D"
12016           ],
12017           "hamza_above": [
12018             "\u0681"
12019           ],
12020           "two_dots_vertical_above": [
12021             "\u0682"
12022           ],
12023           "three_dots_above": [
12024             "\u0685"
12025           ],
12026           "two_dots_above": [
12027             "\u0757"
12028           ],
12029           "three_dots_pointing_upwards_below": [
12030             "\u0758"
12031           ],
12032           "small_tah_below": [
12033             "\u076E"
12034           ],
12035           "small_tah_two_dots": [
12036             "\u076F"
12037           ],
12038           "small_tah_above": [
12039             "\u0772"
12040           ],
12041           "indic_four_below": [
12042             "\u077C"
12043           ],
12044           "isolated": "\uFEA1",
12045           "final": "\uFEA2",
12046           "initial": "\uFEA3",
12047           "medial": "\uFEA4"
12048         },
12049         "khah": {
12050           "normal": [
12051             "\u062E"
12052           ],
12053           "isolated": "\uFEA5",
12054           "final": "\uFEA6",
12055           "initial": "\uFEA7",
12056           "medial": "\uFEA8"
12057         },
12058         "dal": {
12059           "normal": [
12060             "\u062F"
12061           ],
12062           "ring": [
12063             "\u0689"
12064           ],
12065           "dot_below": [
12066             "\u068A"
12067           ],
12068           "dot_below_small_tah": [
12069             "\u068B"
12070           ],
12071           "three_dots_above_downwards": [
12072             "\u068F"
12073           ],
12074           "four_dots_above": [
12075             "\u0690"
12076           ],
12077           "inverted_v": [
12078             "\u06EE"
12079           ],
12080           "two_dots_vertically_below_small_tah": [
12081             "\u0759"
12082           ],
12083           "inverted_small_v_below": [
12084             "\u075A"
12085           ],
12086           "three_dots_below": [
12087             "\u08AE"
12088           ],
12089           "isolated": "\uFEA9",
12090           "final": "\uFEAA"
12091         },
12092         "thal": {
12093           "normal": [
12094             "\u0630"
12095           ],
12096           "isolated": "\uFEAB",
12097           "final": "\uFEAC"
12098         },
12099         "reh": {
12100           "normal": [
12101             "\u0631"
12102           ],
12103           "small_v": [
12104             "\u0692"
12105           ],
12106           "ring": [
12107             "\u0693"
12108           ],
12109           "dot_below": [
12110             "\u0694"
12111           ],
12112           "small_v_below": [
12113             "\u0695"
12114           ],
12115           "dot_below_dot_above": [
12116             "\u0696"
12117           ],
12118           "two_dots_above": [
12119             "\u0697"
12120           ],
12121           "four_dots_above": [
12122             "\u0699"
12123           ],
12124           "inverted_v": [
12125             "\u06EF"
12126           ],
12127           "stroke": [
12128             "\u075B"
12129           ],
12130           "two_dots_vertically_above": [
12131             "\u076B"
12132           ],
12133           "hamza_above": [
12134             "\u076C"
12135           ],
12136           "small_tah_two_dots": [
12137             "\u0771"
12138           ],
12139           "loop": [
12140             "\u08AA"
12141           ],
12142           "small_noon_above": [
12143             "\u08B9"
12144           ],
12145           "isolated": "\uFEAD",
12146           "final": "\uFEAE"
12147         },
12148         "zain": {
12149           "normal": [
12150             "\u0632"
12151           ],
12152           "inverted_v_above": [
12153             "\u08B2"
12154           ],
12155           "isolated": "\uFEAF",
12156           "final": "\uFEB0"
12157         },
12158         "seen": {
12159           "normal": [
12160             "\u0633"
12161           ],
12162           "dot_below_dot_above": [
12163             "\u069A"
12164           ],
12165           "three_dots_below": [
12166             "\u069B"
12167           ],
12168           "three_dots_below_three_dots_above": [
12169             "\u069C"
12170           ],
12171           "four_dots_above": [
12172             "\u075C"
12173           ],
12174           "two_dots_vertically_above": [
12175             "\u076D"
12176           ],
12177           "small_tah_two_dots": [
12178             "\u0770"
12179           ],
12180           "indic_four_above": [
12181             "\u077D"
12182           ],
12183           "inverted_v": [
12184             "\u077E"
12185           ],
12186           "isolated": "\uFEB1",
12187           "final": "\uFEB2",
12188           "initial": "\uFEB3",
12189           "medial": "\uFEB4"
12190         },
12191         "sheen": {
12192           "normal": [
12193             "\u0634"
12194           ],
12195           "dot_below": [
12196             "\u06FA"
12197           ],
12198           "isolated": "\uFEB5",
12199           "final": "\uFEB6",
12200           "initial": "\uFEB7",
12201           "medial": "\uFEB8"
12202         },
12203         "sad": {
12204           "normal": [
12205             "\u0635"
12206           ],
12207           "two_dots_below": [
12208             "\u069D"
12209           ],
12210           "three_dots_above": [
12211             "\u069E"
12212           ],
12213           "three_dots_below": [
12214             "\u08AF"
12215           ],
12216           "isolated": "\uFEB9",
12217           "final": "\uFEBA",
12218           "initial": "\uFEBB",
12219           "medial": "\uFEBC"
12220         },
12221         "dad": {
12222           "normal": [
12223             "\u0636"
12224           ],
12225           "dot_below": [
12226             "\u06FB"
12227           ],
12228           "isolated": "\uFEBD",
12229           "final": "\uFEBE",
12230           "initial": "\uFEBF",
12231           "medial": "\uFEC0"
12232         },
12233         "tah": {
12234           "normal": [
12235             "\u0637"
12236           ],
12237           "three_dots_above": [
12238             "\u069F"
12239           ],
12240           "two_dots_above": [
12241             "\u08A3"
12242           ],
12243           "isolated": "\uFEC1",
12244           "final": "\uFEC2",
12245           "initial": "\uFEC3",
12246           "medial": "\uFEC4"
12247         },
12248         "zah": {
12249           "normal": [
12250             "\u0638"
12251           ],
12252           "isolated": "\uFEC5",
12253           "final": "\uFEC6",
12254           "initial": "\uFEC7",
12255           "medial": "\uFEC8"
12256         },
12257         "ain": {
12258           "normal": [
12259             "\u0639"
12260           ],
12261           "three_dots_above": [
12262             "\u06A0"
12263           ],
12264           "two_dots_above": [
12265             "\u075D"
12266           ],
12267           "three_dots_pointing_downwards_above": [
12268             "\u075E"
12269           ],
12270           "two_dots_vertically_above": [
12271             "\u075F"
12272           ],
12273           "three_dots_below": [
12274             "\u08B3"
12275           ],
12276           "isolated": "\uFEC9",
12277           "final": "\uFECA",
12278           "initial": "\uFECB",
12279           "medial": "\uFECC"
12280         },
12281         "ghain": {
12282           "normal": [
12283             "\u063A"
12284           ],
12285           "dot_below": [
12286             "\u06FC"
12287           ],
12288           "isolated": "\uFECD",
12289           "final": "\uFECE",
12290           "initial": "\uFECF",
12291           "medial": "\uFED0"
12292         },
12293         "feh": {
12294           "normal": [
12295             "\u0641"
12296           ],
12297           "dotless": [
12298             "\u06A1"
12299           ],
12300           "dot_moved_below": [
12301             "\u06A2"
12302           ],
12303           "dot_below": [
12304             "\u06A3"
12305           ],
12306           "three_dots_below": [
12307             "\u06A5"
12308           ],
12309           "two_dots_below": [
12310             "\u0760"
12311           ],
12312           "three_dots_pointing_upwards_below": [
12313             "\u0761"
12314           ],
12315           "dot_below_three_dots_above": [
12316             "\u08A4"
12317           ],
12318           "isolated": "\uFED1",
12319           "final": "\uFED2",
12320           "initial": "\uFED3",
12321           "medial": "\uFED4"
12322         },
12323         "qaf": {
12324           "normal": [
12325             "\u0642"
12326           ],
12327           "dotless": [
12328             "\u066F"
12329           ],
12330           "dot_above": [
12331             "\u06A7"
12332           ],
12333           "three_dots_above": [
12334             "\u06A8"
12335           ],
12336           "dot_below": [
12337             "\u08A5"
12338           ],
12339           "isolated": "\uFED5",
12340           "final": "\uFED6",
12341           "initial": "\uFED7",
12342           "medial": "\uFED8"
12343         },
12344         "kaf": {
12345           "normal": [
12346             "\u0643"
12347           ],
12348           "swash": [
12349             "\u06AA"
12350           ],
12351           "ring": [
12352             "\u06AB"
12353           ],
12354           "dot_above": [
12355             "\u06AC"
12356           ],
12357           "three_dots_below": [
12358             "\u06AE"
12359           ],
12360           "two_dots_above": [
12361             "\u077F"
12362           ],
12363           "dot_below": [
12364             "\u08B4"
12365           ],
12366           "isolated": "\uFED9",
12367           "final": "\uFEDA",
12368           "initial": "\uFEDB",
12369           "medial": "\uFEDC"
12370         },
12371         "lam": {
12372           "normal": [
12373             "\u0644"
12374           ],
12375           "small_v": [
12376             "\u06B5"
12377           ],
12378           "dot_above": [
12379             "\u06B6"
12380           ],
12381           "three_dots_above": [
12382             "\u06B7"
12383           ],
12384           "three_dots_below": [
12385             "\u06B8"
12386           ],
12387           "bar": [
12388             "\u076A"
12389           ],
12390           "double_bar": [
12391             "\u08A6"
12392           ],
12393           "isolated": "\uFEDD",
12394           "final": "\uFEDE",
12395           "initial": "\uFEDF",
12396           "medial": "\uFEE0"
12397         },
12398         "meem": {
12399           "normal": [
12400             "\u0645"
12401           ],
12402           "dot_above": [
12403             "\u0765"
12404           ],
12405           "dot_below": [
12406             "\u0766"
12407           ],
12408           "three_dots_above": [
12409             "\u08A7"
12410           ],
12411           "isolated": "\uFEE1",
12412           "final": "\uFEE2",
12413           "initial": "\uFEE3",
12414           "medial": "\uFEE4"
12415         },
12416         "noon": {
12417           "normal": [
12418             "\u0646"
12419           ],
12420           "dot_below": [
12421             "\u06B9"
12422           ],
12423           "ring": [
12424             "\u06BC"
12425           ],
12426           "three_dots_above": [
12427             "\u06BD"
12428           ],
12429           "two_dots_below": [
12430             "\u0767"
12431           ],
12432           "small_tah": [
12433             "\u0768"
12434           ],
12435           "small_v": [
12436             "\u0769"
12437           ],
12438           "isolated": "\uFEE5",
12439           "final": "\uFEE6",
12440           "initial": "\uFEE7",
12441           "medial": "\uFEE8"
12442         },
12443         "heh": {
12444           "normal": [
12445             "\u0647"
12446           ],
12447           "isolated": "\uFEE9",
12448           "final": "\uFEEA",
12449           "initial": "\uFEEB",
12450           "medial": "\uFEEC"
12451         },
12452         "waw": {
12453           "normal": [
12454             "\u0648"
12455           ],
12456           "hamza_above": {
12457             "normal": [
12458               "\u0624",
12459               "\u0648\u0654"
12460             ],
12461             "isolated": "\uFE85",
12462             "final": "\uFE86"
12463           },
12464           "high_hamza": [
12465             "\u0676",
12466             "\u0648\u0674"
12467           ],
12468           "ring": [
12469             "\u06C4"
12470           ],
12471           "two_dots_above": [
12472             "\u06CA"
12473           ],
12474           "dot_above": [
12475             "\u06CF"
12476           ],
12477           "indic_two_above": [
12478             "\u0778"
12479           ],
12480           "indic_three_above": [
12481             "\u0779"
12482           ],
12483           "dot_within": [
12484             "\u08AB"
12485           ],
12486           "isolated": "\uFEED",
12487           "final": "\uFEEE"
12488         },
12489         "alef_maksura": {
12490           "normal": [
12491             "\u0649"
12492           ],
12493           "hamza_above": [
12494             "\u0626",
12495             "\u064A\u0654"
12496           ],
12497           "initial": "\uFBE8",
12498           "medial": "\uFBE9",
12499           "isolated": "\uFEEF",
12500           "final": "\uFEF0"
12501         },
12502         "yeh": {
12503           "normal": [
12504             "\u064A"
12505           ],
12506           "hamza_above": {
12507             "normal": [
12508               "\u0626",
12509               "\u0649\u0654"
12510             ],
12511             "isolated": "\uFE89",
12512             "final": "\uFE8A",
12513             "initial": "\uFE8B",
12514             "medial": "\uFE8C"
12515           },
12516           "two_dots_below_hamza_above": [
12517             "\u08A8"
12518           ],
12519           "high_hamza": [
12520             "\u0678",
12521             "\u064A\u0674"
12522           ],
12523           "tail": [
12524             "\u06CD"
12525           ],
12526           "small_v": [
12527             "\u06CE"
12528           ],
12529           "three_dots_below": [
12530             "\u06D1"
12531           ],
12532           "two_dots_below_dot_above": [
12533             "\u08A9"
12534           ],
12535           "two_dots_below_small_noon_above": [
12536             "\u08BA"
12537           ],
12538           "isolated": "\uFEF1",
12539           "final": "\uFEF2",
12540           "initial": "\uFEF3",
12541           "medial": "\uFEF4"
12542         },
12543         "tteh": {
12544           "normal": [
12545             "\u0679"
12546           ],
12547           "isolated": "\uFB66",
12548           "final": "\uFB67",
12549           "initial": "\uFB68",
12550           "medial": "\uFB69"
12551         },
12552         "tteheh": {
12553           "normal": [
12554             "\u067A"
12555           ],
12556           "isolated": "\uFB5E",
12557           "final": "\uFB5F",
12558           "initial": "\uFB60",
12559           "medial": "\uFB61"
12560         },
12561         "beeh": {
12562           "normal": [
12563             "\u067B"
12564           ],
12565           "isolated": "\uFB52",
12566           "final": "\uFB53",
12567           "initial": "\uFB54",
12568           "medial": "\uFB55"
12569         },
12570         "peh": {
12571           "normal": [
12572             "\u067E"
12573           ],
12574           "small_meem_above": [
12575             "\u08B7"
12576           ],
12577           "isolated": "\uFB56",
12578           "final": "\uFB57",
12579           "initial": "\uFB58",
12580           "medial": "\uFB59"
12581         },
12582         "teheh": {
12583           "normal": [
12584             "\u067F"
12585           ],
12586           "isolated": "\uFB62",
12587           "final": "\uFB63",
12588           "initial": "\uFB64",
12589           "medial": "\uFB65"
12590         },
12591         "beheh": {
12592           "normal": [
12593             "\u0680"
12594           ],
12595           "isolated": "\uFB5A",
12596           "final": "\uFB5B",
12597           "initial": "\uFB5C",
12598           "medial": "\uFB5D"
12599         },
12600         "nyeh": {
12601           "normal": [
12602             "\u0683"
12603           ],
12604           "isolated": "\uFB76",
12605           "final": "\uFB77",
12606           "initial": "\uFB78",
12607           "medial": "\uFB79"
12608         },
12609         "dyeh": {
12610           "normal": [
12611             "\u0684"
12612           ],
12613           "isolated": "\uFB72",
12614           "final": "\uFB73",
12615           "initial": "\uFB74",
12616           "medial": "\uFB75"
12617         },
12618         "tcheh": {
12619           "normal": [
12620             "\u0686"
12621           ],
12622           "dot_above": [
12623             "\u06BF"
12624           ],
12625           "isolated": "\uFB7A",
12626           "final": "\uFB7B",
12627           "initial": "\uFB7C",
12628           "medial": "\uFB7D"
12629         },
12630         "tcheheh": {
12631           "normal": [
12632             "\u0687"
12633           ],
12634           "isolated": "\uFB7E",
12635           "final": "\uFB7F",
12636           "initial": "\uFB80",
12637           "medial": "\uFB81"
12638         },
12639         "ddal": {
12640           "normal": [
12641             "\u0688"
12642           ],
12643           "isolated": "\uFB88",
12644           "final": "\uFB89"
12645         },
12646         "dahal": {
12647           "normal": [
12648             "\u068C"
12649           ],
12650           "isolated": "\uFB84",
12651           "final": "\uFB85"
12652         },
12653         "ddahal": {
12654           "normal": [
12655             "\u068D"
12656           ],
12657           "isolated": "\uFB82",
12658           "final": "\uFB83"
12659         },
12660         "dul": {
12661           "normal": [
12662             "\u068F",
12663             "\u068E"
12664           ],
12665           "isolated": "\uFB86",
12666           "final": "\uFB87"
12667         },
12668         "rreh": {
12669           "normal": [
12670             "\u0691"
12671           ],
12672           "isolated": "\uFB8C",
12673           "final": "\uFB8D"
12674         },
12675         "jeh": {
12676           "normal": [
12677             "\u0698"
12678           ],
12679           "isolated": "\uFB8A",
12680           "final": "\uFB8B"
12681         },
12682         "veh": {
12683           "normal": [
12684             "\u06A4"
12685           ],
12686           "isolated": "\uFB6A",
12687           "final": "\uFB6B",
12688           "initial": "\uFB6C",
12689           "medial": "\uFB6D"
12690         },
12691         "peheh": {
12692           "normal": [
12693             "\u06A6"
12694           ],
12695           "isolated": "\uFB6E",
12696           "final": "\uFB6F",
12697           "initial": "\uFB70",
12698           "medial": "\uFB71"
12699         },
12700         "keheh": {
12701           "normal": [
12702             "\u06A9"
12703           ],
12704           "dot_above": [
12705             "\u0762"
12706           ],
12707           "three_dots_above": [
12708             "\u0763"
12709           ],
12710           "three_dots_pointing_upwards_below": [
12711             "\u0764"
12712           ],
12713           "isolated": "\uFB8E",
12714           "final": "\uFB8F",
12715           "initial": "\uFB90",
12716           "medial": "\uFB91"
12717         },
12718         "ng": {
12719           "normal": [
12720             "\u06AD"
12721           ],
12722           "isolated": "\uFBD3",
12723           "final": "\uFBD4",
12724           "initial": "\uFBD5",
12725           "medial": "\uFBD6"
12726         },
12727         "gaf": {
12728           "normal": [
12729             "\u06AF"
12730           ],
12731           "ring": [
12732             "\u06B0"
12733           ],
12734           "two_dots_below": [
12735             "\u06B2"
12736           ],
12737           "three_dots_above": [
12738             "\u06B4"
12739           ],
12740           "inverted_stroke": [
12741             "\u08B0"
12742           ],
12743           "isolated": "\uFB92",
12744           "final": "\uFB93",
12745           "initial": "\uFB94",
12746           "medial": "\uFB95"
12747         },
12748         "ngoeh": {
12749           "normal": [
12750             "\u06B1"
12751           ],
12752           "isolated": "\uFB9A",
12753           "final": "\uFB9B",
12754           "initial": "\uFB9C",
12755           "medial": "\uFB9D"
12756         },
12757         "gueh": {
12758           "normal": [
12759             "\u06B3"
12760           ],
12761           "isolated": "\uFB96",
12762           "final": "\uFB97",
12763           "initial": "\uFB98",
12764           "medial": "\uFB99"
12765         },
12766         "noon ghunna": {
12767           "normal": [
12768             "\u06BA"
12769           ],
12770           "isolated": "\uFB9E",
12771           "final": "\uFB9F"
12772         },
12773         "rnoon": {
12774           "normal": [
12775             "\u06BB"
12776           ],
12777           "isolated": "\uFBA0",
12778           "final": "\uFBA1",
12779           "initial": "\uFBA2",
12780           "medial": "\uFBA3"
12781         },
12782         "heh doachashmee": {
12783           "normal": [
12784             "\u06BE"
12785           ],
12786           "isolated": "\uFBAA",
12787           "final": "\uFBAB",
12788           "initial": "\uFBAC",
12789           "medial": "\uFBAD"
12790         },
12791         "heh goal": {
12792           "normal": [
12793             "\u06C1"
12794           ],
12795           "hamza_above": [
12796             "\u06C1\u0654",
12797             "\u06C2"
12798           ],
12799           "isolated": "\uFBA6",
12800           "final": "\uFBA7",
12801           "initial": "\uFBA8",
12802           "medial": "\uFBA9"
12803         },
12804         "teh marbuta goal": {
12805           "normal": [
12806             "\u06C3"
12807           ]
12808         },
12809         "kirghiz oe": {
12810           "normal": [
12811             "\u06C5"
12812           ],
12813           "isolated": "\uFBE0",
12814           "final": "\uFBE1"
12815         },
12816         "oe": {
12817           "normal": [
12818             "\u06C6"
12819           ],
12820           "isolated": "\uFBD9",
12821           "final": "\uFBDA"
12822         },
12823         "u": {
12824           "normal": [
12825             "\u06C7"
12826           ],
12827           "hamza_above": {
12828             "normal": [
12829               "\u0677",
12830               "\u06C7\u0674"
12831             ],
12832             "isolated": "\uFBDD"
12833           },
12834           "isolated": "\uFBD7",
12835           "final": "\uFBD8"
12836         },
12837         "yu": {
12838           "normal": [
12839             "\u06C8"
12840           ],
12841           "isolated": "\uFBDB",
12842           "final": "\uFBDC"
12843         },
12844         "kirghiz yu": {
12845           "normal": [
12846             "\u06C9"
12847           ],
12848           "isolated": "\uFBE2",
12849           "final": "\uFBE3"
12850         },
12851         "ve": {
12852           "normal": [
12853             "\u06CB"
12854           ],
12855           "isolated": "\uFBDE",
12856           "final": "\uFBDF"
12857         },
12858         "farsi yeh": {
12859           "normal": [
12860             "\u06CC"
12861           ],
12862           "indic_two_above": [
12863             "\u0775"
12864           ],
12865           "indic_three_above": [
12866             "\u0776"
12867           ],
12868           "indic_four_above": [
12869             "\u0777"
12870           ],
12871           "isolated": "\uFBFC",
12872           "final": "\uFBFD",
12873           "initial": "\uFBFE",
12874           "medial": "\uFBFF"
12875         },
12876         "e": {
12877           "normal": [
12878             "\u06D0"
12879           ],
12880           "isolated": "\uFBE4",
12881           "final": "\uFBE5",
12882           "initial": "\uFBE6",
12883           "medial": "\uFBE7"
12884         },
12885         "yeh barree": {
12886           "normal": [
12887             "\u06D2"
12888           ],
12889           "hamza_above": {
12890             "normal": [
12891               "\u06D2\u0654",
12892               "\u06D3"
12893             ],
12894             "isolated": "\uFBB0",
12895             "final": "\uFBB1"
12896           },
12897           "indic_two_above": [
12898             "\u077A"
12899           ],
12900           "indic_three_above": [
12901             "\u077B"
12902           ],
12903           "isolated": "\uFBAE",
12904           "final": "\uFBAF"
12905         },
12906         "ae": {
12907           "normal": [
12908             "\u06D5"
12909           ],
12910           "isolated": "\u06D5",
12911           "final": "\uFEEA",
12912           "yeh_above": {
12913             "normal": [
12914               "\u06C0",
12915               "\u06D5\u0654"
12916             ],
12917             "isolated": "\uFBA4",
12918             "final": "\uFBA5"
12919           }
12920         },
12921         "rohingya yeh": {
12922           "normal": [
12923             "\u08AC"
12924           ]
12925         },
12926         "low alef": {
12927           "normal": [
12928             "\u08AD"
12929           ]
12930         },
12931         "straight waw": {
12932           "normal": [
12933             "\u08B1"
12934           ]
12935         },
12936         "african feh": {
12937           "normal": [
12938             "\u08BB"
12939           ]
12940         },
12941         "african qaf": {
12942           "normal": [
12943             "\u08BC"
12944           ]
12945         },
12946         "african noon": {
12947           "normal": [
12948             "\u08BD"
12949           ]
12950         }
12951       };
12952       exports2.default = arabicReference;
12953     }
12954   });
12955
12956   // node_modules/alif-toolkit/lib/unicode-ligatures.js
12957   var require_unicode_ligatures = __commonJS({
12958     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
12959       "use strict";
12960       Object.defineProperty(exports2, "__esModule", { value: true });
12961       var ligatureReference = {
12962         "\u0626\u0627": {
12963           "isolated": "\uFBEA",
12964           "final": "\uFBEB"
12965         },
12966         "\u0626\u06D5": {
12967           "isolated": "\uFBEC",
12968           "final": "\uFBED"
12969         },
12970         "\u0626\u0648": {
12971           "isolated": "\uFBEE",
12972           "final": "\uFBEF"
12973         },
12974         "\u0626\u06C7": {
12975           "isolated": "\uFBF0",
12976           "final": "\uFBF1"
12977         },
12978         "\u0626\u06C6": {
12979           "isolated": "\uFBF2",
12980           "final": "\uFBF3"
12981         },
12982         "\u0626\u06C8": {
12983           "isolated": "\uFBF4",
12984           "final": "\uFBF5"
12985         },
12986         "\u0626\u06D0": {
12987           "isolated": "\uFBF6",
12988           "final": "\uFBF7",
12989           "initial": "\uFBF8"
12990         },
12991         "\u0626\u0649": {
12992           "uighur_kirghiz": {
12993             "isolated": "\uFBF9",
12994             "final": "\uFBFA",
12995             "initial": "\uFBFB"
12996           },
12997           "isolated": "\uFC03",
12998           "final": "\uFC68"
12999         },
13000         "\u0626\u062C": {
13001           "isolated": "\uFC00",
13002           "initial": "\uFC97"
13003         },
13004         "\u0626\u062D": {
13005           "isolated": "\uFC01",
13006           "initial": "\uFC98"
13007         },
13008         "\u0626\u0645": {
13009           "isolated": "\uFC02",
13010           "final": "\uFC66",
13011           "initial": "\uFC9A",
13012           "medial": "\uFCDF"
13013         },
13014         "\u0626\u064A": {
13015           "isolated": "\uFC04",
13016           "final": "\uFC69"
13017         },
13018         "\u0628\u062C": {
13019           "isolated": "\uFC05",
13020           "initial": "\uFC9C"
13021         },
13022         "\u0628\u062D": {
13023           "isolated": "\uFC06",
13024           "initial": "\uFC9D"
13025         },
13026         "\u0628\u062E": {
13027           "isolated": "\uFC07",
13028           "initial": "\uFC9E"
13029         },
13030         "\u0628\u0645": {
13031           "isolated": "\uFC08",
13032           "final": "\uFC6C",
13033           "initial": "\uFC9F",
13034           "medial": "\uFCE1"
13035         },
13036         "\u0628\u0649": {
13037           "isolated": "\uFC09",
13038           "final": "\uFC6E"
13039         },
13040         "\u0628\u064A": {
13041           "isolated": "\uFC0A",
13042           "final": "\uFC6F"
13043         },
13044         "\u062A\u062C": {
13045           "isolated": "\uFC0B",
13046           "initial": "\uFCA1"
13047         },
13048         "\u062A\u062D": {
13049           "isolated": "\uFC0C",
13050           "initial": "\uFCA2"
13051         },
13052         "\u062A\u062E": {
13053           "isolated": "\uFC0D",
13054           "initial": "\uFCA3"
13055         },
13056         "\u062A\u0645": {
13057           "isolated": "\uFC0E",
13058           "final": "\uFC72",
13059           "initial": "\uFCA4",
13060           "medial": "\uFCE3"
13061         },
13062         "\u062A\u0649": {
13063           "isolated": "\uFC0F",
13064           "final": "\uFC74"
13065         },
13066         "\u062A\u064A": {
13067           "isolated": "\uFC10",
13068           "final": "\uFC75"
13069         },
13070         "\u062B\u062C": {
13071           "isolated": "\uFC11"
13072         },
13073         "\u062B\u0645": {
13074           "isolated": "\uFC12",
13075           "final": "\uFC78",
13076           "initial": "\uFCA6",
13077           "medial": "\uFCE5"
13078         },
13079         "\u062B\u0649": {
13080           "isolated": "\uFC13",
13081           "final": "\uFC7A"
13082         },
13083         "\u062B\u0648": {
13084           "isolated": "\uFC14"
13085         },
13086         "\u062C\u062D": {
13087           "isolated": "\uFC15",
13088           "initial": "\uFCA7"
13089         },
13090         "\u062C\u0645": {
13091           "isolated": "\uFC16",
13092           "initial": "\uFCA8"
13093         },
13094         "\u062D\u062C": {
13095           "isolated": "\uFC17",
13096           "initial": "\uFCA9"
13097         },
13098         "\u062D\u0645": {
13099           "isolated": "\uFC18",
13100           "initial": "\uFCAA"
13101         },
13102         "\u062E\u062C": {
13103           "isolated": "\uFC19",
13104           "initial": "\uFCAB"
13105         },
13106         "\u062E\u062D": {
13107           "isolated": "\uFC1A"
13108         },
13109         "\u062E\u0645": {
13110           "isolated": "\uFC1B",
13111           "initial": "\uFCAC"
13112         },
13113         "\u0633\u062C": {
13114           "isolated": "\uFC1C",
13115           "initial": "\uFCAD",
13116           "medial": "\uFD34"
13117         },
13118         "\u0633\u062D": {
13119           "isolated": "\uFC1D",
13120           "initial": "\uFCAE",
13121           "medial": "\uFD35"
13122         },
13123         "\u0633\u062E": {
13124           "isolated": "\uFC1E",
13125           "initial": "\uFCAF",
13126           "medial": "\uFD36"
13127         },
13128         "\u0633\u0645": {
13129           "isolated": "\uFC1F",
13130           "initial": "\uFCB0",
13131           "medial": "\uFCE7"
13132         },
13133         "\u0635\u062D": {
13134           "isolated": "\uFC20",
13135           "initial": "\uFCB1"
13136         },
13137         "\u0635\u0645": {
13138           "isolated": "\uFC21",
13139           "initial": "\uFCB3"
13140         },
13141         "\u0636\u062C": {
13142           "isolated": "\uFC22",
13143           "initial": "\uFCB4"
13144         },
13145         "\u0636\u062D": {
13146           "isolated": "\uFC23",
13147           "initial": "\uFCB5"
13148         },
13149         "\u0636\u062E": {
13150           "isolated": "\uFC24",
13151           "initial": "\uFCB6"
13152         },
13153         "\u0636\u0645": {
13154           "isolated": "\uFC25",
13155           "initial": "\uFCB7"
13156         },
13157         "\u0637\u062D": {
13158           "isolated": "\uFC26",
13159           "initial": "\uFCB8"
13160         },
13161         "\u0637\u0645": {
13162           "isolated": "\uFC27",
13163           "initial": "\uFD33",
13164           "medial": "\uFD3A"
13165         },
13166         "\u0638\u0645": {
13167           "isolated": "\uFC28",
13168           "initial": "\uFCB9",
13169           "medial": "\uFD3B"
13170         },
13171         "\u0639\u062C": {
13172           "isolated": "\uFC29",
13173           "initial": "\uFCBA"
13174         },
13175         "\u0639\u0645": {
13176           "isolated": "\uFC2A",
13177           "initial": "\uFCBB"
13178         },
13179         "\u063A\u062C": {
13180           "isolated": "\uFC2B",
13181           "initial": "\uFCBC"
13182         },
13183         "\u063A\u0645": {
13184           "isolated": "\uFC2C",
13185           "initial": "\uFCBD"
13186         },
13187         "\u0641\u062C": {
13188           "isolated": "\uFC2D",
13189           "initial": "\uFCBE"
13190         },
13191         "\u0641\u062D": {
13192           "isolated": "\uFC2E",
13193           "initial": "\uFCBF"
13194         },
13195         "\u0641\u062E": {
13196           "isolated": "\uFC2F",
13197           "initial": "\uFCC0"
13198         },
13199         "\u0641\u0645": {
13200           "isolated": "\uFC30",
13201           "initial": "\uFCC1"
13202         },
13203         "\u0641\u0649": {
13204           "isolated": "\uFC31",
13205           "final": "\uFC7C"
13206         },
13207         "\u0641\u064A": {
13208           "isolated": "\uFC32",
13209           "final": "\uFC7D"
13210         },
13211         "\u0642\u062D": {
13212           "isolated": "\uFC33",
13213           "initial": "\uFCC2"
13214         },
13215         "\u0642\u0645": {
13216           "isolated": "\uFC34",
13217           "initial": "\uFCC3"
13218         },
13219         "\u0642\u0649": {
13220           "isolated": "\uFC35",
13221           "final": "\uFC7E"
13222         },
13223         "\u0642\u064A": {
13224           "isolated": "\uFC36",
13225           "final": "\uFC7F"
13226         },
13227         "\u0643\u0627": {
13228           "isolated": "\uFC37",
13229           "final": "\uFC80"
13230         },
13231         "\u0643\u062C": {
13232           "isolated": "\uFC38",
13233           "initial": "\uFCC4"
13234         },
13235         "\u0643\u062D": {
13236           "isolated": "\uFC39",
13237           "initial": "\uFCC5"
13238         },
13239         "\u0643\u062E": {
13240           "isolated": "\uFC3A",
13241           "initial": "\uFCC6"
13242         },
13243         "\u0643\u0644": {
13244           "isolated": "\uFC3B",
13245           "final": "\uFC81",
13246           "initial": "\uFCC7",
13247           "medial": "\uFCEB"
13248         },
13249         "\u0643\u0645": {
13250           "isolated": "\uFC3C",
13251           "final": "\uFC82",
13252           "initial": "\uFCC8",
13253           "medial": "\uFCEC"
13254         },
13255         "\u0643\u0649": {
13256           "isolated": "\uFC3D",
13257           "final": "\uFC83"
13258         },
13259         "\u0643\u064A": {
13260           "isolated": "\uFC3E",
13261           "final": "\uFC84"
13262         },
13263         "\u0644\u062C": {
13264           "isolated": "\uFC3F",
13265           "initial": "\uFCC9"
13266         },
13267         "\u0644\u062D": {
13268           "isolated": "\uFC40",
13269           "initial": "\uFCCA"
13270         },
13271         "\u0644\u062E": {
13272           "isolated": "\uFC41",
13273           "initial": "\uFCCB"
13274         },
13275         "\u0644\u0645": {
13276           "isolated": "\uFC42",
13277           "final": "\uFC85",
13278           "initial": "\uFCCC",
13279           "medial": "\uFCED"
13280         },
13281         "\u0644\u0649": {
13282           "isolated": "\uFC43",
13283           "final": "\uFC86"
13284         },
13285         "\u0644\u064A": {
13286           "isolated": "\uFC44",
13287           "final": "\uFC87"
13288         },
13289         "\u0645\u062C": {
13290           "isolated": "\uFC45",
13291           "initial": "\uFCCE"
13292         },
13293         "\u0645\u062D": {
13294           "isolated": "\uFC46",
13295           "initial": "\uFCCF"
13296         },
13297         "\u0645\u062E": {
13298           "isolated": "\uFC47",
13299           "initial": "\uFCD0"
13300         },
13301         "\u0645\u0645": {
13302           "isolated": "\uFC48",
13303           "final": "\uFC89",
13304           "initial": "\uFCD1"
13305         },
13306         "\u0645\u0649": {
13307           "isolated": "\uFC49"
13308         },
13309         "\u0645\u064A": {
13310           "isolated": "\uFC4A"
13311         },
13312         "\u0646\u062C": {
13313           "isolated": "\uFC4B",
13314           "initial": "\uFCD2"
13315         },
13316         "\u0646\u062D": {
13317           "isolated": "\uFC4C",
13318           "initial": "\uFCD3"
13319         },
13320         "\u0646\u062E": {
13321           "isolated": "\uFC4D",
13322           "initial": "\uFCD4"
13323         },
13324         "\u0646\u0645": {
13325           "isolated": "\uFC4E",
13326           "final": "\uFC8C",
13327           "initial": "\uFCD5",
13328           "medial": "\uFCEE"
13329         },
13330         "\u0646\u0649": {
13331           "isolated": "\uFC4F",
13332           "final": "\uFC8E"
13333         },
13334         "\u0646\u064A": {
13335           "isolated": "\uFC50",
13336           "final": "\uFC8F"
13337         },
13338         "\u0647\u062C": {
13339           "isolated": "\uFC51",
13340           "initial": "\uFCD7"
13341         },
13342         "\u0647\u0645": {
13343           "isolated": "\uFC52",
13344           "initial": "\uFCD8"
13345         },
13346         "\u0647\u0649": {
13347           "isolated": "\uFC53"
13348         },
13349         "\u0647\u064A": {
13350           "isolated": "\uFC54"
13351         },
13352         "\u064A\u062C": {
13353           "isolated": "\uFC55",
13354           "initial": "\uFCDA"
13355         },
13356         "\u064A\u062D": {
13357           "isolated": "\uFC56",
13358           "initial": "\uFCDB"
13359         },
13360         "\u064A\u062E": {
13361           "isolated": "\uFC57",
13362           "initial": "\uFCDC"
13363         },
13364         "\u064A\u0645": {
13365           "isolated": "\uFC58",
13366           "final": "\uFC93",
13367           "initial": "\uFCDD",
13368           "medial": "\uFCF0"
13369         },
13370         "\u064A\u0649": {
13371           "isolated": "\uFC59",
13372           "final": "\uFC95"
13373         },
13374         "\u064A\u064A": {
13375           "isolated": "\uFC5A",
13376           "final": "\uFC96"
13377         },
13378         "\u0630\u0670": {
13379           "isolated": "\uFC5B"
13380         },
13381         "\u0631\u0670": {
13382           "isolated": "\uFC5C"
13383         },
13384         "\u0649\u0670": {
13385           "isolated": "\uFC5D",
13386           "final": "\uFC90"
13387         },
13388         "\u064C\u0651": {
13389           "isolated": "\uFC5E"
13390         },
13391         "\u064D\u0651": {
13392           "isolated": "\uFC5F"
13393         },
13394         "\u064E\u0651": {
13395           "isolated": "\uFC60"
13396         },
13397         "\u064F\u0651": {
13398           "isolated": "\uFC61"
13399         },
13400         "\u0650\u0651": {
13401           "isolated": "\uFC62"
13402         },
13403         "\u0651\u0670": {
13404           "isolated": "\uFC63"
13405         },
13406         "\u0626\u0631": {
13407           "final": "\uFC64"
13408         },
13409         "\u0626\u0632": {
13410           "final": "\uFC65"
13411         },
13412         "\u0626\u0646": {
13413           "final": "\uFC67"
13414         },
13415         "\u0628\u0631": {
13416           "final": "\uFC6A"
13417         },
13418         "\u0628\u0632": {
13419           "final": "\uFC6B"
13420         },
13421         "\u0628\u0646": {
13422           "final": "\uFC6D"
13423         },
13424         "\u062A\u0631": {
13425           "final": "\uFC70"
13426         },
13427         "\u062A\u0632": {
13428           "final": "\uFC71"
13429         },
13430         "\u062A\u0646": {
13431           "final": "\uFC73"
13432         },
13433         "\u062B\u0631": {
13434           "final": "\uFC76"
13435         },
13436         "\u062B\u0632": {
13437           "final": "\uFC77"
13438         },
13439         "\u062B\u0646": {
13440           "final": "\uFC79"
13441         },
13442         "\u062B\u064A": {
13443           "final": "\uFC7B"
13444         },
13445         "\u0645\u0627": {
13446           "final": "\uFC88"
13447         },
13448         "\u0646\u0631": {
13449           "final": "\uFC8A"
13450         },
13451         "\u0646\u0632": {
13452           "final": "\uFC8B"
13453         },
13454         "\u0646\u0646": {
13455           "final": "\uFC8D"
13456         },
13457         "\u064A\u0631": {
13458           "final": "\uFC91"
13459         },
13460         "\u064A\u0632": {
13461           "final": "\uFC92"
13462         },
13463         "\u064A\u0646": {
13464           "final": "\uFC94"
13465         },
13466         "\u0626\u062E": {
13467           "initial": "\uFC99"
13468         },
13469         "\u0626\u0647": {
13470           "initial": "\uFC9B",
13471           "medial": "\uFCE0"
13472         },
13473         "\u0628\u0647": {
13474           "initial": "\uFCA0",
13475           "medial": "\uFCE2"
13476         },
13477         "\u062A\u0647": {
13478           "initial": "\uFCA5",
13479           "medial": "\uFCE4"
13480         },
13481         "\u0635\u062E": {
13482           "initial": "\uFCB2"
13483         },
13484         "\u0644\u0647": {
13485           "initial": "\uFCCD"
13486         },
13487         "\u0646\u0647": {
13488           "initial": "\uFCD6",
13489           "medial": "\uFCEF"
13490         },
13491         "\u0647\u0670": {
13492           "initial": "\uFCD9"
13493         },
13494         "\u064A\u0647": {
13495           "initial": "\uFCDE",
13496           "medial": "\uFCF1"
13497         },
13498         "\u062B\u0647": {
13499           "medial": "\uFCE6"
13500         },
13501         "\u0633\u0647": {
13502           "medial": "\uFCE8",
13503           "initial": "\uFD31"
13504         },
13505         "\u0634\u0645": {
13506           "medial": "\uFCE9",
13507           "isolated": "\uFD0C",
13508           "final": "\uFD28",
13509           "initial": "\uFD30"
13510         },
13511         "\u0634\u0647": {
13512           "medial": "\uFCEA",
13513           "initial": "\uFD32"
13514         },
13515         "\u0640\u064E\u0651": {
13516           "medial": "\uFCF2"
13517         },
13518         "\u0640\u064F\u0651": {
13519           "medial": "\uFCF3"
13520         },
13521         "\u0640\u0650\u0651": {
13522           "medial": "\uFCF4"
13523         },
13524         "\u0637\u0649": {
13525           "isolated": "\uFCF5",
13526           "final": "\uFD11"
13527         },
13528         "\u0637\u064A": {
13529           "isolated": "\uFCF6",
13530           "final": "\uFD12"
13531         },
13532         "\u0639\u0649": {
13533           "isolated": "\uFCF7",
13534           "final": "\uFD13"
13535         },
13536         "\u0639\u064A": {
13537           "isolated": "\uFCF8",
13538           "final": "\uFD14"
13539         },
13540         "\u063A\u0649": {
13541           "isolated": "\uFCF9",
13542           "final": "\uFD15"
13543         },
13544         "\u063A\u064A": {
13545           "isolated": "\uFCFA",
13546           "final": "\uFD16"
13547         },
13548         "\u0633\u0649": {
13549           "isolated": "\uFCFB"
13550         },
13551         "\u0633\u064A": {
13552           "isolated": "\uFCFC",
13553           "final": "\uFD18"
13554         },
13555         "\u0634\u0649": {
13556           "isolated": "\uFCFD",
13557           "final": "\uFD19"
13558         },
13559         "\u0634\u064A": {
13560           "isolated": "\uFCFE",
13561           "final": "\uFD1A"
13562         },
13563         "\u062D\u0649": {
13564           "isolated": "\uFCFF",
13565           "final": "\uFD1B"
13566         },
13567         "\u062D\u064A": {
13568           "isolated": "\uFD00",
13569           "final": "\uFD1C"
13570         },
13571         "\u062C\u0649": {
13572           "isolated": "\uFD01",
13573           "final": "\uFD1D"
13574         },
13575         "\u062C\u064A": {
13576           "isolated": "\uFD02",
13577           "final": "\uFD1E"
13578         },
13579         "\u062E\u0649": {
13580           "isolated": "\uFD03",
13581           "final": "\uFD1F"
13582         },
13583         "\u062E\u064A": {
13584           "isolated": "\uFD04",
13585           "final": "\uFD20"
13586         },
13587         "\u0635\u0649": {
13588           "isolated": "\uFD05",
13589           "final": "\uFD21"
13590         },
13591         "\u0635\u064A": {
13592           "isolated": "\uFD06",
13593           "final": "\uFD22"
13594         },
13595         "\u0636\u0649": {
13596           "isolated": "\uFD07",
13597           "final": "\uFD23"
13598         },
13599         "\u0636\u064A": {
13600           "isolated": "\uFD08",
13601           "final": "\uFD24"
13602         },
13603         "\u0634\u062C": {
13604           "isolated": "\uFD09",
13605           "final": "\uFD25",
13606           "initial": "\uFD2D",
13607           "medial": "\uFD37"
13608         },
13609         "\u0634\u062D": {
13610           "isolated": "\uFD0A",
13611           "final": "\uFD26",
13612           "initial": "\uFD2E",
13613           "medial": "\uFD38"
13614         },
13615         "\u0634\u062E": {
13616           "isolated": "\uFD0B",
13617           "final": "\uFD27",
13618           "initial": "\uFD2F",
13619           "medial": "\uFD39"
13620         },
13621         "\u0634\u0631": {
13622           "isolated": "\uFD0D",
13623           "final": "\uFD29"
13624         },
13625         "\u0633\u0631": {
13626           "isolated": "\uFD0E",
13627           "final": "\uFD2A"
13628         },
13629         "\u0635\u0631": {
13630           "isolated": "\uFD0F",
13631           "final": "\uFD2B"
13632         },
13633         "\u0636\u0631": {
13634           "isolated": "\uFD10",
13635           "final": "\uFD2C"
13636         },
13637         "\u0633\u0639": {
13638           "final": "\uFD17"
13639         },
13640         "\u062A\u062C\u0645": {
13641           "initial": "\uFD50"
13642         },
13643         "\u062A\u062D\u062C": {
13644           "final": "\uFD51",
13645           "initial": "\uFD52"
13646         },
13647         "\u062A\u062D\u0645": {
13648           "initial": "\uFD53"
13649         },
13650         "\u062A\u062E\u0645": {
13651           "initial": "\uFD54"
13652         },
13653         "\u062A\u0645\u062C": {
13654           "initial": "\uFD55"
13655         },
13656         "\u062A\u0645\u062D": {
13657           "initial": "\uFD56"
13658         },
13659         "\u062A\u0645\u062E": {
13660           "initial": "\uFD57"
13661         },
13662         "\u062C\u0645\u062D": {
13663           "final": "\uFD58",
13664           "initial": "\uFD59"
13665         },
13666         "\u062D\u0645\u064A": {
13667           "final": "\uFD5A"
13668         },
13669         "\u062D\u0645\u0649": {
13670           "final": "\uFD5B"
13671         },
13672         "\u0633\u062D\u062C": {
13673           "initial": "\uFD5C"
13674         },
13675         "\u0633\u062C\u062D": {
13676           "initial": "\uFD5D"
13677         },
13678         "\u0633\u062C\u0649": {
13679           "final": "\uFD5E"
13680         },
13681         "\u0633\u0645\u062D": {
13682           "final": "\uFD5F",
13683           "initial": "\uFD60"
13684         },
13685         "\u0633\u0645\u062C": {
13686           "initial": "\uFD61"
13687         },
13688         "\u0633\u0645\u0645": {
13689           "final": "\uFD62",
13690           "initial": "\uFD63"
13691         },
13692         "\u0635\u062D\u062D": {
13693           "final": "\uFD64",
13694           "initial": "\uFD65"
13695         },
13696         "\u0635\u0645\u0645": {
13697           "final": "\uFD66",
13698           "initial": "\uFDC5"
13699         },
13700         "\u0634\u062D\u0645": {
13701           "final": "\uFD67",
13702           "initial": "\uFD68"
13703         },
13704         "\u0634\u062C\u064A": {
13705           "final": "\uFD69"
13706         },
13707         "\u0634\u0645\u062E": {
13708           "final": "\uFD6A",
13709           "initial": "\uFD6B"
13710         },
13711         "\u0634\u0645\u0645": {
13712           "final": "\uFD6C",
13713           "initial": "\uFD6D"
13714         },
13715         "\u0636\u062D\u0649": {
13716           "final": "\uFD6E"
13717         },
13718         "\u0636\u062E\u0645": {
13719           "final": "\uFD6F",
13720           "initial": "\uFD70"
13721         },
13722         "\u0636\u0645\u062D": {
13723           "final": "\uFD71"
13724         },
13725         "\u0637\u0645\u062D": {
13726           "initial": "\uFD72"
13727         },
13728         "\u0637\u0645\u0645": {
13729           "initial": "\uFD73"
13730         },
13731         "\u0637\u0645\u064A": {
13732           "final": "\uFD74"
13733         },
13734         "\u0639\u062C\u0645": {
13735           "final": "\uFD75",
13736           "initial": "\uFDC4"
13737         },
13738         "\u0639\u0645\u0645": {
13739           "final": "\uFD76",
13740           "initial": "\uFD77"
13741         },
13742         "\u0639\u0645\u0649": {
13743           "final": "\uFD78"
13744         },
13745         "\u063A\u0645\u0645": {
13746           "final": "\uFD79"
13747         },
13748         "\u063A\u0645\u064A": {
13749           "final": "\uFD7A"
13750         },
13751         "\u063A\u0645\u0649": {
13752           "final": "\uFD7B"
13753         },
13754         "\u0641\u062E\u0645": {
13755           "final": "\uFD7C",
13756           "initial": "\uFD7D"
13757         },
13758         "\u0642\u0645\u062D": {
13759           "final": "\uFD7E",
13760           "initial": "\uFDB4"
13761         },
13762         "\u0642\u0645\u0645": {
13763           "final": "\uFD7F"
13764         },
13765         "\u0644\u062D\u0645": {
13766           "final": "\uFD80",
13767           "initial": "\uFDB5"
13768         },
13769         "\u0644\u062D\u064A": {
13770           "final": "\uFD81"
13771         },
13772         "\u0644\u062D\u0649": {
13773           "final": "\uFD82"
13774         },
13775         "\u0644\u062C\u062C": {
13776           "initial": "\uFD83",
13777           "final": "\uFD84"
13778         },
13779         "\u0644\u062E\u0645": {
13780           "final": "\uFD85",
13781           "initial": "\uFD86"
13782         },
13783         "\u0644\u0645\u062D": {
13784           "final": "\uFD87",
13785           "initial": "\uFD88"
13786         },
13787         "\u0645\u062D\u062C": {
13788           "initial": "\uFD89"
13789         },
13790         "\u0645\u062D\u0645": {
13791           "initial": "\uFD8A"
13792         },
13793         "\u0645\u062D\u064A": {
13794           "final": "\uFD8B"
13795         },
13796         "\u0645\u062C\u062D": {
13797           "initial": "\uFD8C"
13798         },
13799         "\u0645\u062C\u0645": {
13800           "initial": "\uFD8D"
13801         },
13802         "\u0645\u062E\u062C": {
13803           "initial": "\uFD8E"
13804         },
13805         "\u0645\u062E\u0645": {
13806           "initial": "\uFD8F"
13807         },
13808         "\u0645\u062C\u062E": {
13809           "initial": "\uFD92"
13810         },
13811         "\u0647\u0645\u062C": {
13812           "initial": "\uFD93"
13813         },
13814         "\u0647\u0645\u0645": {
13815           "initial": "\uFD94"
13816         },
13817         "\u0646\u062D\u0645": {
13818           "initial": "\uFD95"
13819         },
13820         "\u0646\u062D\u0649": {
13821           "final": "\uFD96"
13822         },
13823         "\u0646\u062C\u0645": {
13824           "final": "\uFD97",
13825           "initial": "\uFD98"
13826         },
13827         "\u0646\u062C\u0649": {
13828           "final": "\uFD99"
13829         },
13830         "\u0646\u0645\u064A": {
13831           "final": "\uFD9A"
13832         },
13833         "\u0646\u0645\u0649": {
13834           "final": "\uFD9B"
13835         },
13836         "\u064A\u0645\u0645": {
13837           "final": "\uFD9C",
13838           "initial": "\uFD9D"
13839         },
13840         "\u0628\u062E\u064A": {
13841           "final": "\uFD9E"
13842         },
13843         "\u062A\u062C\u064A": {
13844           "final": "\uFD9F"
13845         },
13846         "\u062A\u062C\u0649": {
13847           "final": "\uFDA0"
13848         },
13849         "\u062A\u062E\u064A": {
13850           "final": "\uFDA1"
13851         },
13852         "\u062A\u062E\u0649": {
13853           "final": "\uFDA2"
13854         },
13855         "\u062A\u0645\u064A": {
13856           "final": "\uFDA3"
13857         },
13858         "\u062A\u0645\u0649": {
13859           "final": "\uFDA4"
13860         },
13861         "\u062C\u0645\u064A": {
13862           "final": "\uFDA5"
13863         },
13864         "\u062C\u062D\u0649": {
13865           "final": "\uFDA6"
13866         },
13867         "\u062C\u0645\u0649": {
13868           "final": "\uFDA7"
13869         },
13870         "\u0633\u062E\u0649": {
13871           "final": "\uFDA8"
13872         },
13873         "\u0635\u062D\u064A": {
13874           "final": "\uFDA9"
13875         },
13876         "\u0634\u062D\u064A": {
13877           "final": "\uFDAA"
13878         },
13879         "\u0636\u062D\u064A": {
13880           "final": "\uFDAB"
13881         },
13882         "\u0644\u062C\u064A": {
13883           "final": "\uFDAC"
13884         },
13885         "\u0644\u0645\u064A": {
13886           "final": "\uFDAD"
13887         },
13888         "\u064A\u062D\u064A": {
13889           "final": "\uFDAE"
13890         },
13891         "\u064A\u062C\u064A": {
13892           "final": "\uFDAF"
13893         },
13894         "\u064A\u0645\u064A": {
13895           "final": "\uFDB0"
13896         },
13897         "\u0645\u0645\u064A": {
13898           "final": "\uFDB1"
13899         },
13900         "\u0642\u0645\u064A": {
13901           "final": "\uFDB2"
13902         },
13903         "\u0646\u062D\u064A": {
13904           "final": "\uFDB3"
13905         },
13906         "\u0639\u0645\u064A": {
13907           "final": "\uFDB6"
13908         },
13909         "\u0643\u0645\u064A": {
13910           "final": "\uFDB7"
13911         },
13912         "\u0646\u062C\u062D": {
13913           "initial": "\uFDB8",
13914           "final": "\uFDBD"
13915         },
13916         "\u0645\u062E\u064A": {
13917           "final": "\uFDB9"
13918         },
13919         "\u0644\u062C\u0645": {
13920           "initial": "\uFDBA",
13921           "final": "\uFDBC"
13922         },
13923         "\u0643\u0645\u0645": {
13924           "final": "\uFDBB",
13925           "initial": "\uFDC3"
13926         },
13927         "\u062C\u062D\u064A": {
13928           "final": "\uFDBE"
13929         },
13930         "\u062D\u062C\u064A": {
13931           "final": "\uFDBF"
13932         },
13933         "\u0645\u062C\u064A": {
13934           "final": "\uFDC0"
13935         },
13936         "\u0641\u0645\u064A": {
13937           "final": "\uFDC1"
13938         },
13939         "\u0628\u062D\u064A": {
13940           "final": "\uFDC2"
13941         },
13942         "\u0633\u062E\u064A": {
13943           "final": "\uFDC6"
13944         },
13945         "\u0646\u062C\u064A": {
13946           "final": "\uFDC7"
13947         },
13948         "\u0644\u0622": {
13949           "isolated": "\uFEF5",
13950           "final": "\uFEF6"
13951         },
13952         "\u0644\u0623": {
13953           "isolated": "\uFEF7",
13954           "final": "\uFEF8"
13955         },
13956         "\u0644\u0625": {
13957           "isolated": "\uFEF9",
13958           "final": "\uFEFA"
13959         },
13960         "\u0644\u0627": {
13961           "isolated": "\uFEFB",
13962           "final": "\uFEFC"
13963         },
13964         "words": {
13965           "\u0635\u0644\u06D2": "\uFDF0",
13966           "\u0642\u0644\u06D2": "\uFDF1",
13967           "\u0627\u0644\u0644\u0647": "\uFDF2",
13968           "\u0627\u0643\u0628\u0631": "\uFDF3",
13969           "\u0645\u062D\u0645\u062F": "\uFDF4",
13970           "\u0635\u0644\u0639\u0645": "\uFDF5",
13971           "\u0631\u0633\u0648\u0644": "\uFDF6",
13972           "\u0639\u0644\u064A\u0647": "\uFDF7",
13973           "\u0648\u0633\u0644\u0645": "\uFDF8",
13974           "\u0635\u0644\u0649": "\uFDF9",
13975           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
13976           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
13977           "\u0631\u06CC\u0627\u0644": "\uFDFC"
13978         }
13979       };
13980       exports2.default = ligatureReference;
13981     }
13982   });
13983
13984   // node_modules/alif-toolkit/lib/reference.js
13985   var require_reference = __commonJS({
13986     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
13987       "use strict";
13988       Object.defineProperty(exports2, "__esModule", { value: true });
13989       exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
13990       var unicode_arabic_1 = require_unicode_arabic();
13991       var unicode_ligatures_1 = require_unicode_ligatures();
13992       var letterList = Object.keys(unicode_arabic_1.default);
13993       exports2.letterList = letterList;
13994       var ligatureList = Object.keys(unicode_ligatures_1.default);
13995       exports2.ligatureList = ligatureList;
13996       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
13997       exports2.ligatureWordList = ligatureWordList;
13998       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
13999       exports2.lams = lams;
14000       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
14001       exports2.alefs = alefs;
14002       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
14003       exports2.tashkeel = tashkeel;
14004       function addToTashkeel(start2, finish) {
14005         for (var i3 = start2; i3 <= finish; i3++) {
14006           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
14007         }
14008       }
14009       addToTashkeel(1552, 1562);
14010       addToTashkeel(1611, 1631);
14011       addToTashkeel(1750, 1756);
14012       addToTashkeel(1760, 1764);
14013       addToTashkeel(1770, 1773);
14014       addToTashkeel(2259, 2273);
14015       addToTashkeel(2275, 2303);
14016       addToTashkeel(65136, 65151);
14017       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
14018       exports2.lineBreakers = lineBreakers;
14019       function addToLineBreakers(start2, finish) {
14020         for (var i3 = start2; i3 <= finish; i3++) {
14021           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
14022         }
14023       }
14024       addToLineBreakers(1536, 1567);
14025       addToLineBreakers(1569, 1573);
14026       addToLineBreakers(1583, 1586);
14027       addToLineBreakers(1632, 1645);
14028       addToLineBreakers(1649, 1655);
14029       addToLineBreakers(1672, 1689);
14030       addToLineBreakers(1731, 1739);
14031       addToLineBreakers(1746, 1785);
14032       addToLineBreakers(1881, 1883);
14033       addToLineBreakers(2218, 2222);
14034       addToLineBreakers(64336, 65021);
14035       addToLineBreakers(65152, 65276);
14036       addToLineBreakers(69216, 69247);
14037       addToLineBreakers(126064, 126143);
14038       addToLineBreakers(126464, 126719);
14039     }
14040   });
14041
14042   // node_modules/alif-toolkit/lib/GlyphSplitter.js
14043   var require_GlyphSplitter = __commonJS({
14044     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
14045       "use strict";
14046       Object.defineProperty(exports2, "__esModule", { value: true });
14047       exports2.GlyphSplitter = GlyphSplitter;
14048       var isArabic_1 = require_isArabic();
14049       var reference_1 = require_reference();
14050       function GlyphSplitter(word) {
14051         let letters = [];
14052         let lastLetter = "";
14053         word.split("").forEach((letter) => {
14054           if ((0, isArabic_1.isArabic)(letter)) {
14055             if (reference_1.tashkeel.indexOf(letter) > -1) {
14056               letters[letters.length - 1] += letter;
14057             } 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)) {
14058               letters[letters.length - 1] += letter;
14059             } else {
14060               letters.push(letter);
14061             }
14062           } else {
14063             letters.push(letter);
14064           }
14065           if (reference_1.tashkeel.indexOf(letter) === -1) {
14066             lastLetter = letter;
14067           }
14068         });
14069         return letters;
14070       }
14071     }
14072   });
14073
14074   // node_modules/alif-toolkit/lib/BaselineSplitter.js
14075   var require_BaselineSplitter = __commonJS({
14076     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
14077       "use strict";
14078       Object.defineProperty(exports2, "__esModule", { value: true });
14079       exports2.BaselineSplitter = BaselineSplitter;
14080       var isArabic_1 = require_isArabic();
14081       var reference_1 = require_reference();
14082       function BaselineSplitter(word) {
14083         let letters = [];
14084         let lastLetter = "";
14085         word.split("").forEach((letter) => {
14086           if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
14087             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
14088               letters[letters.length - 1] += letter;
14089             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
14090               letters.push(letter);
14091             } else {
14092               letters[letters.length - 1] += letter;
14093             }
14094           } else {
14095             letters.push(letter);
14096           }
14097           if (reference_1.tashkeel.indexOf(letter) === -1) {
14098             lastLetter = letter;
14099           }
14100         });
14101         return letters;
14102       }
14103     }
14104   });
14105
14106   // node_modules/alif-toolkit/lib/Normalization.js
14107   var require_Normalization = __commonJS({
14108     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
14109       "use strict";
14110       Object.defineProperty(exports2, "__esModule", { value: true });
14111       exports2.Normal = Normal;
14112       var unicode_arabic_1 = require_unicode_arabic();
14113       var unicode_ligatures_1 = require_unicode_ligatures();
14114       var isArabic_1 = require_isArabic();
14115       var reference_1 = require_reference();
14116       function Normal(word, breakPresentationForm) {
14117         if (typeof breakPresentationForm === "undefined") {
14118           breakPresentationForm = true;
14119         }
14120         let returnable = "";
14121         word.split("").forEach((letter) => {
14122           if (!(0, isArabic_1.isArabic)(letter)) {
14123             returnable += letter;
14124             return;
14125           }
14126           for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14127             let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14128             let versions = Object.keys(letterForms);
14129             for (let v2 = 0; v2 < versions.length; v2++) {
14130               let localVersion = letterForms[versions[v2]];
14131               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14132                 let embeddedForms = Object.keys(localVersion);
14133                 for (let ef = 0; ef < embeddedForms.length; ef++) {
14134                   let form = localVersion[embeddedForms[ef]];
14135                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14136                     if (form === letter) {
14137                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
14138                         if (typeof localVersion["normal"] === "object") {
14139                           returnable += localVersion["normal"][0];
14140                         } else {
14141                           returnable += localVersion["normal"];
14142                         }
14143                         return;
14144                       }
14145                       returnable += letter;
14146                       return;
14147                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14148                       returnable += form[0];
14149                       return;
14150                     }
14151                   }
14152                 }
14153               } else if (localVersion === letter) {
14154                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
14155                   if (typeof letterForms["normal"] === "object") {
14156                     returnable += letterForms["normal"][0];
14157                   } else {
14158                     returnable += letterForms["normal"];
14159                   }
14160                   return;
14161                 }
14162                 returnable += letter;
14163                 return;
14164               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14165                 returnable += localVersion[0];
14166                 return;
14167               }
14168             }
14169           }
14170           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
14171             let normalForm = reference_1.ligatureList[v2];
14172             if (normalForm !== "words") {
14173               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
14174               for (let f2 = 0; f2 < ligForms.length; f2++) {
14175                 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
14176                   returnable += normalForm;
14177                   return;
14178                 }
14179               }
14180             }
14181           }
14182           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
14183             let normalForm = reference_1.ligatureWordList[v3];
14184             if (unicode_ligatures_1.default.words[normalForm] === letter) {
14185               returnable += normalForm;
14186               return;
14187             }
14188           }
14189           returnable += letter;
14190         });
14191         return returnable;
14192       }
14193     }
14194   });
14195
14196   // node_modules/alif-toolkit/lib/CharShaper.js
14197   var require_CharShaper = __commonJS({
14198     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
14199       "use strict";
14200       Object.defineProperty(exports2, "__esModule", { value: true });
14201       exports2.CharShaper = CharShaper;
14202       var unicode_arabic_1 = require_unicode_arabic();
14203       var isArabic_1 = require_isArabic();
14204       var reference_1 = require_reference();
14205       function CharShaper(letter, form) {
14206         if (!(0, isArabic_1.isArabic)(letter)) {
14207           throw new Error("Not Arabic");
14208         }
14209         if (letter === "\u0621") {
14210           return "\u0621";
14211         }
14212         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14213           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14214           let versions = Object.keys(letterForms);
14215           for (let v2 = 0; v2 < versions.length; v2++) {
14216             let localVersion = letterForms[versions[v2]];
14217             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14218               if (versions.indexOf(form) > -1) {
14219                 return letterForms[form];
14220               }
14221             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14222               let embeddedVersions = Object.keys(localVersion);
14223               for (let ev = 0; ev < embeddedVersions.length; ev++) {
14224                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
14225                   if (embeddedVersions.indexOf(form) > -1) {
14226                     return localVersion[form];
14227                   }
14228                 }
14229               }
14230             }
14231           }
14232         }
14233       }
14234     }
14235   });
14236
14237   // node_modules/alif-toolkit/lib/WordShaper.js
14238   var require_WordShaper = __commonJS({
14239     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
14240       "use strict";
14241       Object.defineProperty(exports2, "__esModule", { value: true });
14242       exports2.WordShaper = WordShaper2;
14243       var isArabic_1 = require_isArabic();
14244       var reference_1 = require_reference();
14245       var CharShaper_1 = require_CharShaper();
14246       var unicode_ligatures_1 = require_unicode_ligatures();
14247       function WordShaper2(word) {
14248         let state = "initial";
14249         let output = "";
14250         for (let w2 = 0; w2 < word.length; w2++) {
14251           let nextLetter = " ";
14252           for (let nxw = w2 + 1; nxw < word.length; nxw++) {
14253             if (!(0, isArabic_1.isArabic)(word[nxw])) {
14254               break;
14255             }
14256             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
14257               nextLetter = word[nxw];
14258               break;
14259             }
14260           }
14261           if (!(0, isArabic_1.isArabic)(word[w2]) || (0, isArabic_1.isMath)(word[w2])) {
14262             output += word[w2];
14263             state = "initial";
14264           } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
14265             output += word[w2];
14266           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
14267             output += (0, CharShaper_1.CharShaper)(word[w2], state === "initial" ? "isolated" : "final");
14268             state = "initial";
14269           } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
14270             output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
14271             while (word[w2] !== nextLetter) {
14272               w2++;
14273             }
14274             state = "initial";
14275           } else {
14276             output += (0, CharShaper_1.CharShaper)(word[w2], state);
14277             state = "medial";
14278           }
14279         }
14280         return output;
14281       }
14282     }
14283   });
14284
14285   // node_modules/alif-toolkit/lib/ParentLetter.js
14286   var require_ParentLetter = __commonJS({
14287     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
14288       "use strict";
14289       Object.defineProperty(exports2, "__esModule", { value: true });
14290       exports2.ParentLetter = ParentLetter;
14291       exports2.GrandparentLetter = GrandparentLetter;
14292       var unicode_arabic_1 = require_unicode_arabic();
14293       var isArabic_1 = require_isArabic();
14294       var reference_1 = require_reference();
14295       function ParentLetter(letter) {
14296         if (!(0, isArabic_1.isArabic)(letter)) {
14297           throw new Error("Not an Arabic letter");
14298         }
14299         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14300           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14301           let versions = Object.keys(letterForms);
14302           for (let v2 = 0; v2 < versions.length; v2++) {
14303             let localVersion = letterForms[versions[v2]];
14304             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14305               let embeddedForms = Object.keys(localVersion);
14306               for (let ef = 0; ef < embeddedForms.length; ef++) {
14307                 let form = localVersion[embeddedForms[ef]];
14308                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14309                   return localVersion;
14310                 }
14311               }
14312             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14313               return letterForms;
14314             }
14315           }
14316           return null;
14317         }
14318       }
14319       function GrandparentLetter(letter) {
14320         if (!(0, isArabic_1.isArabic)(letter)) {
14321           throw new Error("Not an Arabic letter");
14322         }
14323         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
14324           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
14325           let versions = Object.keys(letterForms);
14326           for (let v2 = 0; v2 < versions.length; v2++) {
14327             let localVersion = letterForms[versions[v2]];
14328             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
14329               let embeddedForms = Object.keys(localVersion);
14330               for (let ef = 0; ef < embeddedForms.length; ef++) {
14331                 let form = localVersion[embeddedForms[ef]];
14332                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
14333                   return letterForms;
14334                 }
14335               }
14336             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
14337               return letterForms;
14338             }
14339           }
14340           return null;
14341         }
14342       }
14343     }
14344   });
14345
14346   // node_modules/alif-toolkit/lib/index.js
14347   var require_lib = __commonJS({
14348     "node_modules/alif-toolkit/lib/index.js"(exports2) {
14349       "use strict";
14350       Object.defineProperty(exports2, "__esModule", { value: true });
14351       exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
14352       var isArabic_1 = require_isArabic();
14353       Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
14354         return isArabic_1.isArabic;
14355       } });
14356       var GlyphSplitter_1 = require_GlyphSplitter();
14357       Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
14358         return GlyphSplitter_1.GlyphSplitter;
14359       } });
14360       var BaselineSplitter_1 = require_BaselineSplitter();
14361       Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
14362         return BaselineSplitter_1.BaselineSplitter;
14363       } });
14364       var Normalization_1 = require_Normalization();
14365       Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
14366         return Normalization_1.Normal;
14367       } });
14368       var CharShaper_1 = require_CharShaper();
14369       Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
14370         return CharShaper_1.CharShaper;
14371       } });
14372       var WordShaper_1 = require_WordShaper();
14373       Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
14374         return WordShaper_1.WordShaper;
14375       } });
14376       var ParentLetter_1 = require_ParentLetter();
14377       Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
14378         return ParentLetter_1.ParentLetter;
14379       } });
14380       Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
14381         return ParentLetter_1.GrandparentLetter;
14382       } });
14383     }
14384   });
14385
14386   // modules/util/svg_paths_rtl_fix.js
14387   var svg_paths_rtl_fix_exports = {};
14388   __export(svg_paths_rtl_fix_exports, {
14389     fixRTLTextForSvg: () => fixRTLTextForSvg,
14390     rtlRegex: () => rtlRegex
14391   });
14392   function fixRTLTextForSvg(inputText) {
14393     var ret = "", rtlBuffer = [];
14394     var arabicRegex = /[\u0600-\u06FF]/g;
14395     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
14396     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
14397     var thaanaVowel = /[\u07A6-\u07B0]/;
14398     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
14399     if (arabicRegex.test(inputText)) {
14400       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
14401     }
14402     for (var n3 = 0; n3 < inputText.length; n3++) {
14403       var c2 = inputText[n3];
14404       if (arabicMath.test(c2)) {
14405         ret += rtlBuffer.reverse().join("");
14406         rtlBuffer = [c2];
14407       } else {
14408         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
14409           ret += rtlBuffer.reverse().join("");
14410           rtlBuffer = [];
14411         }
14412         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
14413           rtlBuffer[rtlBuffer.length - 1] += c2;
14414         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
14415           rtlBuffer.push(c2);
14416         } else if (c2 === " " && rtlBuffer.length) {
14417           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
14418         } else {
14419           ret += rtlBuffer.reverse().join("") + c2;
14420           rtlBuffer = [];
14421         }
14422       }
14423     }
14424     ret += rtlBuffer.reverse().join("");
14425     return ret;
14426   }
14427   var import_alif_toolkit, rtlRegex;
14428   var init_svg_paths_rtl_fix = __esm({
14429     "modules/util/svg_paths_rtl_fix.js"() {
14430       "use strict";
14431       import_alif_toolkit = __toESM(require_lib());
14432       rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
14433     }
14434   });
14435
14436   // node_modules/vparse/index.js
14437   var require_vparse = __commonJS({
14438     "node_modules/vparse/index.js"(exports2, module2) {
14439       (function(window2) {
14440         "use strict";
14441         function parseVersion3(v2) {
14442           var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
14443           v2 = {
14444             major: +m2[0] || 0,
14445             minor: +m2[1] || 0,
14446             patch: +m2[2] || 0,
14447             build: +m2[3] || 0
14448           };
14449           v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
14450           v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
14451           v2.text = v2.parsed.join(".");
14452           v2.compare = compare2;
14453           return v2;
14454         }
14455         function compare2(v2) {
14456           if (typeof v2 === "string") {
14457             v2 = parseVersion3(v2);
14458           }
14459           for (var i3 = 0; i3 < 4; i3++) {
14460             if (this.parsed[i3] !== v2.parsed[i3]) {
14461               return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
14462             }
14463           }
14464           return 0;
14465         }
14466         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
14467           module2.exports = parseVersion3;
14468         } else {
14469           window2.parseVersion = parseVersion3;
14470         }
14471       })(exports2);
14472     }
14473   });
14474
14475   // config/id.js
14476   var presetsCdnUrl, ociCdnUrl, wmfSitematrixCdnUrl, nsiCdnUrl, defaultOsmApiConnections, osmApiConnections, taginfoApiUrl, nominatimApiUrl, showDonationMessage;
14477   var init_id = __esm({
14478     "config/id.js"() {
14479       "use strict";
14480       presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
14481       ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
14482       wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
14483       nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
14484       defaultOsmApiConnections = {
14485         live: {
14486           url: "https://www.openstreetmap.org",
14487           apiUrl: "https://api.openstreetmap.org",
14488           client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
14489         },
14490         dev: {
14491           url: "https://api06.dev.openstreetmap.org",
14492           client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
14493         }
14494       };
14495       osmApiConnections = [];
14496       if (false) {
14497         osmApiConnections.push({
14498           url: null,
14499           apiUrl: null,
14500           client_id: null
14501         });
14502       } else if (false) {
14503         osmApiConnections.push(defaultOsmApiConnections[null]);
14504       } else {
14505         osmApiConnections.push(defaultOsmApiConnections.live);
14506         osmApiConnections.push(defaultOsmApiConnections.dev);
14507       }
14508       taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
14509       nominatimApiUrl = "https://nominatim.openstreetmap.org/";
14510       showDonationMessage = true;
14511     }
14512   });
14513
14514   // package.json
14515   var package_default;
14516   var init_package = __esm({
14517     "package.json"() {
14518       package_default = {
14519         name: "iD",
14520         version: "2.34.0",
14521         description: "A friendly editor for OpenStreetMap",
14522         main: "dist/iD.min.js",
14523         repository: "github:openstreetmap/iD",
14524         homepage: "https://github.com/openstreetmap/iD",
14525         bugs: "https://github.com/openstreetmap/iD/issues",
14526         keywords: [
14527           "editor",
14528           "openstreetmap"
14529         ],
14530         license: "ISC",
14531         scripts: {
14532           all: "run-s clean build dist",
14533           build: "run-s build:css build:data build:js",
14534           "build:css": "node scripts/build_css.js",
14535           "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
14536           "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",
14537           "build:js": "node config/esbuild.config.mjs",
14538           "build:js:watch": "node config/esbuild.config.mjs --watch",
14539           clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
14540           dist: "run-p dist:**",
14541           "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
14542           "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
14543           "dist:min": "node config/esbuild.config.min.mjs",
14544           "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
14545           "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',
14546           "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
14547           "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',
14548           "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_signs/*.svg",
14549           "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_objects/*.svg",
14550           "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',
14551           "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',
14552           imagery: "node scripts/update_imagery.js",
14553           lint: "eslint config scripts test/spec modules",
14554           "lint:fix": "eslint scripts test/spec modules --fix",
14555           start: "run-s start:watch",
14556           "start:single-build": "run-p build:js start:server",
14557           "start:watch": "run-p build:js:watch start:server",
14558           "start:server": "node scripts/server.js",
14559           test: "npm-run-all -s lint build test:spec",
14560           "test:spec": "vitest --no-isolate",
14561           translations: "node scripts/update_locales.js"
14562         },
14563         dependencies: {
14564           "@mapbox/geojson-area": "^0.2.2",
14565           "@mapbox/sexagesimal": "1.2.0",
14566           "@mapbox/vector-tile": "^2.0.3",
14567           "@rapideditor/country-coder": "~5.4.0",
14568           "@rapideditor/location-conflation": "~1.5.0",
14569           "@tmcw/togeojson": "^7.1.1",
14570           "@turf/bbox": "^7.2.0",
14571           "@turf/bbox-clip": "^7.2.0",
14572           "abortcontroller-polyfill": "^1.7.8",
14573           "aes-js": "^3.1.2",
14574           "alif-toolkit": "^1.3.0",
14575           "core-js-bundle": "^3.42.0",
14576           diacritics: "1.3.0",
14577           exifr: "^7.1.3",
14578           "fast-deep-equal": "~3.1.1",
14579           "fast-json-stable-stringify": "2.1.0",
14580           "lodash-es": "~4.17.15",
14581           marked: "~15.0.11",
14582           "node-diff3": "~3.1.0",
14583           "osm-auth": "~2.6.0",
14584           pannellum: "2.5.6",
14585           pbf: "^4.0.1",
14586           "polygon-clipping": "~0.15.7",
14587           rbush: "4.0.1",
14588           vitest: "^3.1.3",
14589           "whatwg-fetch": "^3.6.20",
14590           "which-polygon": "2.2.1"
14591         },
14592         devDependencies: {
14593           "@fortawesome/fontawesome-svg-core": "~6.7.2",
14594           "@fortawesome/free-brands-svg-icons": "~6.7.2",
14595           "@fortawesome/free-regular-svg-icons": "~6.7.2",
14596           "@fortawesome/free-solid-svg-icons": "~6.7.2",
14597           "@mapbox/maki": "^8.2.0",
14598           "@openstreetmap/id-tagging-schema": "^6.11.0",
14599           "@rapideditor/mapillary_sprite_source": "^1.8.0",
14600           "@rapideditor/temaki": "^5.9.0",
14601           "@transifex/api": "^7.1.3",
14602           "@types/chai": "^5.2.2",
14603           "@types/d3": "^7.4.3",
14604           "@types/geojson": "^7946.0.16",
14605           "@types/happen": "^0.3.0",
14606           "@types/lodash-es": "^4.17.12",
14607           "@types/node": "^22.15.17",
14608           "@types/sinon": "^17.0.3",
14609           "@types/sinon-chai": "^4.0.0",
14610           autoprefixer: "^10.4.21",
14611           browserslist: "^4.24.5",
14612           "browserslist-to-esbuild": "^2.1.1",
14613           chai: "^5.2.0",
14614           chalk: "^4.1.2",
14615           "cldr-core": "^47.0.0",
14616           "cldr-localenames-full": "^47.0.0",
14617           "concat-files": "^0.1.1",
14618           d3: "~7.9.0",
14619           dotenv: "^16.5.0",
14620           "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
14621           esbuild: "^0.25.4",
14622           "esbuild-visualizer": "^0.7.0",
14623           eslint: "^9.26.0",
14624           "fetch-mock": "^11.1.1",
14625           gaze: "^1.1.3",
14626           glob: "^11.0.2",
14627           happen: "^0.3.2",
14628           "js-yaml": "^4.0.0",
14629           jsdom: "^26.1.0",
14630           "json-stringify-pretty-compact": "^3.0.0",
14631           "mapillary-js": "4.1.2",
14632           minimist: "^1.2.8",
14633           "name-suggestion-index": "~6.0",
14634           "netlify-cli": "^21.2.1",
14635           "npm-run-all": "^4.0.0",
14636           "osm-community-index": "~5.9.2",
14637           postcss: "^8.5.3",
14638           "postcss-prefix-selector": "^2.1.1",
14639           "serve-handler": "^6.1.6",
14640           shelljs: "^0.10.0",
14641           shx: "^0.4.0",
14642           sinon: "^11.1.2",
14643           "sinon-chai": "^4.0.0",
14644           smash: "0.0",
14645           "svg-sprite": "2.0.4",
14646           vparse: "~1.1.0"
14647         },
14648         engines: {
14649           node: ">=20"
14650         },
14651         browserslist: [
14652           "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
14653         ]
14654       };
14655     }
14656   });
14657
14658   // node_modules/aes-js/index.js
14659   var require_aes_js = __commonJS({
14660     "node_modules/aes-js/index.js"(exports2, module2) {
14661       (function(root3) {
14662         "use strict";
14663         function checkInt(value) {
14664           return parseInt(value) === value;
14665         }
14666         function checkInts(arrayish) {
14667           if (!checkInt(arrayish.length)) {
14668             return false;
14669           }
14670           for (var i3 = 0; i3 < arrayish.length; i3++) {
14671             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
14672               return false;
14673             }
14674           }
14675           return true;
14676         }
14677         function coerceArray(arg, copy2) {
14678           if (arg.buffer && arg.name === "Uint8Array") {
14679             if (copy2) {
14680               if (arg.slice) {
14681                 arg = arg.slice();
14682               } else {
14683                 arg = Array.prototype.slice.call(arg);
14684               }
14685             }
14686             return arg;
14687           }
14688           if (Array.isArray(arg)) {
14689             if (!checkInts(arg)) {
14690               throw new Error("Array contains invalid value: " + arg);
14691             }
14692             return new Uint8Array(arg);
14693           }
14694           if (checkInt(arg.length) && checkInts(arg)) {
14695             return new Uint8Array(arg);
14696           }
14697           throw new Error("unsupported array-like object");
14698         }
14699         function createArray(length2) {
14700           return new Uint8Array(length2);
14701         }
14702         function copyArray2(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
14703           if (sourceStart != null || sourceEnd != null) {
14704             if (sourceArray.slice) {
14705               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
14706             } else {
14707               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
14708             }
14709           }
14710           targetArray.set(sourceArray, targetStart);
14711         }
14712         var convertUtf8 = /* @__PURE__ */ function() {
14713           function toBytes(text) {
14714             var result = [], i3 = 0;
14715             text = encodeURI(text);
14716             while (i3 < text.length) {
14717               var c2 = text.charCodeAt(i3++);
14718               if (c2 === 37) {
14719                 result.push(parseInt(text.substr(i3, 2), 16));
14720                 i3 += 2;
14721               } else {
14722                 result.push(c2);
14723               }
14724             }
14725             return coerceArray(result);
14726           }
14727           function fromBytes(bytes) {
14728             var result = [], i3 = 0;
14729             while (i3 < bytes.length) {
14730               var c2 = bytes[i3];
14731               if (c2 < 128) {
14732                 result.push(String.fromCharCode(c2));
14733                 i3++;
14734               } else if (c2 > 191 && c2 < 224) {
14735                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
14736                 i3 += 2;
14737               } else {
14738                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
14739                 i3 += 3;
14740               }
14741             }
14742             return result.join("");
14743           }
14744           return {
14745             toBytes,
14746             fromBytes
14747           };
14748         }();
14749         var convertHex = /* @__PURE__ */ function() {
14750           function toBytes(text) {
14751             var result = [];
14752             for (var i3 = 0; i3 < text.length; i3 += 2) {
14753               result.push(parseInt(text.substr(i3, 2), 16));
14754             }
14755             return result;
14756           }
14757           var Hex = "0123456789abcdef";
14758           function fromBytes(bytes) {
14759             var result = [];
14760             for (var i3 = 0; i3 < bytes.length; i3++) {
14761               var v2 = bytes[i3];
14762               result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
14763             }
14764             return result.join("");
14765           }
14766           return {
14767             toBytes,
14768             fromBytes
14769           };
14770         }();
14771         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
14772         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];
14773         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];
14774         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];
14775         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];
14776         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];
14777         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];
14778         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];
14779         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];
14780         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];
14781         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];
14782         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];
14783         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];
14784         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];
14785         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];
14786         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];
14787         function convertToInt32(bytes) {
14788           var result = [];
14789           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
14790             result.push(
14791               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
14792             );
14793           }
14794           return result;
14795         }
14796         var AES = function(key) {
14797           if (!(this instanceof AES)) {
14798             throw Error("AES must be instanitated with `new`");
14799           }
14800           Object.defineProperty(this, "key", {
14801             value: coerceArray(key, true)
14802           });
14803           this._prepare();
14804         };
14805         AES.prototype._prepare = function() {
14806           var rounds = numberOfRounds[this.key.length];
14807           if (rounds == null) {
14808             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
14809           }
14810           this._Ke = [];
14811           this._Kd = [];
14812           for (var i3 = 0; i3 <= rounds; i3++) {
14813             this._Ke.push([0, 0, 0, 0]);
14814             this._Kd.push([0, 0, 0, 0]);
14815           }
14816           var roundKeyCount = (rounds + 1) * 4;
14817           var KC = this.key.length / 4;
14818           var tk = convertToInt32(this.key);
14819           var index;
14820           for (var i3 = 0; i3 < KC; i3++) {
14821             index = i3 >> 2;
14822             this._Ke[index][i3 % 4] = tk[i3];
14823             this._Kd[rounds - index][i3 % 4] = tk[i3];
14824           }
14825           var rconpointer = 0;
14826           var t2 = KC, tt2;
14827           while (t2 < roundKeyCount) {
14828             tt2 = tk[KC - 1];
14829             tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
14830             rconpointer += 1;
14831             if (KC != 8) {
14832               for (var i3 = 1; i3 < KC; i3++) {
14833                 tk[i3] ^= tk[i3 - 1];
14834               }
14835             } else {
14836               for (var i3 = 1; i3 < KC / 2; i3++) {
14837                 tk[i3] ^= tk[i3 - 1];
14838               }
14839               tt2 = tk[KC / 2 - 1];
14840               tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
14841               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
14842                 tk[i3] ^= tk[i3 - 1];
14843               }
14844             }
14845             var i3 = 0, r2, c2;
14846             while (i3 < KC && t2 < roundKeyCount) {
14847               r2 = t2 >> 2;
14848               c2 = t2 % 4;
14849               this._Ke[r2][c2] = tk[i3];
14850               this._Kd[rounds - r2][c2] = tk[i3++];
14851               t2++;
14852             }
14853           }
14854           for (var r2 = 1; r2 < rounds; r2++) {
14855             for (var c2 = 0; c2 < 4; c2++) {
14856               tt2 = this._Kd[r2][c2];
14857               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
14858             }
14859           }
14860         };
14861         AES.prototype.encrypt = function(plaintext) {
14862           if (plaintext.length != 16) {
14863             throw new Error("invalid plaintext size (must be 16 bytes)");
14864           }
14865           var rounds = this._Ke.length - 1;
14866           var a2 = [0, 0, 0, 0];
14867           var t2 = convertToInt32(plaintext);
14868           for (var i3 = 0; i3 < 4; i3++) {
14869             t2[i3] ^= this._Ke[0][i3];
14870           }
14871           for (var r2 = 1; r2 < rounds; r2++) {
14872             for (var i3 = 0; i3 < 4; i3++) {
14873               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];
14874             }
14875             t2 = a2.slice();
14876           }
14877           var result = createArray(16), tt2;
14878           for (var i3 = 0; i3 < 4; i3++) {
14879             tt2 = this._Ke[rounds][i3];
14880             result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
14881             result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
14882             result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
14883             result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
14884           }
14885           return result;
14886         };
14887         AES.prototype.decrypt = function(ciphertext) {
14888           if (ciphertext.length != 16) {
14889             throw new Error("invalid ciphertext size (must be 16 bytes)");
14890           }
14891           var rounds = this._Kd.length - 1;
14892           var a2 = [0, 0, 0, 0];
14893           var t2 = convertToInt32(ciphertext);
14894           for (var i3 = 0; i3 < 4; i3++) {
14895             t2[i3] ^= this._Kd[0][i3];
14896           }
14897           for (var r2 = 1; r2 < rounds; r2++) {
14898             for (var i3 = 0; i3 < 4; i3++) {
14899               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];
14900             }
14901             t2 = a2.slice();
14902           }
14903           var result = createArray(16), tt2;
14904           for (var i3 = 0; i3 < 4; i3++) {
14905             tt2 = this._Kd[rounds][i3];
14906             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
14907             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
14908             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
14909             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
14910           }
14911           return result;
14912         };
14913         var ModeOfOperationECB = function(key) {
14914           if (!(this instanceof ModeOfOperationECB)) {
14915             throw Error("AES must be instanitated with `new`");
14916           }
14917           this.description = "Electronic Code Block";
14918           this.name = "ecb";
14919           this._aes = new AES(key);
14920         };
14921         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
14922           plaintext = coerceArray(plaintext);
14923           if (plaintext.length % 16 !== 0) {
14924             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
14925           }
14926           var ciphertext = createArray(plaintext.length);
14927           var block2 = createArray(16);
14928           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
14929             copyArray2(plaintext, block2, 0, i3, i3 + 16);
14930             block2 = this._aes.encrypt(block2);
14931             copyArray2(block2, ciphertext, i3);
14932           }
14933           return ciphertext;
14934         };
14935         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
14936           ciphertext = coerceArray(ciphertext);
14937           if (ciphertext.length % 16 !== 0) {
14938             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
14939           }
14940           var plaintext = createArray(ciphertext.length);
14941           var block2 = createArray(16);
14942           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
14943             copyArray2(ciphertext, block2, 0, i3, i3 + 16);
14944             block2 = this._aes.decrypt(block2);
14945             copyArray2(block2, plaintext, i3);
14946           }
14947           return plaintext;
14948         };
14949         var ModeOfOperationCBC = function(key, iv) {
14950           if (!(this instanceof ModeOfOperationCBC)) {
14951             throw Error("AES must be instanitated with `new`");
14952           }
14953           this.description = "Cipher Block Chaining";
14954           this.name = "cbc";
14955           if (!iv) {
14956             iv = createArray(16);
14957           } else if (iv.length != 16) {
14958             throw new Error("invalid initialation vector size (must be 16 bytes)");
14959           }
14960           this._lastCipherblock = coerceArray(iv, true);
14961           this._aes = new AES(key);
14962         };
14963         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
14964           plaintext = coerceArray(plaintext);
14965           if (plaintext.length % 16 !== 0) {
14966             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
14967           }
14968           var ciphertext = createArray(plaintext.length);
14969           var block2 = createArray(16);
14970           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
14971             copyArray2(plaintext, block2, 0, i3, i3 + 16);
14972             for (var j2 = 0; j2 < 16; j2++) {
14973               block2[j2] ^= this._lastCipherblock[j2];
14974             }
14975             this._lastCipherblock = this._aes.encrypt(block2);
14976             copyArray2(this._lastCipherblock, ciphertext, i3);
14977           }
14978           return ciphertext;
14979         };
14980         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
14981           ciphertext = coerceArray(ciphertext);
14982           if (ciphertext.length % 16 !== 0) {
14983             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
14984           }
14985           var plaintext = createArray(ciphertext.length);
14986           var block2 = createArray(16);
14987           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
14988             copyArray2(ciphertext, block2, 0, i3, i3 + 16);
14989             block2 = this._aes.decrypt(block2);
14990             for (var j2 = 0; j2 < 16; j2++) {
14991               plaintext[i3 + j2] = block2[j2] ^ this._lastCipherblock[j2];
14992             }
14993             copyArray2(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
14994           }
14995           return plaintext;
14996         };
14997         var ModeOfOperationCFB = function(key, iv, segmentSize) {
14998           if (!(this instanceof ModeOfOperationCFB)) {
14999             throw Error("AES must be instanitated with `new`");
15000           }
15001           this.description = "Cipher Feedback";
15002           this.name = "cfb";
15003           if (!iv) {
15004             iv = createArray(16);
15005           } else if (iv.length != 16) {
15006             throw new Error("invalid initialation vector size (must be 16 size)");
15007           }
15008           if (!segmentSize) {
15009             segmentSize = 1;
15010           }
15011           this.segmentSize = segmentSize;
15012           this._shiftRegister = coerceArray(iv, true);
15013           this._aes = new AES(key);
15014         };
15015         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
15016           if (plaintext.length % this.segmentSize != 0) {
15017             throw new Error("invalid plaintext size (must be segmentSize bytes)");
15018           }
15019           var encrypted = coerceArray(plaintext, true);
15020           var xorSegment;
15021           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
15022             xorSegment = this._aes.encrypt(this._shiftRegister);
15023             for (var j2 = 0; j2 < this.segmentSize; j2++) {
15024               encrypted[i3 + j2] ^= xorSegment[j2];
15025             }
15026             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15027             copyArray2(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15028           }
15029           return encrypted;
15030         };
15031         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
15032           if (ciphertext.length % this.segmentSize != 0) {
15033             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
15034           }
15035           var plaintext = coerceArray(ciphertext, true);
15036           var xorSegment;
15037           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
15038             xorSegment = this._aes.encrypt(this._shiftRegister);
15039             for (var j2 = 0; j2 < this.segmentSize; j2++) {
15040               plaintext[i3 + j2] ^= xorSegment[j2];
15041             }
15042             copyArray2(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
15043             copyArray2(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
15044           }
15045           return plaintext;
15046         };
15047         var ModeOfOperationOFB = function(key, iv) {
15048           if (!(this instanceof ModeOfOperationOFB)) {
15049             throw Error("AES must be instanitated with `new`");
15050           }
15051           this.description = "Output Feedback";
15052           this.name = "ofb";
15053           if (!iv) {
15054             iv = createArray(16);
15055           } else if (iv.length != 16) {
15056             throw new Error("invalid initialation vector size (must be 16 bytes)");
15057           }
15058           this._lastPrecipher = coerceArray(iv, true);
15059           this._lastPrecipherIndex = 16;
15060           this._aes = new AES(key);
15061         };
15062         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
15063           var encrypted = coerceArray(plaintext, true);
15064           for (var i3 = 0; i3 < encrypted.length; i3++) {
15065             if (this._lastPrecipherIndex === 16) {
15066               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
15067               this._lastPrecipherIndex = 0;
15068             }
15069             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
15070           }
15071           return encrypted;
15072         };
15073         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
15074         var Counter = function(initialValue) {
15075           if (!(this instanceof Counter)) {
15076             throw Error("Counter must be instanitated with `new`");
15077           }
15078           if (initialValue !== 0 && !initialValue) {
15079             initialValue = 1;
15080           }
15081           if (typeof initialValue === "number") {
15082             this._counter = createArray(16);
15083             this.setValue(initialValue);
15084           } else {
15085             this.setBytes(initialValue);
15086           }
15087         };
15088         Counter.prototype.setValue = function(value) {
15089           if (typeof value !== "number" || parseInt(value) != value) {
15090             throw new Error("invalid counter value (must be an integer)");
15091           }
15092           if (value > Number.MAX_SAFE_INTEGER) {
15093             throw new Error("integer value out of safe range");
15094           }
15095           for (var index = 15; index >= 0; --index) {
15096             this._counter[index] = value % 256;
15097             value = parseInt(value / 256);
15098           }
15099         };
15100         Counter.prototype.setBytes = function(bytes) {
15101           bytes = coerceArray(bytes, true);
15102           if (bytes.length != 16) {
15103             throw new Error("invalid counter bytes size (must be 16 bytes)");
15104           }
15105           this._counter = bytes;
15106         };
15107         Counter.prototype.increment = function() {
15108           for (var i3 = 15; i3 >= 0; i3--) {
15109             if (this._counter[i3] === 255) {
15110               this._counter[i3] = 0;
15111             } else {
15112               this._counter[i3]++;
15113               break;
15114             }
15115           }
15116         };
15117         var ModeOfOperationCTR = function(key, counter) {
15118           if (!(this instanceof ModeOfOperationCTR)) {
15119             throw Error("AES must be instanitated with `new`");
15120           }
15121           this.description = "Counter";
15122           this.name = "ctr";
15123           if (!(counter instanceof Counter)) {
15124             counter = new Counter(counter);
15125           }
15126           this._counter = counter;
15127           this._remainingCounter = null;
15128           this._remainingCounterIndex = 16;
15129           this._aes = new AES(key);
15130         };
15131         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
15132           var encrypted = coerceArray(plaintext, true);
15133           for (var i3 = 0; i3 < encrypted.length; i3++) {
15134             if (this._remainingCounterIndex === 16) {
15135               this._remainingCounter = this._aes.encrypt(this._counter._counter);
15136               this._remainingCounterIndex = 0;
15137               this._counter.increment();
15138             }
15139             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
15140           }
15141           return encrypted;
15142         };
15143         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
15144         function pkcs7pad(data) {
15145           data = coerceArray(data, true);
15146           var padder = 16 - data.length % 16;
15147           var result = createArray(data.length + padder);
15148           copyArray2(data, result);
15149           for (var i3 = data.length; i3 < result.length; i3++) {
15150             result[i3] = padder;
15151           }
15152           return result;
15153         }
15154         function pkcs7strip(data) {
15155           data = coerceArray(data, true);
15156           if (data.length < 16) {
15157             throw new Error("PKCS#7 invalid length");
15158           }
15159           var padder = data[data.length - 1];
15160           if (padder > 16) {
15161             throw new Error("PKCS#7 padding byte out of range");
15162           }
15163           var length2 = data.length - padder;
15164           for (var i3 = 0; i3 < padder; i3++) {
15165             if (data[length2 + i3] !== padder) {
15166               throw new Error("PKCS#7 invalid padding byte");
15167             }
15168           }
15169           var result = createArray(length2);
15170           copyArray2(data, result, 0, 0, length2);
15171           return result;
15172         }
15173         var aesjs2 = {
15174           AES,
15175           Counter,
15176           ModeOfOperation: {
15177             ecb: ModeOfOperationECB,
15178             cbc: ModeOfOperationCBC,
15179             cfb: ModeOfOperationCFB,
15180             ofb: ModeOfOperationOFB,
15181             ctr: ModeOfOperationCTR
15182           },
15183           utils: {
15184             hex: convertHex,
15185             utf8: convertUtf8
15186           },
15187           padding: {
15188             pkcs7: {
15189               pad: pkcs7pad,
15190               strip: pkcs7strip
15191             }
15192           },
15193           _arrayTest: {
15194             coerceArray,
15195             createArray,
15196             copyArray: copyArray2
15197           }
15198         };
15199         if (typeof exports2 !== "undefined") {
15200           module2.exports = aesjs2;
15201         } else if (typeof define === "function" && define.amd) {
15202           define([], function() {
15203             return aesjs2;
15204           });
15205         } else {
15206           if (root3.aesjs) {
15207             aesjs2._aesjs = root3.aesjs;
15208           }
15209           root3.aesjs = aesjs2;
15210         }
15211       })(exports2);
15212     }
15213   });
15214
15215   // modules/util/aes.js
15216   var aes_exports = {};
15217   __export(aes_exports, {
15218     utilAesDecrypt: () => utilAesDecrypt,
15219     utilAesEncrypt: () => utilAesEncrypt
15220   });
15221   function utilAesEncrypt(text, key) {
15222     key = key || DEFAULT_128;
15223     const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
15224     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
15225     const encryptedBytes = aesCtr.encrypt(textBytes);
15226     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
15227     return encryptedHex;
15228   }
15229   function utilAesDecrypt(encryptedHex, key) {
15230     key = key || DEFAULT_128;
15231     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
15232     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
15233     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
15234     const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
15235     return text;
15236   }
15237   var import_aes_js, DEFAULT_128;
15238   var init_aes = __esm({
15239     "modules/util/aes.js"() {
15240       "use strict";
15241       import_aes_js = __toESM(require_aes_js());
15242       DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
15243     }
15244   });
15245
15246   // modules/util/clean_tags.js
15247   var clean_tags_exports = {};
15248   __export(clean_tags_exports, {
15249     utilCleanTags: () => utilCleanTags
15250   });
15251   function utilCleanTags(tags) {
15252     var out = {};
15253     for (var k2 in tags) {
15254       if (!k2) continue;
15255       var v2 = tags[k2];
15256       if (v2 !== void 0) {
15257         out[k2] = cleanValue(k2, v2);
15258       }
15259     }
15260     return out;
15261     function cleanValue(k3, v3) {
15262       function keepSpaces(k4) {
15263         return /_hours|_times|:conditional$/.test(k4);
15264       }
15265       function skip(k4) {
15266         return /^(description|note|fixme|inscription)$/.test(k4);
15267       }
15268       if (skip(k3)) return v3;
15269       var cleaned = v3.split(";").map(function(s2) {
15270         return s2.trim();
15271       }).join(keepSpaces(k3) ? "; " : ";");
15272       if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
15273         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
15274       }
15275       return cleaned;
15276     }
15277   }
15278   var init_clean_tags = __esm({
15279     "modules/util/clean_tags.js"() {
15280       "use strict";
15281     }
15282   });
15283
15284   // modules/util/detect.js
15285   var detect_exports = {};
15286   __export(detect_exports, {
15287     utilDetect: () => utilDetect
15288   });
15289   function utilDetect(refresh2) {
15290     if (_detected && !refresh2) return _detected;
15291     _detected = {};
15292     const ua = navigator.userAgent;
15293     let m2 = null;
15294     m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
15295     if (m2 !== null) {
15296       _detected.browser = m2[1];
15297       _detected.version = m2[2];
15298     }
15299     if (!_detected.browser) {
15300       m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
15301       if (m2 !== null) {
15302         _detected.browser = "msie";
15303         _detected.version = m2[1];
15304       }
15305     }
15306     if (!_detected.browser) {
15307       m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
15308       if (m2 !== null) {
15309         _detected.browser = "Opera";
15310         _detected.version = m2[2];
15311       }
15312     }
15313     if (!_detected.browser) {
15314       m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
15315       if (m2 !== null) {
15316         _detected.browser = m2[1];
15317         _detected.version = m2[2];
15318         m2 = ua.match(/version\/([\.\d]+)/i);
15319         if (m2 !== null) _detected.version = m2[1];
15320       }
15321     }
15322     if (!_detected.browser) {
15323       _detected.browser = navigator.appName;
15324       _detected.version = navigator.appVersion;
15325     }
15326     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
15327     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
15328     if (_detected.browser.toLowerCase() === "msie") {
15329       _detected.ie = true;
15330       _detected.browser = "Internet Explorer";
15331       _detected.support = false;
15332     } else {
15333       _detected.ie = false;
15334       _detected.support = true;
15335     }
15336     _detected.filedrop = window.FileReader && "ondrop" in window;
15337     if (/Win/.test(ua)) {
15338       _detected.os = "win";
15339       _detected.platform = "Windows";
15340     } else if (/Mac/.test(ua)) {
15341       _detected.os = "mac";
15342       _detected.platform = "Macintosh";
15343     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
15344       _detected.os = "linux";
15345       _detected.platform = "Linux";
15346     } else {
15347       _detected.os = "win";
15348       _detected.platform = "Unknown";
15349     }
15350     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
15351     // so assume any "mac" with multitouch is actually iOS
15352     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
15353     _detected.browserLocales = Array.from(new Set(
15354       // remove duplicates
15355       [navigator.language].concat(navigator.languages || []).concat([
15356         // old property for backwards compatibility
15357         navigator.userLanguage
15358       ]).filter(Boolean)
15359     ));
15360     const loc = window.top.location;
15361     let origin = loc.origin;
15362     if (!origin) {
15363       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
15364     }
15365     _detected.host = origin + loc.pathname;
15366     return _detected;
15367   }
15368   var _detected;
15369   var init_detect = __esm({
15370     "modules/util/detect.js"() {
15371       "use strict";
15372     }
15373   });
15374
15375   // modules/util/get_set_value.js
15376   var get_set_value_exports = {};
15377   __export(get_set_value_exports, {
15378     utilGetSetValue: () => utilGetSetValue
15379   });
15380   function utilGetSetValue(selection2, value, shouldUpdate) {
15381     function setValue(value2, shouldUpdate2) {
15382       function valueNull() {
15383         delete this.value;
15384       }
15385       function valueConstant() {
15386         if (shouldUpdate2(this.value, value2)) {
15387           this.value = value2;
15388         }
15389       }
15390       function valueFunction() {
15391         var x2 = value2.apply(this, arguments);
15392         if (x2 === null || x2 === void 0) {
15393           delete this.value;
15394         } else if (shouldUpdate2(this.value, x2)) {
15395           this.value = x2;
15396         }
15397       }
15398       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
15399     }
15400     if (arguments.length === 1) {
15401       return selection2.property("value");
15402     }
15403     if (shouldUpdate === void 0) {
15404       shouldUpdate = (a2, b2) => a2 !== b2;
15405     }
15406     return selection2.each(setValue(value, shouldUpdate));
15407   }
15408   var init_get_set_value = __esm({
15409     "modules/util/get_set_value.js"() {
15410       "use strict";
15411     }
15412   });
15413
15414   // modules/util/keybinding.js
15415   var keybinding_exports = {};
15416   __export(keybinding_exports, {
15417     utilKeybinding: () => utilKeybinding
15418   });
15419   function utilKeybinding(namespace) {
15420     var _keybindings = {};
15421     function testBindings(d3_event, isCapturing) {
15422       var didMatch = false;
15423       var bindings = Object.keys(_keybindings).map(function(id2) {
15424         return _keybindings[id2];
15425       });
15426       var i3, binding;
15427       for (i3 = 0; i3 < bindings.length; i3++) {
15428         binding = bindings[i3];
15429         if (!binding.event.modifiers.shiftKey) continue;
15430         if (!!binding.capture !== isCapturing) continue;
15431         if (matches(d3_event, binding, true)) {
15432           binding.callback(d3_event);
15433           didMatch = true;
15434           break;
15435         }
15436       }
15437       if (didMatch) return;
15438       for (i3 = 0; i3 < bindings.length; i3++) {
15439         binding = bindings[i3];
15440         if (binding.event.modifiers.shiftKey) continue;
15441         if (!!binding.capture !== isCapturing) continue;
15442         if (matches(d3_event, binding, false)) {
15443           binding.callback(d3_event);
15444           break;
15445         }
15446       }
15447       function matches(d3_event2, binding2, testShift) {
15448         var event = d3_event2;
15449         var isMatch = false;
15450         var tryKeyCode = true;
15451         if (event.key !== void 0) {
15452           tryKeyCode = event.key.charCodeAt(0) > 127;
15453           isMatch = true;
15454           if (binding2.event.key === void 0) {
15455             isMatch = false;
15456           } else if (Array.isArray(binding2.event.key)) {
15457             if (binding2.event.key.map(function(s2) {
15458               return s2.toLowerCase();
15459             }).indexOf(event.key.toLowerCase()) === -1) {
15460               isMatch = false;
15461             }
15462           } else {
15463             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
15464               isMatch = false;
15465             }
15466           }
15467         }
15468         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
15469           isMatch = event.keyCode === binding2.event.keyCode;
15470         }
15471         if (!isMatch) return false;
15472         if (!(event.ctrlKey && event.altKey)) {
15473           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey) return false;
15474           if (event.altKey !== binding2.event.modifiers.altKey) return false;
15475         }
15476         if (event.metaKey !== binding2.event.modifiers.metaKey) return false;
15477         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey) return false;
15478         return true;
15479       }
15480     }
15481     function capture(d3_event) {
15482       testBindings(d3_event, true);
15483     }
15484     function bubble(d3_event) {
15485       var tagName = select_default2(d3_event.target).node().tagName;
15486       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
15487         return;
15488       }
15489       testBindings(d3_event, false);
15490     }
15491     function keybinding(selection2) {
15492       selection2 = selection2 || select_default2(document);
15493       selection2.on("keydown.capture." + namespace, capture, true);
15494       selection2.on("keydown.bubble." + namespace, bubble, false);
15495       return keybinding;
15496     }
15497     keybinding.unbind = function(selection2) {
15498       _keybindings = [];
15499       selection2 = selection2 || select_default2(document);
15500       selection2.on("keydown.capture." + namespace, null);
15501       selection2.on("keydown.bubble." + namespace, null);
15502       return keybinding;
15503     };
15504     keybinding.clear = function() {
15505       _keybindings = {};
15506       return keybinding;
15507     };
15508     keybinding.off = function(codes, capture2) {
15509       var arr = utilArrayUniq([].concat(codes));
15510       for (var i3 = 0; i3 < arr.length; i3++) {
15511         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
15512         delete _keybindings[id2];
15513       }
15514       return keybinding;
15515     };
15516     keybinding.on = function(codes, callback, capture2) {
15517       if (typeof callback !== "function") {
15518         return keybinding.off(codes, capture2);
15519       }
15520       var arr = utilArrayUniq([].concat(codes));
15521       for (var i3 = 0; i3 < arr.length; i3++) {
15522         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
15523         var binding = {
15524           id: id2,
15525           capture: capture2,
15526           callback,
15527           event: {
15528             key: void 0,
15529             // preferred
15530             keyCode: 0,
15531             // fallback
15532             modifiers: {
15533               shiftKey: false,
15534               ctrlKey: false,
15535               altKey: false,
15536               metaKey: false
15537             }
15538           }
15539         };
15540         if (_keybindings[id2]) {
15541           console.warn('warning: duplicate keybinding for "' + id2 + '"');
15542         }
15543         _keybindings[id2] = binding;
15544         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
15545         for (var j2 = 0; j2 < matches.length; j2++) {
15546           if (matches[j2] === "++") matches[j2] = "+";
15547           if (matches[j2] in utilKeybinding.modifierCodes) {
15548             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
15549             binding.event.modifiers[prop] = true;
15550           } else {
15551             binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
15552             if (matches[j2] in utilKeybinding.keyCodes) {
15553               binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
15554             }
15555           }
15556         }
15557       }
15558       return keybinding;
15559     };
15560     return keybinding;
15561   }
15562   var i, n;
15563   var init_keybinding = __esm({
15564     "modules/util/keybinding.js"() {
15565       "use strict";
15566       init_src5();
15567       init_array3();
15568       utilKeybinding.modifierCodes = {
15569         // Shift key, ⇧
15570         "\u21E7": 16,
15571         shift: 16,
15572         // CTRL key, on Mac: ⌃
15573         "\u2303": 17,
15574         ctrl: 17,
15575         // ALT key, on Mac: ⌥ (Alt)
15576         "\u2325": 18,
15577         alt: 18,
15578         option: 18,
15579         // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
15580         "\u2318": 91,
15581         meta: 91,
15582         cmd: 91,
15583         "super": 91,
15584         win: 91
15585       };
15586       utilKeybinding.modifierProperties = {
15587         16: "shiftKey",
15588         17: "ctrlKey",
15589         18: "altKey",
15590         91: "metaKey"
15591       };
15592       utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
15593       utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
15594       utilKeybinding.keys = {
15595         // Backspace key, on Mac: ⌫ (Backspace)
15596         "\u232B": "Backspace",
15597         backspace: "Backspace",
15598         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
15599         "\u21E5": "Tab",
15600         "\u21C6": "Tab",
15601         tab: "Tab",
15602         // Return key, ↩
15603         "\u21A9": "Enter",
15604         "\u21B5": "Enter",
15605         "\u23CE": "Enter",
15606         "return": "Enter",
15607         enter: "Enter",
15608         "\u2305": "Enter",
15609         // Pause/Break key
15610         "pause": "Pause",
15611         "pause-break": "Pause",
15612         // Caps Lock key, ⇪
15613         "\u21EA": "CapsLock",
15614         caps: "CapsLock",
15615         "caps-lock": "CapsLock",
15616         // Escape key, on Mac: ⎋, on Windows: Esc
15617         "\u238B": ["Escape", "Esc"],
15618         escape: ["Escape", "Esc"],
15619         esc: ["Escape", "Esc"],
15620         // Space key
15621         space: [" ", "Spacebar"],
15622         // Page-Up key, or pgup, on Mac: ↖
15623         "\u2196": "PageUp",
15624         pgup: "PageUp",
15625         "page-up": "PageUp",
15626         // Page-Down key, or pgdown, on Mac: ↘
15627         "\u2198": "PageDown",
15628         pgdown: "PageDown",
15629         "page-down": "PageDown",
15630         // END key, on Mac: ⇟
15631         "\u21DF": "End",
15632         end: "End",
15633         // HOME key, on Mac: ⇞
15634         "\u21DE": "Home",
15635         home: "Home",
15636         // Insert key, or ins
15637         ins: "Insert",
15638         insert: "Insert",
15639         // Delete key, on Mac: ⌦ (Delete)
15640         "\u2326": ["Delete", "Del"],
15641         del: ["Delete", "Del"],
15642         "delete": ["Delete", "Del"],
15643         // Left Arrow Key, or ←
15644         "\u2190": ["ArrowLeft", "Left"],
15645         left: ["ArrowLeft", "Left"],
15646         "arrow-left": ["ArrowLeft", "Left"],
15647         // Up Arrow Key, or ↑
15648         "\u2191": ["ArrowUp", "Up"],
15649         up: ["ArrowUp", "Up"],
15650         "arrow-up": ["ArrowUp", "Up"],
15651         // Right Arrow Key, or →
15652         "\u2192": ["ArrowRight", "Right"],
15653         right: ["ArrowRight", "Right"],
15654         "arrow-right": ["ArrowRight", "Right"],
15655         // Up Arrow Key, or ↓
15656         "\u2193": ["ArrowDown", "Down"],
15657         down: ["ArrowDown", "Down"],
15658         "arrow-down": ["ArrowDown", "Down"],
15659         // odities, stuff for backward compatibility (browsers and code):
15660         // Num-Multiply, or *
15661         "*": ["*", "Multiply"],
15662         star: ["*", "Multiply"],
15663         asterisk: ["*", "Multiply"],
15664         multiply: ["*", "Multiply"],
15665         // Num-Plus or +
15666         "+": ["+", "Add"],
15667         "plus": ["+", "Add"],
15668         // Num-Subtract, or -
15669         "-": ["-", "Subtract"],
15670         subtract: ["-", "Subtract"],
15671         "dash": ["-", "Subtract"],
15672         // Semicolon
15673         semicolon: ";",
15674         // = or equals
15675         equals: "=",
15676         // Comma, or ,
15677         comma: ",",
15678         // Period, or ., or full-stop
15679         period: ".",
15680         "full-stop": ".",
15681         // Slash, or /, or forward-slash
15682         slash: "/",
15683         "forward-slash": "/",
15684         // Tick, or `, or back-quote
15685         tick: "`",
15686         "back-quote": "`",
15687         // Open bracket, or [
15688         "open-bracket": "[",
15689         // Back slash, or \
15690         "back-slash": "\\",
15691         // Close bracket, or ]
15692         "close-bracket": "]",
15693         // Apostrophe, or Quote, or '
15694         quote: "'",
15695         apostrophe: "'",
15696         // NUMPAD 0-9
15697         "num-0": "0",
15698         "num-1": "1",
15699         "num-2": "2",
15700         "num-3": "3",
15701         "num-4": "4",
15702         "num-5": "5",
15703         "num-6": "6",
15704         "num-7": "7",
15705         "num-8": "8",
15706         "num-9": "9",
15707         // F1-F25
15708         f1: "F1",
15709         f2: "F2",
15710         f3: "F3",
15711         f4: "F4",
15712         f5: "F5",
15713         f6: "F6",
15714         f7: "F7",
15715         f8: "F8",
15716         f9: "F9",
15717         f10: "F10",
15718         f11: "F11",
15719         f12: "F12",
15720         f13: "F13",
15721         f14: "F14",
15722         f15: "F15",
15723         f16: "F16",
15724         f17: "F17",
15725         f18: "F18",
15726         f19: "F19",
15727         f20: "F20",
15728         f21: "F21",
15729         f22: "F22",
15730         f23: "F23",
15731         f24: "F24",
15732         f25: "F25"
15733       };
15734       utilKeybinding.keyCodes = {
15735         // Backspace key, on Mac: ⌫ (Backspace)
15736         "\u232B": 8,
15737         backspace: 8,
15738         // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
15739         "\u21E5": 9,
15740         "\u21C6": 9,
15741         tab: 9,
15742         // Return key, ↩
15743         "\u21A9": 13,
15744         "\u21B5": 13,
15745         "\u23CE": 13,
15746         "return": 13,
15747         enter: 13,
15748         "\u2305": 13,
15749         // Pause/Break key
15750         "pause": 19,
15751         "pause-break": 19,
15752         // Caps Lock key, ⇪
15753         "\u21EA": 20,
15754         caps: 20,
15755         "caps-lock": 20,
15756         // Escape key, on Mac: ⎋, on Windows: Esc
15757         "\u238B": 27,
15758         escape: 27,
15759         esc: 27,
15760         // Space key
15761         space: 32,
15762         // Page-Up key, or pgup, on Mac: ↖
15763         "\u2196": 33,
15764         pgup: 33,
15765         "page-up": 33,
15766         // Page-Down key, or pgdown, on Mac: ↘
15767         "\u2198": 34,
15768         pgdown: 34,
15769         "page-down": 34,
15770         // END key, on Mac: ⇟
15771         "\u21DF": 35,
15772         end: 35,
15773         // HOME key, on Mac: ⇞
15774         "\u21DE": 36,
15775         home: 36,
15776         // Insert key, or ins
15777         ins: 45,
15778         insert: 45,
15779         // Delete key, on Mac: ⌦ (Delete)
15780         "\u2326": 46,
15781         del: 46,
15782         "delete": 46,
15783         // Left Arrow Key, or ←
15784         "\u2190": 37,
15785         left: 37,
15786         "arrow-left": 37,
15787         // Up Arrow Key, or ↑
15788         "\u2191": 38,
15789         up: 38,
15790         "arrow-up": 38,
15791         // Right Arrow Key, or →
15792         "\u2192": 39,
15793         right: 39,
15794         "arrow-right": 39,
15795         // Up Arrow Key, or ↓
15796         "\u2193": 40,
15797         down: 40,
15798         "arrow-down": 40,
15799         // odities, printing characters that come out wrong:
15800         // Firefox Equals
15801         "ffequals": 61,
15802         // Num-Multiply, or *
15803         "*": 106,
15804         star: 106,
15805         asterisk: 106,
15806         multiply: 106,
15807         // Num-Plus or +
15808         "+": 107,
15809         "plus": 107,
15810         // Num-Subtract, or -
15811         "-": 109,
15812         subtract: 109,
15813         // Vertical Bar / Pipe
15814         "|": 124,
15815         // Firefox Plus
15816         "ffplus": 171,
15817         // Firefox Minus
15818         "ffminus": 173,
15819         // Semicolon
15820         ";": 186,
15821         semicolon: 186,
15822         // = or equals
15823         "=": 187,
15824         "equals": 187,
15825         // Comma, or ,
15826         ",": 188,
15827         comma: 188,
15828         // Dash / Underscore key
15829         "dash": 189,
15830         // Period, or ., or full-stop
15831         ".": 190,
15832         period: 190,
15833         "full-stop": 190,
15834         // Slash, or /, or forward-slash
15835         "/": 191,
15836         slash: 191,
15837         "forward-slash": 191,
15838         // Tick, or `, or back-quote
15839         "`": 192,
15840         tick: 192,
15841         "back-quote": 192,
15842         // Open bracket, or [
15843         "[": 219,
15844         "open-bracket": 219,
15845         // Back slash, or \
15846         "\\": 220,
15847         "back-slash": 220,
15848         // Close bracket, or ]
15849         "]": 221,
15850         "close-bracket": 221,
15851         // Apostrophe, or Quote, or '
15852         "'": 222,
15853         quote: 222,
15854         apostrophe: 222
15855       };
15856       i = 95;
15857       n = 0;
15858       while (++i < 106) {
15859         utilKeybinding.keyCodes["num-" + n] = i;
15860         ++n;
15861       }
15862       i = 47;
15863       n = 0;
15864       while (++i < 58) {
15865         utilKeybinding.keyCodes[n] = i;
15866         ++n;
15867       }
15868       i = 111;
15869       n = 1;
15870       while (++i < 136) {
15871         utilKeybinding.keyCodes["f" + n] = i;
15872         ++n;
15873       }
15874       i = 64;
15875       while (++i < 91) {
15876         utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
15877       }
15878     }
15879   });
15880
15881   // modules/util/object.js
15882   var object_exports = {};
15883   __export(object_exports, {
15884     utilCheckTagDictionary: () => utilCheckTagDictionary,
15885     utilObjectOmit: () => utilObjectOmit
15886   });
15887   function utilObjectOmit(obj, omitKeys) {
15888     return Object.keys(obj).reduce(function(result, key) {
15889       if (omitKeys.indexOf(key) === -1) {
15890         result[key] = obj[key];
15891       }
15892       return result;
15893     }, {});
15894   }
15895   function utilCheckTagDictionary(tags, tagDictionary) {
15896     for (const key in tags) {
15897       const value = tags[key];
15898       if (tagDictionary[key] && value in tagDictionary[key]) {
15899         return tagDictionary[key][value];
15900       }
15901     }
15902     return void 0;
15903   }
15904   var init_object2 = __esm({
15905     "modules/util/object.js"() {
15906       "use strict";
15907     }
15908   });
15909
15910   // modules/util/rebind.js
15911   var rebind_exports = {};
15912   __export(rebind_exports, {
15913     utilRebind: () => utilRebind
15914   });
15915   function utilRebind(target, source, ...args) {
15916     for (const method of args) {
15917       target[method] = d3_rebind(target, source, source[method]);
15918     }
15919     return target;
15920   }
15921   function d3_rebind(target, source, method) {
15922     return function() {
15923       var value = method.apply(source, arguments);
15924       return value === source ? target : value;
15925     };
15926   }
15927   var init_rebind = __esm({
15928     "modules/util/rebind.js"() {
15929       "use strict";
15930     }
15931   });
15932
15933   // modules/util/session_mutex.js
15934   var session_mutex_exports = {};
15935   __export(session_mutex_exports, {
15936     utilSessionMutex: () => utilSessionMutex
15937   });
15938   function utilSessionMutex(name) {
15939     var mutex = {};
15940     var intervalID;
15941     function renew() {
15942       if (typeof window === "undefined") return;
15943       var expires = /* @__PURE__ */ new Date();
15944       expires.setSeconds(expires.getSeconds() + 5);
15945       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
15946     }
15947     mutex.lock = function() {
15948       if (intervalID) return true;
15949       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
15950       if (cookie) return false;
15951       renew();
15952       intervalID = window.setInterval(renew, 4e3);
15953       return true;
15954     };
15955     mutex.unlock = function() {
15956       if (!intervalID) return;
15957       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
15958       clearInterval(intervalID);
15959       intervalID = null;
15960     };
15961     mutex.locked = function() {
15962       return !!intervalID;
15963     };
15964     return mutex;
15965   }
15966   var init_session_mutex = __esm({
15967     "modules/util/session_mutex.js"() {
15968       "use strict";
15969     }
15970   });
15971
15972   // modules/util/tiler.js
15973   var tiler_exports = {};
15974   __export(tiler_exports, {
15975     utilTiler: () => utilTiler
15976   });
15977   function utilTiler() {
15978     var _size = [256, 256];
15979     var _scale = 256;
15980     var _tileSize = 256;
15981     var _zoomExtent = [0, 20];
15982     var _translate = [_size[0] / 2, _size[1] / 2];
15983     var _margin = 0;
15984     var _skipNullIsland = false;
15985     function clamp3(num, min3, max3) {
15986       return Math.max(min3, Math.min(num, max3));
15987     }
15988     function nearNullIsland(tile) {
15989       var x2 = tile[0];
15990       var y2 = tile[1];
15991       var z2 = tile[2];
15992       if (z2 >= 7) {
15993         var center = Math.pow(2, z2 - 1);
15994         var width = Math.pow(2, z2 - 6);
15995         var min3 = center - width / 2;
15996         var max3 = center + width / 2 - 1;
15997         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
15998       }
15999       return false;
16000     }
16001     function tiler8() {
16002       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
16003       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
16004       var tileMin = 0;
16005       var tileMax = Math.pow(2, z0) - 1;
16006       var log2ts = Math.log(_tileSize) * Math.LOG2E;
16007       var k2 = Math.pow(2, z2 - z0 + log2ts);
16008       var origin = [
16009         (_translate[0] - _scale / 2) / k2,
16010         (_translate[1] - _scale / 2) / k2
16011       ];
16012       var cols = range(
16013         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
16014         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
16015       );
16016       var rows = range(
16017         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
16018         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
16019       );
16020       var tiles = [];
16021       for (var i3 = 0; i3 < rows.length; i3++) {
16022         var y2 = rows[i3];
16023         for (var j2 = 0; j2 < cols.length; j2++) {
16024           var x2 = cols[j2];
16025           if (i3 >= _margin && i3 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
16026             tiles.unshift([x2, y2, z0]);
16027           } else {
16028             tiles.push([x2, y2, z0]);
16029           }
16030         }
16031       }
16032       tiles.translate = origin;
16033       tiles.scale = k2;
16034       return tiles;
16035     }
16036     tiler8.getTiles = function(projection2) {
16037       var origin = [
16038         projection2.scale() * Math.PI - projection2.translate()[0],
16039         projection2.scale() * Math.PI - projection2.translate()[1]
16040       ];
16041       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
16042       var tiles = tiler8();
16043       var ts = tiles.scale;
16044       return tiles.map(function(tile) {
16045         if (_skipNullIsland && nearNullIsland(tile)) {
16046           return false;
16047         }
16048         var x2 = tile[0] * ts - origin[0];
16049         var y2 = tile[1] * ts - origin[1];
16050         return {
16051           id: tile.toString(),
16052           xyz: tile,
16053           extent: geoExtent(
16054             projection2.invert([x2, y2 + ts]),
16055             projection2.invert([x2 + ts, y2])
16056           )
16057         };
16058       }).filter(Boolean);
16059     };
16060     tiler8.getGeoJSON = function(projection2) {
16061       var features = tiler8.getTiles(projection2).map(function(tile) {
16062         return {
16063           type: "Feature",
16064           properties: {
16065             id: tile.id,
16066             name: tile.id
16067           },
16068           geometry: {
16069             type: "Polygon",
16070             coordinates: [tile.extent.polygon()]
16071           }
16072         };
16073       });
16074       return {
16075         type: "FeatureCollection",
16076         features
16077       };
16078     };
16079     tiler8.tileSize = function(val) {
16080       if (!arguments.length) return _tileSize;
16081       _tileSize = val;
16082       return tiler8;
16083     };
16084     tiler8.zoomExtent = function(val) {
16085       if (!arguments.length) return _zoomExtent;
16086       _zoomExtent = val;
16087       return tiler8;
16088     };
16089     tiler8.size = function(val) {
16090       if (!arguments.length) return _size;
16091       _size = val;
16092       return tiler8;
16093     };
16094     tiler8.scale = function(val) {
16095       if (!arguments.length) return _scale;
16096       _scale = val;
16097       return tiler8;
16098     };
16099     tiler8.translate = function(val) {
16100       if (!arguments.length) return _translate;
16101       _translate = val;
16102       return tiler8;
16103     };
16104     tiler8.margin = function(val) {
16105       if (!arguments.length) return _margin;
16106       _margin = +val;
16107       return tiler8;
16108     };
16109     tiler8.skipNullIsland = function(val) {
16110       if (!arguments.length) return _skipNullIsland;
16111       _skipNullIsland = val;
16112       return tiler8;
16113     };
16114     return tiler8;
16115   }
16116   var init_tiler = __esm({
16117     "modules/util/tiler.js"() {
16118       "use strict";
16119       init_src();
16120       init_geo2();
16121     }
16122   });
16123
16124   // modules/util/trigger_event.js
16125   var trigger_event_exports = {};
16126   __export(trigger_event_exports, {
16127     utilTriggerEvent: () => utilTriggerEvent
16128   });
16129   function utilTriggerEvent(target, type2, eventProperties) {
16130     target.each(function() {
16131       var evt = document.createEvent("HTMLEvents");
16132       evt.initEvent(type2, true, true);
16133       for (var prop in eventProperties) {
16134         evt[prop] = eventProperties[prop];
16135       }
16136       this.dispatchEvent(evt);
16137     });
16138   }
16139   var init_trigger_event = __esm({
16140     "modules/util/trigger_event.js"() {
16141       "use strict";
16142     }
16143   });
16144
16145   // modules/util/units.js
16146   var units_exports = {};
16147   __export(units_exports, {
16148     decimalCoordinatePair: () => decimalCoordinatePair,
16149     displayArea: () => displayArea,
16150     displayLength: () => displayLength,
16151     dmsCoordinatePair: () => dmsCoordinatePair,
16152     dmsMatcher: () => dmsMatcher
16153   });
16154   function displayLength(m2, isImperial) {
16155     var d2 = m2 * (isImperial ? 3.28084 : 1);
16156     var unit2;
16157     if (isImperial) {
16158       if (d2 >= 5280) {
16159         d2 /= 5280;
16160         unit2 = "miles";
16161       } else {
16162         unit2 = "feet";
16163       }
16164     } else {
16165       if (d2 >= 1e3) {
16166         d2 /= 1e3;
16167         unit2 = "kilometers";
16168       } else {
16169         unit2 = "meters";
16170       }
16171     }
16172     return _t("units." + unit2, {
16173       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
16174         maximumSignificantDigits: 4
16175       })
16176     });
16177   }
16178   function displayArea(m2, isImperial) {
16179     var locale3 = _mainLocalizer.localeCode();
16180     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
16181     var d1, d22, area;
16182     var unit1 = "";
16183     var unit2 = "";
16184     if (isImperial) {
16185       if (d2 >= 6969600) {
16186         d1 = d2 / 27878400;
16187         unit1 = "square_miles";
16188       } else {
16189         d1 = d2;
16190         unit1 = "square_feet";
16191       }
16192       if (d2 > 4356 && d2 < 4356e4) {
16193         d22 = d2 / 43560;
16194         unit2 = "acres";
16195       }
16196     } else {
16197       if (d2 >= 25e4) {
16198         d1 = d2 / 1e6;
16199         unit1 = "square_kilometers";
16200       } else {
16201         d1 = d2;
16202         unit1 = "square_meters";
16203       }
16204       if (d2 > 1e3 && d2 < 1e7) {
16205         d22 = d2 / 1e4;
16206         unit2 = "hectares";
16207       }
16208     }
16209     area = _t("units." + unit1, {
16210       quantity: d1.toLocaleString(locale3, {
16211         maximumSignificantDigits: 4
16212       })
16213     });
16214     if (d22) {
16215       return _t("units.area_pair", {
16216         area1: area,
16217         area2: _t("units." + unit2, {
16218           quantity: d22.toLocaleString(locale3, {
16219             maximumSignificantDigits: 2
16220           })
16221         })
16222       });
16223     } else {
16224       return area;
16225     }
16226   }
16227   function wrap(x2, min3, max3) {
16228     var d2 = max3 - min3;
16229     return ((x2 - min3) % d2 + d2) % d2 + min3;
16230   }
16231   function clamp(x2, min3, max3) {
16232     return Math.max(min3, Math.min(x2, max3));
16233   }
16234   function roundToDecimal(target, decimalPlace) {
16235     target = Number(target);
16236     decimalPlace = Number(decimalPlace);
16237     const factor = Math.pow(10, decimalPlace);
16238     return Math.round(target * factor) / factor;
16239   }
16240   function displayCoordinate(deg, pos, neg) {
16241     var displayCoordinate2;
16242     var locale3 = _mainLocalizer.localeCode();
16243     var degreesFloor = Math.floor(Math.abs(deg));
16244     var min3 = (Math.abs(deg) - degreesFloor) * 60;
16245     var minFloor = Math.floor(min3);
16246     var sec = (min3 - minFloor) * 60;
16247     var fix = roundToDecimal(sec, 8);
16248     var secRounded = roundToDecimal(fix, 0);
16249     if (secRounded === 60) {
16250       secRounded = 0;
16251       minFloor += 1;
16252       if (minFloor === 60) {
16253         minFloor = 0;
16254         degreesFloor += 1;
16255       }
16256     }
16257     displayCoordinate2 = _t("units.arcdegrees", {
16258       quantity: degreesFloor.toLocaleString(locale3)
16259     }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
16260       quantity: minFloor.toLocaleString(locale3)
16261     }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
16262       quantity: secRounded.toLocaleString(locale3)
16263     }) : "");
16264     if (deg === 0) {
16265       return displayCoordinate2;
16266     } else {
16267       return _t("units.coordinate", {
16268         coordinate: displayCoordinate2,
16269         direction: _t("units." + (deg > 0 ? pos : neg))
16270       });
16271     }
16272   }
16273   function dmsCoordinatePair(coord2) {
16274     return _t("units.coordinate_pair", {
16275       latitude: displayCoordinate(clamp(coord2[1], -90, 90), "north", "south"),
16276       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
16277     });
16278   }
16279   function decimalCoordinatePair(coord2) {
16280     return _t("units.coordinate_pair", {
16281       latitude: clamp(coord2[1], -90, 90).toFixed(OSM_PRECISION),
16282       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
16283     });
16284   }
16285   function dmsMatcher(q2, _localeCode = void 0) {
16286     const matchers = [
16287       // D M SS , D M SS  ex: 35 11 10.1 , 136 49 53.8
16288       {
16289         condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
16290         parser: function(q3) {
16291           const match = this.condition.exec(q3);
16292           const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
16293           const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
16294           const isNegLat = match[1] === "-" ? -lat : lat;
16295           const isNegLng = match[5] === "-" ? -lng : lng;
16296           return [isNegLat, isNegLng];
16297         }
16298       },
16299       // D MM , D MM ex: 35 11.1683 , 136 49.8966
16300       {
16301         condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
16302         parser: function(q3) {
16303           const match = this.condition.exec(q3);
16304           const lat = +match[2] + +match[3] / 60;
16305           const lng = +match[5] + +match[6] / 60;
16306           const isNegLat = match[1] === "-" ? -lat : lat;
16307           const isNegLng = match[4] === "-" ? -lng : lng;
16308           return [isNegLat, isNegLng];
16309         }
16310       },
16311       // D/D ex: 46.112785/72.921033
16312       {
16313         condition: /^\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
16314         parser: function(q3) {
16315           const match = this.condition.exec(q3);
16316           return [+match[1], +match[2]];
16317         }
16318       },
16319       // zoom/x/y ex: 2/1.23/34.44
16320       {
16321         condition: /^\s*(\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*\/\s*(-?\d+\.?\d*)\s*$/,
16322         parser: function(q3) {
16323           const match = this.condition.exec(q3);
16324           const lat = +match[2];
16325           const lng = +match[3];
16326           const zoom = +match[1];
16327           return [lat, lng, zoom];
16328         }
16329       },
16330       // x/y , x, y , x y  where x and y are localized floats, e.g. in German locale: 49,4109399, 8,7147086
16331       {
16332         condition: { test: (q3) => !!localizedNumberCoordsParser(q3) },
16333         parser: localizedNumberCoordsParser
16334       }
16335     ];
16336     function localizedNumberCoordsParser(q3) {
16337       const parseLocaleFloat = _mainLocalizer.floatParser(_localeCode || _mainLocalizer.localeCode());
16338       let parts = q3.split(/,?\s+|\s*[\/\\]\s*/);
16339       if (parts.length !== 2) return false;
16340       const lat = parseLocaleFloat(parts[0]);
16341       const lng = parseLocaleFloat(parts[1]);
16342       if (isNaN(lat) || isNaN(lng)) return false;
16343       return [lat, lng];
16344     }
16345     for (const matcher of matchers) {
16346       if (matcher.condition.test(q2)) {
16347         return matcher.parser(q2);
16348       }
16349     }
16350     return null;
16351   }
16352   var OSM_PRECISION;
16353   var init_units = __esm({
16354     "modules/util/units.js"() {
16355       "use strict";
16356       init_localizer();
16357       OSM_PRECISION = 7;
16358     }
16359   });
16360
16361   // modules/util/index.js
16362   var util_exports = {};
16363   __export(util_exports, {
16364     dmsCoordinatePair: () => dmsCoordinatePair,
16365     dmsMatcher: () => dmsMatcher,
16366     utilAesDecrypt: () => utilAesDecrypt,
16367     utilAesEncrypt: () => utilAesEncrypt,
16368     utilArrayChunk: () => utilArrayChunk,
16369     utilArrayDifference: () => utilArrayDifference,
16370     utilArrayFlatten: () => utilArrayFlatten,
16371     utilArrayGroupBy: () => utilArrayGroupBy,
16372     utilArrayIdentical: () => utilArrayIdentical,
16373     utilArrayIntersection: () => utilArrayIntersection,
16374     utilArrayUnion: () => utilArrayUnion,
16375     utilArrayUniq: () => utilArrayUniq,
16376     utilArrayUniqBy: () => utilArrayUniqBy,
16377     utilAsyncMap: () => utilAsyncMap,
16378     utilCheckTagDictionary: () => utilCheckTagDictionary,
16379     utilCleanOsmString: () => utilCleanOsmString,
16380     utilCleanTags: () => utilCleanTags,
16381     utilCombinedTags: () => utilCombinedTags,
16382     utilCompareIDs: () => utilCompareIDs,
16383     utilDeepMemberSelector: () => utilDeepMemberSelector,
16384     utilDetect: () => utilDetect,
16385     utilDisplayName: () => utilDisplayName,
16386     utilDisplayNameForPath: () => utilDisplayNameForPath,
16387     utilDisplayType: () => utilDisplayType,
16388     utilEditDistance: () => utilEditDistance,
16389     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
16390     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
16391     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
16392     utilEntityRoot: () => utilEntityRoot,
16393     utilEntitySelector: () => utilEntitySelector,
16394     utilFastMouse: () => utilFastMouse,
16395     utilFunctor: () => utilFunctor,
16396     utilGetAllNodes: () => utilGetAllNodes,
16397     utilGetSetValue: () => utilGetSetValue,
16398     utilHashcode: () => utilHashcode,
16399     utilHighlightEntities: () => utilHighlightEntities,
16400     utilKeybinding: () => utilKeybinding,
16401     utilNoAuto: () => utilNoAuto,
16402     utilObjectOmit: () => utilObjectOmit,
16403     utilOldestID: () => utilOldestID,
16404     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
16405     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
16406     utilQsString: () => utilQsString,
16407     utilRebind: () => utilRebind,
16408     utilSafeClassName: () => utilSafeClassName,
16409     utilSessionMutex: () => utilSessionMutex,
16410     utilSetTransform: () => utilSetTransform,
16411     utilStringQs: () => utilStringQs,
16412     utilTagDiff: () => utilTagDiff,
16413     utilTagText: () => utilTagText,
16414     utilTiler: () => utilTiler,
16415     utilTotalExtent: () => utilTotalExtent,
16416     utilTriggerEvent: () => utilTriggerEvent,
16417     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
16418     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
16419     utilUniqueDomId: () => utilUniqueDomId,
16420     utilWrap: () => utilWrap
16421   });
16422   var init_util = __esm({
16423     "modules/util/index.js"() {
16424       "use strict";
16425       init_aes();
16426       init_aes();
16427       init_array3();
16428       init_array3();
16429       init_array3();
16430       init_array3();
16431       init_array3();
16432       init_array3();
16433       init_array3();
16434       init_array3();
16435       init_array3();
16436       init_util2();
16437       init_clean_tags();
16438       init_util2();
16439       init_util2();
16440       init_detect();
16441       init_util2();
16442       init_util2();
16443       init_util2();
16444       init_util2();
16445       init_util2();
16446       init_util2();
16447       init_util2();
16448       init_util2();
16449       init_util2();
16450       init_util2();
16451       init_util2();
16452       init_util2();
16453       init_get_set_value();
16454       init_util2();
16455       init_util2();
16456       init_keybinding();
16457       init_util2();
16458       init_object2();
16459       init_util2();
16460       init_util2();
16461       init_util2();
16462       init_util2();
16463       init_util2();
16464       init_rebind();
16465       init_util2();
16466       init_util2();
16467       init_session_mutex();
16468       init_util2();
16469       init_util2();
16470       init_util2();
16471       init_tiler();
16472       init_util2();
16473       init_trigger_event();
16474       init_util2();
16475       init_util2();
16476       init_util2();
16477       init_util2();
16478       init_util2();
16479       init_units();
16480       init_units();
16481     }
16482   });
16483
16484   // modules/actions/add_midpoint.js
16485   var add_midpoint_exports = {};
16486   __export(add_midpoint_exports, {
16487     actionAddMidpoint: () => actionAddMidpoint
16488   });
16489   function actionAddMidpoint(midpoint, node) {
16490     return function(graph) {
16491       graph = graph.replace(node.move(midpoint.loc));
16492       var parents = utilArrayIntersection(
16493         graph.parentWays(graph.entity(midpoint.edge[0])),
16494         graph.parentWays(graph.entity(midpoint.edge[1]))
16495       );
16496       parents.forEach(function(way) {
16497         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
16498           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
16499             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
16500             return;
16501           }
16502         }
16503       });
16504       return graph;
16505     };
16506   }
16507   var init_add_midpoint = __esm({
16508     "modules/actions/add_midpoint.js"() {
16509       "use strict";
16510       init_geo2();
16511       init_util();
16512     }
16513   });
16514
16515   // modules/actions/add_vertex.js
16516   var add_vertex_exports = {};
16517   __export(add_vertex_exports, {
16518     actionAddVertex: () => actionAddVertex
16519   });
16520   function actionAddVertex(wayId, nodeId, index) {
16521     return function(graph) {
16522       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
16523     };
16524   }
16525   var init_add_vertex = __esm({
16526     "modules/actions/add_vertex.js"() {
16527       "use strict";
16528     }
16529   });
16530
16531   // modules/actions/change_member.js
16532   var change_member_exports = {};
16533   __export(change_member_exports, {
16534     actionChangeMember: () => actionChangeMember
16535   });
16536   function actionChangeMember(relationId, member, memberIndex) {
16537     return function(graph) {
16538       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
16539     };
16540   }
16541   var init_change_member = __esm({
16542     "modules/actions/change_member.js"() {
16543       "use strict";
16544     }
16545   });
16546
16547   // modules/actions/change_preset.js
16548   var change_preset_exports = {};
16549   __export(change_preset_exports, {
16550     actionChangePreset: () => actionChangePreset
16551   });
16552   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
16553     return function action(graph) {
16554       var entity = graph.entity(entityID);
16555       var geometry = entity.geometry(graph);
16556       var tags = entity.tags;
16557       const loc = entity.extent(graph).center();
16558       var preserveKeys;
16559       if (newPreset) {
16560         preserveKeys = [];
16561         if (newPreset.addTags) {
16562           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
16563         }
16564         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
16565           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
16566         }
16567       }
16568       if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
16569       if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
16570       return graph.replace(entity.update({ tags }));
16571     };
16572   }
16573   var init_change_preset = __esm({
16574     "modules/actions/change_preset.js"() {
16575       "use strict";
16576     }
16577   });
16578
16579   // modules/actions/change_tags.js
16580   var change_tags_exports = {};
16581   __export(change_tags_exports, {
16582     actionChangeTags: () => actionChangeTags
16583   });
16584   function actionChangeTags(entityId, tags) {
16585     return function(graph) {
16586       var entity = graph.entity(entityId);
16587       return graph.replace(entity.update({ tags }));
16588     };
16589   }
16590   var init_change_tags = __esm({
16591     "modules/actions/change_tags.js"() {
16592       "use strict";
16593     }
16594   });
16595
16596   // modules/osm/node.js
16597   var node_exports = {};
16598   __export(node_exports, {
16599     cardinal: () => cardinal,
16600     osmNode: () => osmNode
16601   });
16602   function osmNode() {
16603     if (!(this instanceof osmNode)) {
16604       return new osmNode().initialize(arguments);
16605     } else if (arguments.length) {
16606       this.initialize(arguments);
16607     }
16608   }
16609   var cardinal, prototype;
16610   var init_node2 = __esm({
16611     "modules/osm/node.js"() {
16612       "use strict";
16613       init_entity();
16614       init_geo2();
16615       init_util();
16616       init_tags();
16617       cardinal = {
16618         north: 0,
16619         n: 0,
16620         northnortheast: 22,
16621         nne: 22,
16622         northeast: 45,
16623         ne: 45,
16624         eastnortheast: 67,
16625         ene: 67,
16626         east: 90,
16627         e: 90,
16628         eastsoutheast: 112,
16629         ese: 112,
16630         southeast: 135,
16631         se: 135,
16632         southsoutheast: 157,
16633         sse: 157,
16634         south: 180,
16635         s: 180,
16636         southsouthwest: 202,
16637         ssw: 202,
16638         southwest: 225,
16639         sw: 225,
16640         westsouthwest: 247,
16641         wsw: 247,
16642         west: 270,
16643         w: 270,
16644         westnorthwest: 292,
16645         wnw: 292,
16646         northwest: 315,
16647         nw: 315,
16648         northnorthwest: 337,
16649         nnw: 337
16650       };
16651       osmEntity.node = osmNode;
16652       osmNode.prototype = Object.create(osmEntity.prototype);
16653       prototype = {
16654         type: "node",
16655         loc: [9999, 9999],
16656         extent: function() {
16657           return new geoExtent(this.loc);
16658         },
16659         geometry: function(graph) {
16660           return graph.transient(this, "geometry", function() {
16661             return graph.isPoi(this) ? "point" : "vertex";
16662           });
16663         },
16664         move: function(loc) {
16665           return this.update({ loc });
16666         },
16667         isDegenerate: function() {
16668           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);
16669         },
16670         // Inspect tags and geometry to determine which direction(s) this node/vertex points
16671         directions: function(resolver, projection2) {
16672           var val;
16673           var i3;
16674           if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
16675             val = "all";
16676           } else {
16677             val = (this.tags.direction || "").toLowerCase();
16678             var re3 = /:direction$/i;
16679             var keys2 = Object.keys(this.tags);
16680             for (i3 = 0; i3 < keys2.length; i3++) {
16681               if (re3.test(keys2[i3])) {
16682                 val = this.tags[keys2[i3]].toLowerCase();
16683                 break;
16684               }
16685             }
16686           }
16687           if (val === "") return [];
16688           var values = val.split(";");
16689           var results = [];
16690           values.forEach(function(v2) {
16691             if (cardinal[v2] !== void 0) {
16692               v2 = cardinal[v2];
16693             }
16694             if (v2 !== "" && !isNaN(+v2)) {
16695               results.push(+v2);
16696               return;
16697             }
16698             var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
16699             var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
16700             if (!lookForward && !lookBackward) return;
16701             var nodeIds = {};
16702             resolver.parentWays(this).filter((way) => osmShouldRenderDirection(this.tags, way.tags)).forEach(function(parent) {
16703               var nodes = parent.nodes;
16704               for (i3 = 0; i3 < nodes.length; i3++) {
16705                 if (nodes[i3] === this.id) {
16706                   if (lookForward && i3 > 0) {
16707                     nodeIds[nodes[i3 - 1]] = true;
16708                   }
16709                   if (lookBackward && i3 < nodes.length - 1) {
16710                     nodeIds[nodes[i3 + 1]] = true;
16711                   }
16712                 }
16713               }
16714             }, this);
16715             Object.keys(nodeIds).forEach(function(nodeId) {
16716               results.push(
16717                 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
16718               );
16719             }, this);
16720           }, this);
16721           return utilArrayUniq(results);
16722         },
16723         isCrossing: function() {
16724           return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
16725         },
16726         isEndpoint: function(resolver) {
16727           return resolver.transient(this, "isEndpoint", function() {
16728             var id2 = this.id;
16729             return resolver.parentWays(this).filter(function(parent) {
16730               return !parent.isClosed() && !!parent.affix(id2);
16731             }).length > 0;
16732           });
16733         },
16734         isConnected: function(resolver) {
16735           return resolver.transient(this, "isConnected", function() {
16736             var parents = resolver.parentWays(this);
16737             if (parents.length > 1) {
16738               for (var i3 in parents) {
16739                 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
16740               }
16741             } else if (parents.length === 1) {
16742               var way = parents[0];
16743               var nodes = way.nodes.slice();
16744               if (way.isClosed()) {
16745                 nodes.pop();
16746               }
16747               return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
16748             }
16749             return false;
16750           });
16751         },
16752         parentIntersectionWays: function(resolver) {
16753           return resolver.transient(this, "parentIntersectionWays", function() {
16754             return resolver.parentWays(this).filter(function(parent) {
16755               return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
16756             });
16757           });
16758         },
16759         isIntersection: function(resolver) {
16760           return this.parentIntersectionWays(resolver).length > 1;
16761         },
16762         isHighwayIntersection: function(resolver) {
16763           return resolver.transient(this, "isHighwayIntersection", function() {
16764             return resolver.parentWays(this).filter(function(parent) {
16765               return parent.tags.highway && parent.geometry(resolver) === "line";
16766             }).length > 1;
16767           });
16768         },
16769         isOnAddressLine: function(resolver) {
16770           return resolver.transient(this, "isOnAddressLine", function() {
16771             return resolver.parentWays(this).filter(function(parent) {
16772               return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
16773             }).length > 0;
16774           });
16775         },
16776         asJXON: function(changeset_id) {
16777           var r2 = {
16778             node: {
16779               "@id": this.osmId(),
16780               "@lon": this.loc[0],
16781               "@lat": this.loc[1],
16782               "@version": this.version || 0,
16783               tag: Object.keys(this.tags).map(function(k2) {
16784                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
16785               }, this)
16786             }
16787           };
16788           if (changeset_id) r2.node["@changeset"] = changeset_id;
16789           return r2;
16790         },
16791         asGeoJSON: function() {
16792           return {
16793             type: "Point",
16794             coordinates: this.loc
16795           };
16796         }
16797       };
16798       Object.assign(osmNode.prototype, prototype);
16799     }
16800   });
16801
16802   // modules/actions/circularize.js
16803   var circularize_exports = {};
16804   __export(circularize_exports, {
16805     actionCircularize: () => actionCircularize
16806   });
16807   function actionCircularize(wayId, projection2, maxAngle) {
16808     maxAngle = (maxAngle || 20) * Math.PI / 180;
16809     var action = function(graph, t2) {
16810       if (t2 === null || !isFinite(t2)) t2 = 1;
16811       t2 = Math.min(Math.max(+t2, 0), 1);
16812       var way = graph.entity(wayId);
16813       var origNodes = {};
16814       graph.childNodes(way).forEach(function(node2) {
16815         if (!origNodes[node2.id]) origNodes[node2.id] = node2;
16816       });
16817       if (!way.isConvex(graph)) {
16818         graph = action.makeConvex(graph);
16819       }
16820       var nodes = utilArrayUniq(graph.childNodes(way));
16821       var keyNodes = nodes.filter(function(n3) {
16822         return graph.parentWays(n3).length !== 1;
16823       });
16824       var points = nodes.map(function(n3) {
16825         return projection2(n3.loc);
16826       });
16827       var keyPoints = keyNodes.map(function(n3) {
16828         return projection2(n3.loc);
16829       });
16830       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
16831       var radius = median(points, function(p2) {
16832         return geoVecLength(centroid, p2);
16833       });
16834       var sign2 = area_default3(points) > 0 ? 1 : -1;
16835       var ids, i3, j2, k2;
16836       if (!keyNodes.length) {
16837         keyNodes = [nodes[0]];
16838         keyPoints = [points[0]];
16839       }
16840       if (keyNodes.length === 1) {
16841         var index = nodes.indexOf(keyNodes[0]);
16842         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
16843         keyNodes.push(nodes[oppositeIndex]);
16844         keyPoints.push(points[oppositeIndex]);
16845       }
16846       for (i3 = 0; i3 < keyPoints.length; i3++) {
16847         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
16848         var startNode = keyNodes[i3];
16849         var endNode = keyNodes[nextKeyNodeIndex];
16850         var startNodeIndex = nodes.indexOf(startNode);
16851         var endNodeIndex = nodes.indexOf(endNode);
16852         var numberNewPoints = -1;
16853         var indexRange = endNodeIndex - startNodeIndex;
16854         var nearNodes = {};
16855         var inBetweenNodes = [];
16856         var startAngle, endAngle, totalAngle, eachAngle;
16857         var angle2, loc, node, origNode;
16858         if (indexRange < 0) {
16859           indexRange += nodes.length;
16860         }
16861         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
16862         keyPoints[i3] = [
16863           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
16864           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
16865         ];
16866         loc = projection2.invert(keyPoints[i3]);
16867         node = keyNodes[i3];
16868         origNode = origNodes[node.id];
16869         node = node.move(geoVecInterp(origNode.loc, loc, t2));
16870         graph = graph.replace(node);
16871         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
16872         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
16873         totalAngle = endAngle - startAngle;
16874         if (totalAngle * sign2 > 0) {
16875           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
16876         }
16877         do {
16878           numberNewPoints++;
16879           eachAngle = totalAngle / (indexRange + numberNewPoints);
16880         } while (Math.abs(eachAngle) > maxAngle);
16881         for (j2 = 1; j2 < indexRange; j2++) {
16882           angle2 = startAngle + j2 * eachAngle;
16883           loc = projection2.invert([
16884             centroid[0] + Math.cos(angle2) * radius,
16885             centroid[1] + Math.sin(angle2) * radius
16886           ]);
16887           node = nodes[(j2 + startNodeIndex) % nodes.length];
16888           origNode = origNodes[node.id];
16889           nearNodes[node.id] = angle2;
16890           node = node.move(geoVecInterp(origNode.loc, loc, t2));
16891           graph = graph.replace(node);
16892         }
16893         for (j2 = 0; j2 < numberNewPoints; j2++) {
16894           angle2 = startAngle + (indexRange + j2) * eachAngle;
16895           loc = projection2.invert([
16896             centroid[0] + Math.cos(angle2) * radius,
16897             centroid[1] + Math.sin(angle2) * radius
16898           ]);
16899           var min3 = Infinity;
16900           for (var nodeId in nearNodes) {
16901             var nearAngle = nearNodes[nodeId];
16902             var dist = Math.abs(nearAngle - angle2);
16903             if (dist < min3) {
16904               min3 = dist;
16905               origNode = origNodes[nodeId];
16906             }
16907           }
16908           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
16909           graph = graph.replace(node);
16910           nodes.splice(endNodeIndex + j2, 0, node);
16911           inBetweenNodes.push(node.id);
16912         }
16913         if (indexRange === 1 && inBetweenNodes.length) {
16914           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
16915           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
16916           var wayDirection1 = endIndex1 - startIndex1;
16917           if (wayDirection1 < -1) {
16918             wayDirection1 = 1;
16919           }
16920           var parentWays = graph.parentWays(keyNodes[i3]);
16921           for (j2 = 0; j2 < parentWays.length; j2++) {
16922             var sharedWay = parentWays[j2];
16923             if (sharedWay === way) continue;
16924             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
16925               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
16926               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
16927               var wayDirection2 = endIndex2 - startIndex2;
16928               var insertAt = endIndex2;
16929               if (wayDirection2 < -1) {
16930                 wayDirection2 = 1;
16931               }
16932               if (wayDirection1 !== wayDirection2) {
16933                 inBetweenNodes.reverse();
16934                 insertAt = startIndex2;
16935               }
16936               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
16937                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
16938               }
16939               graph = graph.replace(sharedWay);
16940             }
16941           }
16942         }
16943       }
16944       ids = nodes.map(function(n3) {
16945         return n3.id;
16946       });
16947       ids.push(ids[0]);
16948       way = way.update({ nodes: ids });
16949       graph = graph.replace(way);
16950       return graph;
16951     };
16952     action.makeConvex = function(graph) {
16953       var way = graph.entity(wayId);
16954       var nodes = utilArrayUniq(graph.childNodes(way));
16955       var points = nodes.map(function(n3) {
16956         return projection2(n3.loc);
16957       });
16958       var sign2 = area_default3(points) > 0 ? 1 : -1;
16959       var hull = hull_default(points);
16960       var i3, j2;
16961       if (sign2 === -1) {
16962         nodes.reverse();
16963         points.reverse();
16964       }
16965       for (i3 = 0; i3 < hull.length - 1; i3++) {
16966         var startIndex = points.indexOf(hull[i3]);
16967         var endIndex = points.indexOf(hull[i3 + 1]);
16968         var indexRange = endIndex - startIndex;
16969         if (indexRange < 0) {
16970           indexRange += nodes.length;
16971         }
16972         for (j2 = 1; j2 < indexRange; j2++) {
16973           var point = geoVecInterp(hull[i3], hull[i3 + 1], j2 / indexRange);
16974           var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
16975           graph = graph.replace(node);
16976         }
16977       }
16978       return graph;
16979     };
16980     action.disabled = function(graph) {
16981       if (!graph.entity(wayId).isClosed()) {
16982         return "not_closed";
16983       }
16984       var way = graph.entity(wayId);
16985       var nodes = utilArrayUniq(graph.childNodes(way));
16986       var points = nodes.map(function(n3) {
16987         return projection2(n3.loc);
16988       });
16989       var hull = hull_default(points);
16990       var epsilonAngle = Math.PI / 180;
16991       if (hull.length !== points.length || hull.length < 3) {
16992         return false;
16993       }
16994       var centroid = centroid_default2(points);
16995       var radius = geoVecLengthSquare(centroid, points[0]);
16996       var i3, actualPoint;
16997       for (i3 = 0; i3 < hull.length; i3++) {
16998         actualPoint = hull[i3];
16999         var actualDist = geoVecLengthSquare(actualPoint, centroid);
17000         var diff = Math.abs(actualDist - radius);
17001         if (diff > 0.05 * radius) {
17002           return false;
17003         }
17004       }
17005       for (i3 = 0; i3 < hull.length; i3++) {
17006         actualPoint = hull[i3];
17007         var nextPoint = hull[(i3 + 1) % hull.length];
17008         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
17009         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
17010         var angle2 = endAngle - startAngle;
17011         if (angle2 < 0) {
17012           angle2 = -angle2;
17013         }
17014         if (angle2 > Math.PI) {
17015           angle2 = 2 * Math.PI - angle2;
17016         }
17017         if (angle2 > maxAngle + epsilonAngle) {
17018           return false;
17019         }
17020       }
17021       return "already_circular";
17022     };
17023     action.transitionable = true;
17024     return action;
17025   }
17026   var init_circularize = __esm({
17027     "modules/actions/circularize.js"() {
17028       "use strict";
17029       init_src();
17030       init_src3();
17031       init_geo2();
17032       init_node2();
17033       init_util();
17034       init_vector();
17035     }
17036   });
17037
17038   // modules/actions/delete_way.js
17039   var delete_way_exports = {};
17040   __export(delete_way_exports, {
17041     actionDeleteWay: () => actionDeleteWay
17042   });
17043   function actionDeleteWay(wayID) {
17044     function canDeleteNode(node, graph) {
17045       if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
17046       var geometries = osmNodeGeometriesForTags(node.tags);
17047       if (geometries.point) return false;
17048       if (geometries.vertex) return true;
17049       return !node.hasInterestingTags();
17050     }
17051     var action = function(graph) {
17052       var way = graph.entity(wayID);
17053       graph.parentRelations(way).forEach(function(parent) {
17054         parent = parent.removeMembersWithID(wayID);
17055         graph = graph.replace(parent);
17056         if (parent.isDegenerate()) {
17057           graph = actionDeleteRelation(parent.id)(graph);
17058         }
17059       });
17060       new Set(way.nodes).forEach(function(nodeID) {
17061         graph = graph.replace(way.removeNode(nodeID));
17062         var node = graph.entity(nodeID);
17063         if (canDeleteNode(node, graph)) {
17064           graph = graph.remove(node);
17065         }
17066       });
17067       return graph.remove(way);
17068     };
17069     return action;
17070   }
17071   var init_delete_way = __esm({
17072     "modules/actions/delete_way.js"() {
17073       "use strict";
17074       init_tags();
17075       init_delete_relation();
17076     }
17077   });
17078
17079   // modules/actions/delete_multiple.js
17080   var delete_multiple_exports = {};
17081   __export(delete_multiple_exports, {
17082     actionDeleteMultiple: () => actionDeleteMultiple
17083   });
17084   function actionDeleteMultiple(ids) {
17085     var actions = {
17086       way: actionDeleteWay,
17087       node: actionDeleteNode,
17088       relation: actionDeleteRelation
17089     };
17090     var action = function(graph) {
17091       ids.forEach(function(id2) {
17092         if (graph.hasEntity(id2)) {
17093           graph = actions[graph.entity(id2).type](id2)(graph);
17094         }
17095       });
17096       return graph;
17097     };
17098     return action;
17099   }
17100   var init_delete_multiple = __esm({
17101     "modules/actions/delete_multiple.js"() {
17102       "use strict";
17103       init_delete_node();
17104       init_delete_relation();
17105       init_delete_way();
17106     }
17107   });
17108
17109   // modules/actions/delete_relation.js
17110   var delete_relation_exports = {};
17111   __export(delete_relation_exports, {
17112     actionDeleteRelation: () => actionDeleteRelation
17113   });
17114   function actionDeleteRelation(relationID, allowUntaggedMembers) {
17115     function canDeleteEntity(entity, graph) {
17116       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
17117     }
17118     var action = function(graph) {
17119       var relation = graph.entity(relationID);
17120       graph.parentRelations(relation).forEach(function(parent) {
17121         parent = parent.removeMembersWithID(relationID);
17122         graph = graph.replace(parent);
17123         if (parent.isDegenerate()) {
17124           graph = actionDeleteRelation(parent.id)(graph);
17125         }
17126       });
17127       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
17128         return m2.id;
17129       }));
17130       memberIDs.forEach(function(memberID) {
17131         graph = graph.replace(relation.removeMembersWithID(memberID));
17132         var entity = graph.entity(memberID);
17133         if (canDeleteEntity(entity, graph)) {
17134           graph = actionDeleteMultiple([memberID])(graph);
17135         }
17136       });
17137       return graph.remove(relation);
17138     };
17139     return action;
17140   }
17141   var init_delete_relation = __esm({
17142     "modules/actions/delete_relation.js"() {
17143       "use strict";
17144       init_delete_multiple();
17145       init_util();
17146     }
17147   });
17148
17149   // modules/actions/delete_node.js
17150   var delete_node_exports = {};
17151   __export(delete_node_exports, {
17152     actionDeleteNode: () => actionDeleteNode
17153   });
17154   function actionDeleteNode(nodeId) {
17155     var action = function(graph) {
17156       var node = graph.entity(nodeId);
17157       graph.parentWays(node).forEach(function(parent) {
17158         parent = parent.removeNode(nodeId);
17159         graph = graph.replace(parent);
17160         if (parent.isDegenerate()) {
17161           graph = actionDeleteWay(parent.id)(graph);
17162         }
17163       });
17164       graph.parentRelations(node).forEach(function(parent) {
17165         parent = parent.removeMembersWithID(nodeId);
17166         graph = graph.replace(parent);
17167         if (parent.isDegenerate()) {
17168           graph = actionDeleteRelation(parent.id)(graph);
17169         }
17170       });
17171       return graph.remove(node);
17172     };
17173     return action;
17174   }
17175   var init_delete_node = __esm({
17176     "modules/actions/delete_node.js"() {
17177       "use strict";
17178       init_delete_relation();
17179       init_delete_way();
17180     }
17181   });
17182
17183   // modules/actions/connect.js
17184   var connect_exports = {};
17185   __export(connect_exports, {
17186     actionConnect: () => actionConnect
17187   });
17188   function actionConnect(nodeIDs) {
17189     var action = function(graph) {
17190       var survivor;
17191       var node;
17192       var parents;
17193       var i3, j2;
17194       nodeIDs.reverse();
17195       var interestingIDs = [];
17196       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17197         node = graph.entity(nodeIDs[i3]);
17198         if (node.hasInterestingTags()) {
17199           if (!node.isNew()) {
17200             interestingIDs.push(node.id);
17201           }
17202         }
17203       }
17204       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
17205       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17206         node = graph.entity(nodeIDs[i3]);
17207         if (node.id === survivor.id) continue;
17208         parents = graph.parentWays(node);
17209         for (j2 = 0; j2 < parents.length; j2++) {
17210           graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
17211         }
17212         parents = graph.parentRelations(node);
17213         for (j2 = 0; j2 < parents.length; j2++) {
17214           graph = graph.replace(parents[j2].replaceMember(node, survivor));
17215         }
17216         survivor = survivor.mergeTags(node.tags);
17217         graph = actionDeleteNode(node.id)(graph);
17218       }
17219       graph = graph.replace(survivor);
17220       parents = graph.parentWays(survivor);
17221       for (i3 = 0; i3 < parents.length; i3++) {
17222         if (parents[i3].isDegenerate()) {
17223           graph = actionDeleteWay(parents[i3].id)(graph);
17224         }
17225       }
17226       return graph;
17227     };
17228     action.disabled = function(graph) {
17229       var seen = {};
17230       var restrictionIDs = [];
17231       var survivor;
17232       var node, way;
17233       var relations, relation, role;
17234       var i3, j2, k2;
17235       survivor = graph.entity(utilOldestID(nodeIDs));
17236       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17237         node = graph.entity(nodeIDs[i3]);
17238         relations = graph.parentRelations(node);
17239         for (j2 = 0; j2 < relations.length; j2++) {
17240           relation = relations[j2];
17241           role = relation.memberById(node.id).role || "";
17242           if (relation.hasFromViaTo()) {
17243             restrictionIDs.push(relation.id);
17244           }
17245           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
17246             return "relation";
17247           } else {
17248             seen[relation.id] = role;
17249           }
17250         }
17251       }
17252       for (i3 = 0; i3 < nodeIDs.length; i3++) {
17253         node = graph.entity(nodeIDs[i3]);
17254         var parents = graph.parentWays(node);
17255         for (j2 = 0; j2 < parents.length; j2++) {
17256           var parent = parents[j2];
17257           relations = graph.parentRelations(parent);
17258           for (k2 = 0; k2 < relations.length; k2++) {
17259             relation = relations[k2];
17260             if (relation.hasFromViaTo()) {
17261               restrictionIDs.push(relation.id);
17262             }
17263           }
17264         }
17265       }
17266       restrictionIDs = utilArrayUniq(restrictionIDs);
17267       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
17268         relation = graph.entity(restrictionIDs[i3]);
17269         if (!relation.isComplete(graph)) continue;
17270         var memberWays = relation.members.filter(function(m2) {
17271           return m2.type === "way";
17272         }).map(function(m2) {
17273           return graph.entity(m2.id);
17274         });
17275         memberWays = utilArrayUniq(memberWays);
17276         var f2 = relation.memberByRole("from");
17277         var t2 = relation.memberByRole("to");
17278         var isUturn = f2.id === t2.id;
17279         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
17280         for (j2 = 0; j2 < relation.members.length; j2++) {
17281           collectNodes(relation.members[j2], nodes);
17282         }
17283         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
17284         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
17285         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
17286         nodes.from = nodes.from.filter(filter2);
17287         nodes.via = nodes.via.filter(filter2);
17288         nodes.to = nodes.to.filter(filter2);
17289         var connectFrom = false;
17290         var connectVia = false;
17291         var connectTo = false;
17292         var connectKeyFrom = false;
17293         var connectKeyTo = false;
17294         for (j2 = 0; j2 < nodeIDs.length; j2++) {
17295           var n3 = nodeIDs[j2];
17296           if (nodes.from.indexOf(n3) !== -1) {
17297             connectFrom = true;
17298           }
17299           if (nodes.via.indexOf(n3) !== -1) {
17300             connectVia = true;
17301           }
17302           if (nodes.to.indexOf(n3) !== -1) {
17303             connectTo = true;
17304           }
17305           if (nodes.keyfrom.indexOf(n3) !== -1) {
17306             connectKeyFrom = true;
17307           }
17308           if (nodes.keyto.indexOf(n3) !== -1) {
17309             connectKeyTo = true;
17310           }
17311         }
17312         if (connectFrom && connectTo && !isUturn) {
17313           return "restriction";
17314         }
17315         if (connectFrom && connectVia) {
17316           return "restriction";
17317         }
17318         if (connectTo && connectVia) {
17319           return "restriction";
17320         }
17321         if (connectKeyFrom || connectKeyTo) {
17322           if (nodeIDs.length !== 2) {
17323             return "restriction";
17324           }
17325           var n0 = null;
17326           var n1 = null;
17327           for (j2 = 0; j2 < memberWays.length; j2++) {
17328             way = memberWays[j2];
17329             if (way.contains(nodeIDs[0])) {
17330               n0 = nodeIDs[0];
17331             }
17332             if (way.contains(nodeIDs[1])) {
17333               n1 = nodeIDs[1];
17334             }
17335           }
17336           if (n0 && n1) {
17337             var ok = false;
17338             for (j2 = 0; j2 < memberWays.length; j2++) {
17339               way = memberWays[j2];
17340               if (way.areAdjacent(n0, n1)) {
17341                 ok = true;
17342                 break;
17343               }
17344             }
17345             if (!ok) {
17346               return "restriction";
17347             }
17348           }
17349         }
17350         for (j2 = 0; j2 < memberWays.length; j2++) {
17351           way = memberWays[j2].update({});
17352           for (k2 = 0; k2 < nodeIDs.length; k2++) {
17353             if (nodeIDs[k2] === survivor.id) continue;
17354             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
17355               way = way.removeNode(nodeIDs[k2]);
17356             } else {
17357               way = way.replaceNode(nodeIDs[k2], survivor.id);
17358             }
17359           }
17360           if (way.isDegenerate()) {
17361             return "restriction";
17362           }
17363         }
17364       }
17365       return false;
17366       function hasDuplicates(n4, i4, arr) {
17367         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
17368       }
17369       function keyNodeFilter(froms, tos) {
17370         return function(n4) {
17371           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
17372         };
17373       }
17374       function collectNodes(member, collection) {
17375         var entity = graph.hasEntity(member.id);
17376         if (!entity) return;
17377         var role2 = member.role || "";
17378         if (!collection[role2]) {
17379           collection[role2] = [];
17380         }
17381         if (member.type === "node") {
17382           collection[role2].push(member.id);
17383           if (role2 === "via") {
17384             collection.keyfrom.push(member.id);
17385             collection.keyto.push(member.id);
17386           }
17387         } else if (member.type === "way") {
17388           collection[role2].push.apply(collection[role2], entity.nodes);
17389           if (role2 === "from" || role2 === "via") {
17390             collection.keyfrom.push(entity.first());
17391             collection.keyfrom.push(entity.last());
17392           }
17393           if (role2 === "to" || role2 === "via") {
17394             collection.keyto.push(entity.first());
17395             collection.keyto.push(entity.last());
17396           }
17397         }
17398       }
17399     };
17400     return action;
17401   }
17402   var init_connect = __esm({
17403     "modules/actions/connect.js"() {
17404       "use strict";
17405       init_delete_node();
17406       init_delete_way();
17407       init_util();
17408     }
17409   });
17410
17411   // modules/actions/copy_entities.js
17412   var copy_entities_exports = {};
17413   __export(copy_entities_exports, {
17414     actionCopyEntities: () => actionCopyEntities
17415   });
17416   function actionCopyEntities(ids, fromGraph) {
17417     var _copies = {};
17418     var action = function(graph) {
17419       ids.forEach(function(id3) {
17420         fromGraph.entity(id3).copy(fromGraph, _copies);
17421       });
17422       for (var id2 in _copies) {
17423         graph = graph.replace(_copies[id2]);
17424       }
17425       return graph;
17426     };
17427     action.copies = function() {
17428       return _copies;
17429     };
17430     return action;
17431   }
17432   var init_copy_entities = __esm({
17433     "modules/actions/copy_entities.js"() {
17434       "use strict";
17435     }
17436   });
17437
17438   // modules/actions/delete_member.js
17439   var delete_member_exports = {};
17440   __export(delete_member_exports, {
17441     actionDeleteMember: () => actionDeleteMember
17442   });
17443   function actionDeleteMember(relationId, memberIndex) {
17444     return function(graph) {
17445       var relation = graph.entity(relationId).removeMember(memberIndex);
17446       graph = graph.replace(relation);
17447       if (relation.isDegenerate()) {
17448         graph = actionDeleteRelation(relation.id)(graph);
17449       }
17450       return graph;
17451     };
17452   }
17453   var init_delete_member = __esm({
17454     "modules/actions/delete_member.js"() {
17455       "use strict";
17456       init_delete_relation();
17457     }
17458   });
17459
17460   // modules/actions/delete_members.js
17461   var delete_members_exports = {};
17462   __export(delete_members_exports, {
17463     actionDeleteMembers: () => actionDeleteMembers
17464   });
17465   function actionDeleteMembers(relationId, memberIndexes) {
17466     return function(graph) {
17467       memberIndexes.sort((a2, b2) => b2 - a2);
17468       for (var i3 in memberIndexes) {
17469         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
17470       }
17471       return graph;
17472     };
17473   }
17474   var init_delete_members = __esm({
17475     "modules/actions/delete_members.js"() {
17476       "use strict";
17477       init_delete_member();
17478     }
17479   });
17480
17481   // modules/actions/discard_tags.js
17482   var discard_tags_exports = {};
17483   __export(discard_tags_exports, {
17484     actionDiscardTags: () => actionDiscardTags
17485   });
17486   function actionDiscardTags(difference2, discardTags) {
17487     discardTags = discardTags || {};
17488     return (graph) => {
17489       difference2.modified().forEach(checkTags);
17490       difference2.created().forEach(checkTags);
17491       return graph;
17492       function checkTags(entity) {
17493         const keys2 = Object.keys(entity.tags);
17494         let didDiscard = false;
17495         let tags = {};
17496         for (let i3 = 0; i3 < keys2.length; i3++) {
17497           const k2 = keys2[i3];
17498           if (discardTags[k2] || !entity.tags[k2]) {
17499             didDiscard = true;
17500           } else {
17501             tags[k2] = entity.tags[k2];
17502           }
17503         }
17504         if (didDiscard) {
17505           graph = graph.replace(entity.update({ tags }));
17506         }
17507       }
17508     };
17509   }
17510   var init_discard_tags = __esm({
17511     "modules/actions/discard_tags.js"() {
17512       "use strict";
17513     }
17514   });
17515
17516   // modules/actions/disconnect.js
17517   var disconnect_exports = {};
17518   __export(disconnect_exports, {
17519     actionDisconnect: () => actionDisconnect
17520   });
17521   function actionDisconnect(nodeId, newNodeId) {
17522     var wayIds;
17523     var disconnectableRelationTypes = {
17524       "associatedStreet": true,
17525       "enforcement": true,
17526       "site": true
17527     };
17528     var action = function(graph) {
17529       var node = graph.entity(nodeId);
17530       var connections = action.connections(graph);
17531       connections.forEach(function(connection) {
17532         var way = graph.entity(connection.wayID);
17533         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
17534         graph = graph.replace(newNode);
17535         if (connection.index === 0 && way.isArea()) {
17536           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
17537         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
17538           graph = graph.replace(way.unclose().addNode(newNode.id));
17539         } else {
17540           graph = graph.replace(way.updateNode(newNode.id, connection.index));
17541         }
17542       });
17543       return graph;
17544     };
17545     action.connections = function(graph) {
17546       var candidates = [];
17547       var keeping = false;
17548       var parentWays = graph.parentWays(graph.entity(nodeId));
17549       var way, waynode;
17550       for (var i3 = 0; i3 < parentWays.length; i3++) {
17551         way = parentWays[i3];
17552         if (wayIds && wayIds.indexOf(way.id) === -1) {
17553           keeping = true;
17554           continue;
17555         }
17556         if (way.isArea() && way.nodes[0] === nodeId) {
17557           candidates.push({ wayID: way.id, index: 0 });
17558         } else {
17559           for (var j2 = 0; j2 < way.nodes.length; j2++) {
17560             waynode = way.nodes[j2];
17561             if (waynode === nodeId) {
17562               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
17563                 continue;
17564               }
17565               candidates.push({ wayID: way.id, index: j2 });
17566             }
17567           }
17568         }
17569       }
17570       return keeping ? candidates : candidates.slice(1);
17571     };
17572     action.disabled = function(graph) {
17573       var connections = action.connections(graph);
17574       if (connections.length === 0) return "not_connected";
17575       var parentWays = graph.parentWays(graph.entity(nodeId));
17576       var seenRelationIds = {};
17577       var sharedRelation;
17578       parentWays.forEach(function(way) {
17579         var relations = graph.parentRelations(way);
17580         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
17581           if (relation.id in seenRelationIds) {
17582             if (wayIds) {
17583               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
17584                 sharedRelation = relation;
17585               }
17586             } else {
17587               sharedRelation = relation;
17588             }
17589           } else {
17590             seenRelationIds[relation.id] = way.id;
17591           }
17592         });
17593       });
17594       if (sharedRelation) return "relation";
17595     };
17596     action.limitWays = function(val) {
17597       if (!arguments.length) return wayIds;
17598       wayIds = val;
17599       return action;
17600     };
17601     return action;
17602   }
17603   var init_disconnect = __esm({
17604     "modules/actions/disconnect.js"() {
17605       "use strict";
17606       init_node2();
17607     }
17608   });
17609
17610   // modules/actions/extract.js
17611   var extract_exports = {};
17612   __export(extract_exports, {
17613     actionExtract: () => actionExtract
17614   });
17615   function actionExtract(entityID, projection2) {
17616     var extractedNodeID;
17617     var action = function(graph, shiftKeyPressed) {
17618       var entity = graph.entity(entityID);
17619       if (entity.type === "node") {
17620         return extractFromNode(entity, graph, shiftKeyPressed);
17621       }
17622       return extractFromWayOrRelation(entity, graph);
17623     };
17624     function extractFromNode(node, graph, shiftKeyPressed) {
17625       extractedNodeID = node.id;
17626       var replacement = osmNode({ loc: node.loc });
17627       graph = graph.replace(replacement);
17628       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
17629         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
17630       }, graph);
17631       if (!shiftKeyPressed) return graph;
17632       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
17633         return accGraph.replace(parentRel.replaceMember(node, replacement));
17634       }, graph);
17635     }
17636     function extractFromWayOrRelation(entity, graph) {
17637       var fromGeometry = entity.geometry(graph);
17638       var keysToCopyAndRetain = ["source", "wheelchair"];
17639       var keysToRetain = ["area"];
17640       var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
17641       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
17642       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
17643       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
17644         extractedLoc = entity.extent(graph).center();
17645       }
17646       var indoorAreaValues = {
17647         area: true,
17648         corridor: true,
17649         elevator: true,
17650         level: true,
17651         room: true
17652       };
17653       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
17654       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
17655       var entityTags = Object.assign({}, entity.tags);
17656       var pointTags = {};
17657       for (var key in entityTags) {
17658         if (entity.type === "relation" && key === "type") {
17659           continue;
17660         }
17661         if (keysToRetain.indexOf(key) !== -1) {
17662           continue;
17663         }
17664         if (isBuilding) {
17665           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
17666         }
17667         if (isIndoorArea && key === "indoor") {
17668           continue;
17669         }
17670         pointTags[key] = entityTags[key];
17671         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
17672           continue;
17673         } else if (isIndoorArea && key === "level") {
17674           continue;
17675         }
17676         delete entityTags[key];
17677       }
17678       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
17679         entityTags.area = "yes";
17680       }
17681       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
17682       graph = graph.replace(replacement);
17683       extractedNodeID = replacement.id;
17684       return graph.replace(entity.update({ tags: entityTags }));
17685     }
17686     action.getExtractedNodeID = function() {
17687       return extractedNodeID;
17688     };
17689     return action;
17690   }
17691   var init_extract = __esm({
17692     "modules/actions/extract.js"() {
17693       "use strict";
17694       init_src2();
17695       init_node2();
17696     }
17697   });
17698
17699   // modules/actions/join.js
17700   var join_exports = {};
17701   __export(join_exports, {
17702     actionJoin: () => actionJoin
17703   });
17704   function actionJoin(ids) {
17705     function groupEntitiesByGeometry(graph) {
17706       var entities = ids.map(function(id2) {
17707         return graph.entity(id2);
17708       });
17709       return Object.assign(
17710         { line: [] },
17711         utilArrayGroupBy(entities, function(entity) {
17712           return entity.geometry(graph);
17713         })
17714       );
17715     }
17716     var action = function(graph) {
17717       var ways = ids.map(graph.entity, graph);
17718       var survivorID = utilOldestID(ways.map((way) => way.id));
17719       ways.sort(function(a2, b2) {
17720         var aSided = a2.isSided();
17721         var bSided = b2.isSided();
17722         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
17723       });
17724       var sequences = osmJoinWays(ways, graph);
17725       var joined = sequences[0];
17726       graph = sequences.actions.reduce(function(g3, action2) {
17727         return action2(g3);
17728       }, graph);
17729       var survivor = graph.entity(survivorID);
17730       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
17731         return n3.id;
17732       }) });
17733       graph = graph.replace(survivor);
17734       joined.forEach(function(way) {
17735         if (way.id === survivorID) return;
17736         graph.parentRelations(way).forEach(function(parent) {
17737           graph = graph.replace(parent.replaceMember(way, survivor));
17738         });
17739         const summedTags = {};
17740         for (const key in way.tags) {
17741           if (!canSumTags(key, way.tags, survivor.tags)) continue;
17742           summedTags[key] = (+way.tags[key] + +survivor.tags[key]).toString();
17743         }
17744         survivor = survivor.mergeTags(way.tags, summedTags);
17745         graph = graph.replace(survivor);
17746         graph = actionDeleteWay(way.id)(graph);
17747       });
17748       function checkForSimpleMultipolygon() {
17749         if (!survivor.isClosed()) return;
17750         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
17751           return multipolygon2.members.length === 1;
17752         });
17753         if (multipolygons.length !== 1) return;
17754         var multipolygon = multipolygons[0];
17755         for (var key in survivor.tags) {
17756           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
17757           multipolygon.tags[key] !== survivor.tags[key]) return;
17758         }
17759         survivor = survivor.mergeTags(multipolygon.tags);
17760         graph = graph.replace(survivor);
17761         graph = actionDeleteRelation(
17762           multipolygon.id,
17763           true
17764           /* allow untagged members */
17765         )(graph);
17766         var tags = Object.assign({}, survivor.tags);
17767         if (survivor.geometry(graph) !== "area") {
17768           tags.area = "yes";
17769         }
17770         delete tags.type;
17771         survivor = survivor.update({ tags });
17772         graph = graph.replace(survivor);
17773       }
17774       checkForSimpleMultipolygon();
17775       return graph;
17776     };
17777     action.resultingWayNodesLength = function(graph) {
17778       return ids.reduce(function(count, id2) {
17779         return count + graph.entity(id2).nodes.length;
17780       }, 0) - ids.length - 1;
17781     };
17782     action.disabled = function(graph) {
17783       var geometries = groupEntitiesByGeometry(graph);
17784       if (ids.length < 2 || ids.length !== geometries.line.length) {
17785         return "not_eligible";
17786       }
17787       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
17788       if (joined.length > 1) {
17789         return "not_adjacent";
17790       }
17791       var i3;
17792       var sortedParentRelations = function(id2) {
17793         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id.localeCompare(b2.id));
17794       };
17795       var relsA = sortedParentRelations(ids[0]);
17796       for (i3 = 1; i3 < ids.length; i3++) {
17797         var relsB = sortedParentRelations(ids[i3]);
17798         if (!utilArrayIdentical(relsA, relsB)) {
17799           return "conflicting_relations";
17800         }
17801       }
17802       for (i3 = 0; i3 < ids.length - 1; i3++) {
17803         for (var j2 = i3 + 1; j2 < ids.length; j2++) {
17804           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
17805             return e3.loc;
17806           });
17807           var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e3) {
17808             return e3.loc;
17809           });
17810           var intersections = geoPathIntersections(path1, path2);
17811           var common = utilArrayIntersection(
17812             joined[0].nodes.map(function(n3) {
17813               return n3.loc.toString();
17814             }),
17815             intersections.map(function(n3) {
17816               return n3.toString();
17817             })
17818           );
17819           if (common.length !== intersections.length) {
17820             return "paths_intersect";
17821           }
17822         }
17823       }
17824       var nodeIds = joined[0].nodes.map(function(n3) {
17825         return n3.id;
17826       }).slice(1, -1);
17827       var relation;
17828       var tags = {};
17829       var conflicting = false;
17830       joined[0].forEach(function(way) {
17831         var parents = graph.parentRelations(way);
17832         parents.forEach(function(parent) {
17833           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
17834             return nodeIds.indexOf(m2.id) >= 0;
17835           })) {
17836             relation = parent;
17837           }
17838         });
17839         for (var k2 in way.tags) {
17840           if (!(k2 in tags)) {
17841             tags[k2] = way.tags[k2];
17842           } else if (canSumTags(k2, tags, way.tags)) {
17843             tags[k2] = (+tags[k2] + +way.tags[k2]).toString();
17844           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
17845             conflicting = true;
17846           }
17847         }
17848       });
17849       if (relation) {
17850         return relation.isRestriction() ? "restriction" : "connectivity";
17851       }
17852       if (conflicting) {
17853         return "conflicting_tags";
17854       }
17855     };
17856     function canSumTags(key, tagsA, tagsB) {
17857       return osmSummableTags.has(key) && isFinite(tagsA[key] && isFinite(tagsB[key]));
17858     }
17859     return action;
17860   }
17861   var init_join2 = __esm({
17862     "modules/actions/join.js"() {
17863       "use strict";
17864       init_delete_relation();
17865       init_delete_way();
17866       init_tags();
17867       init_multipolygon();
17868       init_geo2();
17869       init_util();
17870     }
17871   });
17872
17873   // modules/actions/merge.js
17874   var merge_exports = {};
17875   __export(merge_exports, {
17876     actionMerge: () => actionMerge
17877   });
17878   function actionMerge(ids) {
17879     function groupEntitiesByGeometry(graph) {
17880       var entities = ids.map(function(id2) {
17881         return graph.entity(id2);
17882       });
17883       return Object.assign(
17884         { point: [], area: [], line: [], relation: [] },
17885         utilArrayGroupBy(entities, function(entity) {
17886           return entity.geometry(graph);
17887         })
17888       );
17889     }
17890     var action = function(graph) {
17891       var geometries = groupEntitiesByGeometry(graph);
17892       var target = geometries.area[0] || geometries.line[0];
17893       var points = geometries.point;
17894       points.forEach(function(point) {
17895         target = target.mergeTags(point.tags);
17896         graph = graph.replace(target);
17897         graph.parentRelations(point).forEach(function(parent) {
17898           graph = graph.replace(parent.replaceMember(point, target));
17899         });
17900         var nodes = utilArrayUniq(graph.childNodes(target));
17901         var removeNode = point;
17902         if (!point.isNew()) {
17903           var inserted = false;
17904           var canBeReplaced = function(node2) {
17905             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
17906           };
17907           var replaceNode = function(node2) {
17908             graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
17909             target = target.replaceNode(node2.id, point.id);
17910             graph = graph.replace(target);
17911             removeNode = node2;
17912             inserted = true;
17913           };
17914           var i3;
17915           var node;
17916           for (i3 = 0; i3 < nodes.length; i3++) {
17917             node = nodes[i3];
17918             if (canBeReplaced(node) && node.isNew()) {
17919               replaceNode(node);
17920               break;
17921             }
17922           }
17923           if (!inserted && point.hasInterestingTags()) {
17924             for (i3 = 0; i3 < nodes.length; i3++) {
17925               node = nodes[i3];
17926               if (canBeReplaced(node) && !node.hasInterestingTags()) {
17927                 replaceNode(node);
17928                 break;
17929               }
17930             }
17931             if (!inserted) {
17932               for (i3 = 0; i3 < nodes.length; i3++) {
17933                 node = nodes[i3];
17934                 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
17935                   replaceNode(node);
17936                   break;
17937                 }
17938               }
17939             }
17940           }
17941         }
17942         graph = graph.remove(removeNode);
17943       });
17944       if (target.tags.area === "yes") {
17945         var tags = Object.assign({}, target.tags);
17946         delete tags.area;
17947         if (osmTagSuggestingArea(tags)) {
17948           target = target.update({ tags });
17949           graph = graph.replace(target);
17950         }
17951       }
17952       return graph;
17953     };
17954     action.disabled = function(graph) {
17955       var geometries = groupEntitiesByGeometry(graph);
17956       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
17957         return "not_eligible";
17958       }
17959     };
17960     return action;
17961   }
17962   var init_merge5 = __esm({
17963     "modules/actions/merge.js"() {
17964       "use strict";
17965       init_tags();
17966       init_util();
17967     }
17968   });
17969
17970   // modules/actions/merge_nodes.js
17971   var merge_nodes_exports = {};
17972   __export(merge_nodes_exports, {
17973     actionMergeNodes: () => actionMergeNodes
17974   });
17975   function actionMergeNodes(nodeIDs, loc) {
17976     function chooseLoc(graph) {
17977       if (!nodeIDs.length) return null;
17978       var sum = [0, 0];
17979       var interestingCount = 0;
17980       var interestingLoc;
17981       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
17982         var node = graph.entity(nodeIDs[i3]);
17983         if (node.hasInterestingTags()) {
17984           interestingLoc = ++interestingCount === 1 ? node.loc : null;
17985         }
17986         sum = geoVecAdd(sum, node.loc);
17987       }
17988       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
17989     }
17990     var action = function(graph) {
17991       if (nodeIDs.length < 2) return graph;
17992       var toLoc = loc;
17993       if (!toLoc) {
17994         toLoc = chooseLoc(graph);
17995       }
17996       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
17997         var node = graph.entity(nodeIDs[i3]);
17998         if (node.loc !== toLoc) {
17999           graph = graph.replace(node.move(toLoc));
18000         }
18001       }
18002       return actionConnect(nodeIDs)(graph);
18003     };
18004     action.disabled = function(graph) {
18005       if (nodeIDs.length < 2) return "not_eligible";
18006       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
18007         var entity = graph.entity(nodeIDs[i3]);
18008         if (entity.type !== "node") return "not_eligible";
18009       }
18010       return actionConnect(nodeIDs).disabled(graph);
18011     };
18012     return action;
18013   }
18014   var init_merge_nodes = __esm({
18015     "modules/actions/merge_nodes.js"() {
18016       "use strict";
18017       init_connect();
18018       init_geo2();
18019     }
18020   });
18021
18022   // modules/osm/changeset.js
18023   var changeset_exports = {};
18024   __export(changeset_exports, {
18025     osmChangeset: () => osmChangeset
18026   });
18027   function osmChangeset() {
18028     if (!(this instanceof osmChangeset)) {
18029       return new osmChangeset().initialize(arguments);
18030     } else if (arguments.length) {
18031       this.initialize(arguments);
18032     }
18033   }
18034   var init_changeset = __esm({
18035     "modules/osm/changeset.js"() {
18036       "use strict";
18037       init_entity();
18038       init_geo2();
18039       osmEntity.changeset = osmChangeset;
18040       osmChangeset.prototype = Object.create(osmEntity.prototype);
18041       Object.assign(osmChangeset.prototype, {
18042         type: "changeset",
18043         extent: function() {
18044           return new geoExtent();
18045         },
18046         geometry: function() {
18047           return "changeset";
18048         },
18049         asJXON: function() {
18050           return {
18051             osm: {
18052               changeset: {
18053                 tag: Object.keys(this.tags).map(function(k2) {
18054                   return { "@k": k2, "@v": this.tags[k2] };
18055                 }, this),
18056                 "@version": 0.6,
18057                 "@generator": "iD"
18058               }
18059             }
18060           };
18061         },
18062         // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
18063         // XML. Returns a string.
18064         osmChangeJXON: function(changes) {
18065           var changeset_id = this.id;
18066           function nest(x2, order) {
18067             var groups = {};
18068             for (var i3 = 0; i3 < x2.length; i3++) {
18069               var tagName = Object.keys(x2[i3])[0];
18070               if (!groups[tagName]) groups[tagName] = [];
18071               groups[tagName].push(x2[i3][tagName]);
18072             }
18073             var ordered = {};
18074             order.forEach(function(o2) {
18075               if (groups[o2]) ordered[o2] = groups[o2];
18076             });
18077             return ordered;
18078           }
18079           function sort(changes2) {
18080             function resolve(item) {
18081               return relations.find(function(relation2) {
18082                 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
18083               });
18084             }
18085             function isNew(item) {
18086               return !sorted[item["@id"]] && !processing.find(function(proc) {
18087                 return proc["@id"] === item["@id"];
18088               });
18089             }
18090             var processing = [];
18091             var sorted = {};
18092             var relations = changes2.relation;
18093             if (!relations) return changes2;
18094             for (var i3 = 0; i3 < relations.length; i3++) {
18095               var relation = relations[i3];
18096               if (!sorted[relation["@id"]]) {
18097                 processing.push(relation);
18098               }
18099               while (processing.length > 0) {
18100                 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
18101                 if (deps.length === 0) {
18102                   sorted[next["@id"]] = next;
18103                   processing.shift();
18104                 } else {
18105                   processing = deps.concat(processing);
18106                 }
18107               }
18108             }
18109             changes2.relation = Object.values(sorted);
18110             return changes2;
18111           }
18112           function rep(entity) {
18113             return entity.asJXON(changeset_id);
18114           }
18115           return {
18116             osmChange: {
18117               "@version": 0.6,
18118               "@generator": "iD",
18119               "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
18120               "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
18121               "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
18122             }
18123           };
18124         },
18125         asGeoJSON: function() {
18126           return {};
18127         }
18128       });
18129     }
18130   });
18131
18132   // modules/osm/note.js
18133   var note_exports = {};
18134   __export(note_exports, {
18135     osmNote: () => osmNote
18136   });
18137   function osmNote() {
18138     if (!(this instanceof osmNote)) {
18139       return new osmNote().initialize(arguments);
18140     } else if (arguments.length) {
18141       this.initialize(arguments);
18142     }
18143   }
18144   var init_note = __esm({
18145     "modules/osm/note.js"() {
18146       "use strict";
18147       init_geo2();
18148       osmNote.id = function() {
18149         return osmNote.id.next--;
18150       };
18151       osmNote.id.next = -1;
18152       Object.assign(osmNote.prototype, {
18153         type: "note",
18154         initialize: function(sources) {
18155           for (var i3 = 0; i3 < sources.length; ++i3) {
18156             var source = sources[i3];
18157             for (var prop in source) {
18158               if (Object.prototype.hasOwnProperty.call(source, prop)) {
18159                 if (source[prop] === void 0) {
18160                   delete this[prop];
18161                 } else {
18162                   this[prop] = source[prop];
18163                 }
18164               }
18165             }
18166           }
18167           if (!this.id) {
18168             this.id = osmNote.id().toString();
18169           }
18170           return this;
18171         },
18172         extent: function() {
18173           return new geoExtent(this.loc);
18174         },
18175         update: function(attrs) {
18176           return osmNote(this, attrs);
18177         },
18178         isNew: function() {
18179           return this.id < 0;
18180         },
18181         move: function(loc) {
18182           return this.update({ loc });
18183         }
18184       });
18185     }
18186   });
18187
18188   // modules/osm/relation.js
18189   var relation_exports = {};
18190   __export(relation_exports, {
18191     osmRelation: () => osmRelation
18192   });
18193   function osmRelation() {
18194     if (!(this instanceof osmRelation)) {
18195       return new osmRelation().initialize(arguments);
18196     } else if (arguments.length) {
18197       this.initialize(arguments);
18198     }
18199   }
18200   var prototype2;
18201   var init_relation = __esm({
18202     "modules/osm/relation.js"() {
18203       "use strict";
18204       init_src2();
18205       init_entity();
18206       init_multipolygon();
18207       init_geo2();
18208       osmEntity.relation = osmRelation;
18209       osmRelation.prototype = Object.create(osmEntity.prototype);
18210       osmRelation.creationOrder = function(a2, b2) {
18211         var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
18212         var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
18213         if (aId < 0 || bId < 0) return aId - bId;
18214         return bId - aId;
18215       };
18216       prototype2 = {
18217         type: "relation",
18218         members: [],
18219         copy: function(resolver, copies) {
18220           if (copies[this.id]) return copies[this.id];
18221           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
18222           var members = this.members.map(function(member) {
18223             return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
18224           });
18225           copy2 = copy2.update({ members });
18226           copies[this.id] = copy2;
18227           return copy2;
18228         },
18229         extent: function(resolver, memo) {
18230           return resolver.transient(this, "extent", function() {
18231             if (memo && memo[this.id]) return geoExtent();
18232             memo = memo || {};
18233             memo[this.id] = true;
18234             var extent = geoExtent();
18235             for (var i3 = 0; i3 < this.members.length; i3++) {
18236               var member = resolver.hasEntity(this.members[i3].id);
18237               if (member) {
18238                 extent._extend(member.extent(resolver, memo));
18239               }
18240             }
18241             return extent;
18242           });
18243         },
18244         geometry: function(graph) {
18245           return graph.transient(this, "geometry", function() {
18246             return this.isMultipolygon() ? "area" : "relation";
18247           });
18248         },
18249         isDegenerate: function() {
18250           return this.members.length === 0;
18251         },
18252         // Return an array of members, each extended with an 'index' property whose value
18253         // is the member index.
18254         indexedMembers: function() {
18255           var result = new Array(this.members.length);
18256           for (var i3 = 0; i3 < this.members.length; i3++) {
18257             result[i3] = Object.assign({}, this.members[i3], { index: i3 });
18258           }
18259           return result;
18260         },
18261         // Return the first member with the given role. A copy of the member object
18262         // is returned, extended with an 'index' property whose value is the member index.
18263         memberByRole: function(role) {
18264           for (var i3 = 0; i3 < this.members.length; i3++) {
18265             if (this.members[i3].role === role) {
18266               return Object.assign({}, this.members[i3], { index: i3 });
18267             }
18268           }
18269         },
18270         // Same as memberByRole, but returns all members with the given role
18271         membersByRole: function(role) {
18272           var result = [];
18273           for (var i3 = 0; i3 < this.members.length; i3++) {
18274             if (this.members[i3].role === role) {
18275               result.push(Object.assign({}, this.members[i3], { index: i3 }));
18276             }
18277           }
18278           return result;
18279         },
18280         // Return the first member with the given id. A copy of the member object
18281         // is returned, extended with an 'index' property whose value is the member index.
18282         memberById: function(id2) {
18283           for (var i3 = 0; i3 < this.members.length; i3++) {
18284             if (this.members[i3].id === id2) {
18285               return Object.assign({}, this.members[i3], { index: i3 });
18286             }
18287           }
18288         },
18289         // Return the first member with the given id and role. A copy of the member object
18290         // is returned, extended with an 'index' property whose value is the member index.
18291         memberByIdAndRole: function(id2, role) {
18292           for (var i3 = 0; i3 < this.members.length; i3++) {
18293             if (this.members[i3].id === id2 && this.members[i3].role === role) {
18294               return Object.assign({}, this.members[i3], { index: i3 });
18295             }
18296           }
18297         },
18298         addMember: function(member, index) {
18299           var members = this.members.slice();
18300           members.splice(index === void 0 ? members.length : index, 0, member);
18301           return this.update({ members });
18302         },
18303         updateMember: function(member, index) {
18304           var members = this.members.slice();
18305           members.splice(index, 1, Object.assign({}, members[index], member));
18306           return this.update({ members });
18307         },
18308         removeMember: function(index) {
18309           var members = this.members.slice();
18310           members.splice(index, 1);
18311           return this.update({ members });
18312         },
18313         removeMembersWithID: function(id2) {
18314           var members = this.members.filter(function(m2) {
18315             return m2.id !== id2;
18316           });
18317           return this.update({ members });
18318         },
18319         moveMember: function(fromIndex, toIndex) {
18320           var members = this.members.slice();
18321           members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
18322           return this.update({ members });
18323         },
18324         // Wherever a member appears with id `needle.id`, replace it with a member
18325         // with id `replacement.id`, type `replacement.type`, and the original role,
18326         // By default, adding a duplicate member (by id and role) is prevented.
18327         // Return an updated relation.
18328         replaceMember: function(needle, replacement, keepDuplicates) {
18329           if (!this.memberById(needle.id)) return this;
18330           var members = [];
18331           for (var i3 = 0; i3 < this.members.length; i3++) {
18332             var member = this.members[i3];
18333             if (member.id !== needle.id) {
18334               members.push(member);
18335             } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
18336               members.push({ id: replacement.id, type: replacement.type, role: member.role });
18337             }
18338           }
18339           return this.update({ members });
18340         },
18341         asJXON: function(changeset_id) {
18342           var r2 = {
18343             relation: {
18344               "@id": this.osmId(),
18345               "@version": this.version || 0,
18346               member: this.members.map(function(member) {
18347                 return {
18348                   keyAttributes: {
18349                     type: member.type,
18350                     role: member.role,
18351                     ref: osmEntity.id.toOSM(member.id)
18352                   }
18353                 };
18354               }, this),
18355               tag: Object.keys(this.tags).map(function(k2) {
18356                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
18357               }, this)
18358             }
18359           };
18360           if (changeset_id) {
18361             r2.relation["@changeset"] = changeset_id;
18362           }
18363           return r2;
18364         },
18365         asGeoJSON: function(resolver) {
18366           return resolver.transient(this, "GeoJSON", function() {
18367             if (this.isMultipolygon()) {
18368               return {
18369                 type: "MultiPolygon",
18370                 coordinates: this.multipolygon(resolver)
18371               };
18372             } else {
18373               return {
18374                 type: "FeatureCollection",
18375                 properties: this.tags,
18376                 features: this.members.map(function(member) {
18377                   return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
18378                 })
18379               };
18380             }
18381           });
18382         },
18383         area: function(resolver) {
18384           return resolver.transient(this, "area", function() {
18385             return area_default(this.asGeoJSON(resolver));
18386           });
18387         },
18388         isMultipolygon: function() {
18389           return this.tags.type === "multipolygon";
18390         },
18391         isComplete: function(resolver) {
18392           for (var i3 = 0; i3 < this.members.length; i3++) {
18393             if (!resolver.hasEntity(this.members[i3].id)) {
18394               return false;
18395             }
18396           }
18397           return true;
18398         },
18399         hasFromViaTo: function() {
18400           return this.members.some(function(m2) {
18401             return m2.role === "from";
18402           }) && this.members.some(
18403             (m2) => m2.role === "via" || m2.role === "intersection" && this.tags.type === "destination_sign"
18404           ) && this.members.some(function(m2) {
18405             return m2.role === "to";
18406           });
18407         },
18408         isRestriction: function() {
18409           return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
18410         },
18411         isValidRestriction: function() {
18412           if (!this.isRestriction()) return false;
18413           var froms = this.members.filter(function(m2) {
18414             return m2.role === "from";
18415           });
18416           var vias = this.members.filter(function(m2) {
18417             return m2.role === "via";
18418           });
18419           var tos = this.members.filter(function(m2) {
18420             return m2.role === "to";
18421           });
18422           if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
18423           if (froms.some(function(m2) {
18424             return m2.type !== "way";
18425           })) return false;
18426           if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
18427           if (tos.some(function(m2) {
18428             return m2.type !== "way";
18429           })) return false;
18430           if (vias.length === 0) return false;
18431           if (vias.length > 1 && vias.some(function(m2) {
18432             return m2.type !== "way";
18433           })) return false;
18434           return true;
18435         },
18436         isConnectivity: function() {
18437           return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
18438         },
18439         // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
18440         // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
18441         //
18442         // This corresponds to the structure needed for rendering a multipolygon path using a
18443         // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
18444         //
18445         // In the case of invalid geometries, this function will still return a result which
18446         // includes the nodes of all way members, but some Nds may be unclosed and some inner
18447         // rings not matched with the intended outer ring.
18448         //
18449         multipolygon: function(resolver) {
18450           var outers = this.members.filter(function(m2) {
18451             return "outer" === (m2.role || "outer");
18452           });
18453           var inners = this.members.filter(function(m2) {
18454             return "inner" === m2.role;
18455           });
18456           outers = osmJoinWays(outers, resolver);
18457           inners = osmJoinWays(inners, resolver);
18458           var sequenceToLineString = function(sequence) {
18459             if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
18460               sequence.nodes.push(sequence.nodes[0]);
18461             }
18462             return sequence.nodes.map(function(node) {
18463               return node.loc;
18464             });
18465           };
18466           outers = outers.map(sequenceToLineString);
18467           inners = inners.map(sequenceToLineString);
18468           var result = outers.map(function(o3) {
18469             return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
18470           });
18471           function findOuter(inner2) {
18472             var o3, outer;
18473             for (o3 = 0; o3 < outers.length; o3++) {
18474               outer = outers[o3];
18475               if (geoPolygonContainsPolygon(outer, inner2)) {
18476                 return o3;
18477               }
18478             }
18479             for (o3 = 0; o3 < outers.length; o3++) {
18480               outer = outers[o3];
18481               if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
18482                 return o3;
18483               }
18484             }
18485           }
18486           for (var i3 = 0; i3 < inners.length; i3++) {
18487             var inner = inners[i3];
18488             if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
18489               inner = inner.reverse();
18490             }
18491             var o2 = findOuter(inners[i3]);
18492             if (o2 !== void 0) {
18493               result[o2].push(inners[i3]);
18494             } else {
18495               result.push([inners[i3]]);
18496             }
18497           }
18498           return result;
18499         }
18500       };
18501       Object.assign(osmRelation.prototype, prototype2);
18502     }
18503   });
18504
18505   // modules/osm/qa_item.js
18506   var qa_item_exports = {};
18507   __export(qa_item_exports, {
18508     QAItem: () => QAItem
18509   });
18510   var QAItem;
18511   var init_qa_item = __esm({
18512     "modules/osm/qa_item.js"() {
18513       "use strict";
18514       QAItem = class _QAItem {
18515         constructor(loc, service, itemType, id2, props) {
18516           this.loc = loc;
18517           this.service = service.title;
18518           this.itemType = itemType;
18519           this.id = id2 ? id2 : `${_QAItem.id()}`;
18520           this.update(props);
18521           if (service && typeof service.getIcon === "function") {
18522             this.icon = service.getIcon(itemType);
18523           }
18524         }
18525         update(props) {
18526           const { loc, service, itemType, id: id2 } = this;
18527           Object.keys(props).forEach((prop) => this[prop] = props[prop]);
18528           this.loc = loc;
18529           this.service = service;
18530           this.itemType = itemType;
18531           this.id = id2;
18532           return this;
18533         }
18534         // Generic handling for newly created QAItems
18535         static id() {
18536           return this.nextId--;
18537         }
18538       };
18539       QAItem.nextId = -1;
18540     }
18541   });
18542
18543   // modules/actions/split.js
18544   var split_exports = {};
18545   __export(split_exports, {
18546     actionSplit: () => actionSplit
18547   });
18548   function actionSplit(nodeIds, newWayIds) {
18549     if (typeof nodeIds === "string") nodeIds = [nodeIds];
18550     var _wayIDs;
18551     var _keepHistoryOn = "longest";
18552     const circularJunctions = ["roundabout", "circular"];
18553     var _createdWayIDs = [];
18554     function dist(graph, nA, nB) {
18555       var locA = graph.entity(nA).loc;
18556       var locB = graph.entity(nB).loc;
18557       var epsilon3 = 1e-6;
18558       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
18559     }
18560     function splitArea(nodes, idxA, graph) {
18561       var lengths = new Array(nodes.length);
18562       var length2;
18563       var i3;
18564       var best = 0;
18565       var idxB;
18566       function wrap2(index) {
18567         return utilWrap(index, nodes.length);
18568       }
18569       length2 = 0;
18570       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
18571         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
18572         lengths[i3] = length2;
18573       }
18574       length2 = 0;
18575       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
18576         length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
18577         if (length2 < lengths[i3]) {
18578           lengths[i3] = length2;
18579         }
18580       }
18581       for (i3 = 0; i3 < nodes.length; i3++) {
18582         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
18583         if (cost > best) {
18584           idxB = i3;
18585           best = cost;
18586         }
18587       }
18588       return idxB;
18589     }
18590     function totalLengthBetweenNodes(graph, nodes) {
18591       var totalLength = 0;
18592       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
18593         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
18594       }
18595       return totalLength;
18596     }
18597     function split(graph, nodeId, wayA, newWayId, otherNodeIds) {
18598       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
18599       var nodesA;
18600       var nodesB;
18601       var isArea = wayA.isArea();
18602       if (wayA.isClosed()) {
18603         var nodes = wayA.nodes.slice(0, -1);
18604         var idxA = nodes.indexOf(nodeId);
18605         var idxB = otherNodeIds.length > 0 ? nodes.indexOf(otherNodeIds[0]) : splitArea(nodes, idxA, graph);
18606         if (idxB < idxA) {
18607           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
18608           nodesB = nodes.slice(idxB, idxA + 1);
18609         } else {
18610           nodesA = nodes.slice(idxA, idxB + 1);
18611           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
18612         }
18613       } else {
18614         var idx = wayA.nodes.indexOf(nodeId, 1);
18615         nodesA = wayA.nodes.slice(0, idx + 1);
18616         nodesB = wayA.nodes.slice(idx);
18617       }
18618       var lengthA = totalLengthBetweenNodes(graph, nodesA);
18619       var lengthB = totalLengthBetweenNodes(graph, nodesB);
18620       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
18621         wayA = wayA.update({ nodes: nodesB });
18622         wayB = wayB.update({ nodes: nodesA });
18623         var temp = lengthA;
18624         lengthA = lengthB;
18625         lengthB = temp;
18626       } else {
18627         wayA = wayA.update({ nodes: nodesA });
18628         wayB = wayB.update({ nodes: nodesB });
18629       }
18630       for (const key in wayA.tags) {
18631         if (!osmSummableTags.has(key)) continue;
18632         var count = Number(wayA.tags[key]);
18633         if (count && // ensure a number
18634         isFinite(count) && // ensure positive
18635         count > 0 && // ensure integer
18636         Math.round(count) === count) {
18637           var tagsA = Object.assign({}, wayA.tags);
18638           var tagsB = Object.assign({}, wayB.tags);
18639           var ratioA = lengthA / (lengthA + lengthB);
18640           var countA = Math.round(count * ratioA);
18641           tagsA[key] = countA.toString();
18642           tagsB[key] = (count - countA).toString();
18643           wayA = wayA.update({ tags: tagsA });
18644           wayB = wayB.update({ tags: tagsB });
18645         }
18646       }
18647       graph = graph.replace(wayA);
18648       graph = graph.replace(wayB);
18649       graph.parentRelations(wayA).forEach(function(relation) {
18650         if (relation.hasFromViaTo()) {
18651           var f2 = relation.memberByRole("from");
18652           var v2 = [
18653             ...relation.membersByRole("via"),
18654             ...relation.membersByRole("intersection")
18655           ];
18656           var t2 = relation.memberByRole("to");
18657           var i3;
18658           if (f2.id === wayA.id || t2.id === wayA.id) {
18659             var keepB = false;
18660             if (v2.length === 1 && v2[0].type === "node") {
18661               keepB = wayB.contains(v2[0].id);
18662             } else {
18663               for (i3 = 0; i3 < v2.length; i3++) {
18664                 if (v2[i3].type === "way") {
18665                   var wayVia = graph.hasEntity(v2[i3].id);
18666                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
18667                     keepB = true;
18668                     break;
18669                   }
18670                 }
18671               }
18672             }
18673             if (keepB) {
18674               relation = relation.replaceMember(wayA, wayB);
18675               graph = graph.replace(relation);
18676             }
18677           } else {
18678             for (i3 = 0; i3 < v2.length; i3++) {
18679               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
18680                 graph = splitWayMember(graph, relation.id, wayA, wayB);
18681               }
18682             }
18683           }
18684         } else {
18685           graph = splitWayMember(graph, relation.id, wayA, wayB);
18686         }
18687       });
18688       if (isArea) {
18689         var multipolygon = osmRelation({
18690           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
18691           members: [
18692             { id: wayA.id, role: "outer", type: "way" },
18693             { id: wayB.id, role: "outer", type: "way" }
18694           ]
18695         });
18696         graph = graph.replace(multipolygon);
18697         graph = graph.replace(wayA.update({ tags: {} }));
18698         graph = graph.replace(wayB.update({ tags: {} }));
18699       }
18700       _createdWayIDs.push(wayB.id);
18701       return graph;
18702     }
18703     function splitWayMember(graph, relationId, wayA, wayB) {
18704       function connects(way1, way2) {
18705         if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
18706         if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
18707           return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
18708         } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
18709           return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
18710         }
18711         if (way1.nodes[0] === way2.nodes[0]) return true;
18712         if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
18713         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
18714         if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
18715         return false;
18716       }
18717       let relation = graph.entity(relationId);
18718       const insertMembers = [];
18719       const members = relation.members;
18720       for (let i3 = 0; i3 < members.length; i3++) {
18721         const member = members[i3];
18722         if (member.id === wayA.id) {
18723           let wayAconnectsPrev = false;
18724           let wayAconnectsNext = false;
18725           let wayBconnectsPrev = false;
18726           let wayBconnectsNext = false;
18727           if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
18728             const prevEntity = graph.entity(members[i3 - 1].id);
18729             if (prevEntity.type === "way") {
18730               wayAconnectsPrev = connects(prevEntity, wayA);
18731               wayBconnectsPrev = connects(prevEntity, wayB);
18732             }
18733           }
18734           if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
18735             const nextEntity = graph.entity(members[i3 + 1].id);
18736             if (nextEntity.type === "way") {
18737               wayAconnectsNext = connects(nextEntity, wayA);
18738               wayBconnectsNext = connects(nextEntity, wayB);
18739             }
18740           }
18741           if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
18742             insertMembers.push({ at: i3 + 1, role: member.role });
18743             continue;
18744           }
18745           if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
18746             insertMembers.push({ at: i3, role: member.role });
18747             continue;
18748           }
18749           if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
18750             if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
18751               const prev2Entity = graph.entity(members[i3 - 2].id);
18752               if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
18753                 insertMembers.push({ at: i3, role: member.role });
18754                 continue;
18755               }
18756               if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
18757                 insertMembers.push({ at: i3 + 1, role: member.role });
18758                 continue;
18759               }
18760             }
18761             if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
18762               const next2Entity = graph.entity(members[i3 + 2].id);
18763               if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
18764                 insertMembers.push({ at: i3 + 1, role: member.role });
18765                 continue;
18766               }
18767               if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
18768                 insertMembers.push({ at: i3, role: member.role });
18769                 continue;
18770               }
18771             }
18772           }
18773           if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
18774             insertMembers.push({ at: i3 + 1, role: member.role });
18775           } else {
18776             insertMembers.push({ at: i3, role: member.role });
18777           }
18778         }
18779       }
18780       insertMembers.reverse().forEach((item) => {
18781         graph = graph.replace(relation.addMember({
18782           id: wayB.id,
18783           type: "way",
18784           role: item.role
18785         }, item.at));
18786         relation = graph.entity(relation.id);
18787       });
18788       return graph;
18789     }
18790     const action = function(graph) {
18791       _createdWayIDs = [];
18792       let newWayIndex = 0;
18793       for (const i3 in nodeIds) {
18794         const nodeId = nodeIds[i3];
18795         const candidates = waysForNodes(nodeIds.slice(i3), graph);
18796         for (const candidate of candidates) {
18797           graph = split(graph, nodeId, candidate, newWayIds && newWayIds[newWayIndex], nodeIds.slice(i3 + 1));
18798           newWayIndex += 1;
18799         }
18800       }
18801       return graph;
18802     };
18803     action.getCreatedWayIDs = function() {
18804       return _createdWayIDs;
18805     };
18806     function waysForNodes(nodeIds2, graph) {
18807       const splittableWays = nodeIds2.map((nodeId) => waysForNode(nodeId, graph)).reduce((cur, acc) => utilArrayIntersection(cur, acc));
18808       if (!_wayIDs) {
18809         const hasLine = splittableWays.some((way) => way.geometry(graph) === "line");
18810         if (hasLine) {
18811           return splittableWays.filter((way) => way.geometry(graph) === "line");
18812         }
18813       }
18814       return splittableWays;
18815     }
18816     function waysForNode(nodeId, graph) {
18817       const node = graph.entity(nodeId);
18818       return graph.parentWays(node).filter(isSplittable);
18819       function isSplittable(way) {
18820         if (_wayIDs && _wayIDs.indexOf(way.id) === -1) return false;
18821         if (way.isClosed()) return true;
18822         for (let i3 = 1; i3 < way.nodes.length - 1; i3++) {
18823           if (way.nodes[i3] === nodeId) return true;
18824         }
18825         return false;
18826       }
18827     }
18828     ;
18829     action.ways = function(graph) {
18830       return waysForNodes(nodeIds, graph);
18831     };
18832     action.disabled = function(graph) {
18833       const candidates = waysForNodes(nodeIds, graph);
18834       if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
18835         return "not_eligible";
18836       }
18837       for (const way of candidates) {
18838         const parentRelations = graph.parentRelations(way);
18839         for (const parentRelation of parentRelations) {
18840           if (parentRelation.hasFromViaTo()) {
18841             const vias = [
18842               ...parentRelation.membersByRole("via"),
18843               ...parentRelation.membersByRole("intersection")
18844             ];
18845             if (!vias.every((via) => graph.hasEntity(via.id))) {
18846               return "parent_incomplete";
18847             }
18848           } else {
18849             for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
18850               if (parentRelation.members[i3].id === way.id) {
18851                 const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
18852                 const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
18853                 if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
18854                   return "parent_incomplete";
18855                 }
18856               }
18857             }
18858           }
18859           const relTypesExceptions = ["junction", "enforcement"];
18860           if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
18861             return "simple_roundabout";
18862           }
18863         }
18864       }
18865     };
18866     action.limitWays = function(val) {
18867       if (!arguments.length) return _wayIDs;
18868       _wayIDs = val;
18869       return action;
18870     };
18871     action.keepHistoryOn = function(val) {
18872       if (!arguments.length) return _keepHistoryOn;
18873       _keepHistoryOn = val;
18874       return action;
18875     };
18876     return action;
18877   }
18878   var init_split = __esm({
18879     "modules/actions/split.js"() {
18880       "use strict";
18881       init_geo();
18882       init_relation();
18883       init_way();
18884       init_util();
18885       init_tags();
18886     }
18887   });
18888
18889   // modules/core/graph.js
18890   var graph_exports = {};
18891   __export(graph_exports, {
18892     coreGraph: () => coreGraph
18893   });
18894   function coreGraph(other2, mutable) {
18895     if (!(this instanceof coreGraph)) return new coreGraph(other2, mutable);
18896     if (other2 instanceof coreGraph) {
18897       var base = other2.base();
18898       this.entities = Object.assign(Object.create(base.entities), other2.entities);
18899       this._parentWays = Object.assign(Object.create(base.parentWays), other2._parentWays);
18900       this._parentRels = Object.assign(Object.create(base.parentRels), other2._parentRels);
18901     } else {
18902       this.entities = /* @__PURE__ */ Object.create({});
18903       this._parentWays = /* @__PURE__ */ Object.create({});
18904       this._parentRels = /* @__PURE__ */ Object.create({});
18905       this.rebase(other2 || [], [this]);
18906     }
18907     this.transients = {};
18908     this._childNodes = {};
18909     this.frozen = !mutable;
18910   }
18911   var init_graph = __esm({
18912     "modules/core/graph.js"() {
18913       "use strict";
18914       init_index();
18915       init_util();
18916       coreGraph.prototype = {
18917         hasEntity: function(id2) {
18918           return this.entities[id2];
18919         },
18920         entity: function(id2) {
18921           var entity = this.entities[id2];
18922           if (!entity) {
18923             throw new Error("entity " + id2 + " not found");
18924           }
18925           return entity;
18926         },
18927         geometry: function(id2) {
18928           return this.entity(id2).geometry(this);
18929         },
18930         transient: function(entity, key, fn) {
18931           var id2 = entity.id;
18932           var transients = this.transients[id2] || (this.transients[id2] = {});
18933           if (transients[key] !== void 0) {
18934             return transients[key];
18935           }
18936           transients[key] = fn.call(entity);
18937           return transients[key];
18938         },
18939         parentWays: function(entity) {
18940           var parents = this._parentWays[entity.id];
18941           var result = [];
18942           if (parents) {
18943             parents.forEach(function(id2) {
18944               result.push(this.entity(id2));
18945             }, this);
18946           }
18947           return result;
18948         },
18949         isPoi: function(entity) {
18950           var parents = this._parentWays[entity.id];
18951           return !parents || parents.size === 0;
18952         },
18953         isShared: function(entity) {
18954           var parents = this._parentWays[entity.id];
18955           return parents && parents.size > 1;
18956         },
18957         parentRelations: function(entity) {
18958           var parents = this._parentRels[entity.id];
18959           var result = [];
18960           if (parents) {
18961             parents.forEach(function(id2) {
18962               result.push(this.entity(id2));
18963             }, this);
18964           }
18965           return result;
18966         },
18967         parentMultipolygons: function(entity) {
18968           return this.parentRelations(entity).filter(function(relation) {
18969             return relation.isMultipolygon();
18970           });
18971         },
18972         childNodes: function(entity) {
18973           if (this._childNodes[entity.id]) return this._childNodes[entity.id];
18974           if (!entity.nodes) return [];
18975           var nodes = [];
18976           for (var i3 = 0; i3 < entity.nodes.length; i3++) {
18977             nodes[i3] = this.entity(entity.nodes[i3]);
18978           }
18979           if (debug) Object.freeze(nodes);
18980           this._childNodes[entity.id] = nodes;
18981           return this._childNodes[entity.id];
18982         },
18983         base: function() {
18984           return {
18985             "entities": Object.getPrototypeOf(this.entities),
18986             "parentWays": Object.getPrototypeOf(this._parentWays),
18987             "parentRels": Object.getPrototypeOf(this._parentRels)
18988           };
18989         },
18990         // Unlike other graph methods, rebase mutates in place. This is because it
18991         // is used only during the history operation that merges newly downloaded
18992         // data into each state. To external consumers, it should appear as if the
18993         // graph always contained the newly downloaded data.
18994         rebase: function(entities, stack, force) {
18995           var base = this.base();
18996           var i3, j2, k2, id2;
18997           for (i3 = 0; i3 < entities.length; i3++) {
18998             var entity = entities[i3];
18999             if (!entity.visible || !force && base.entities[entity.id]) continue;
19000             base.entities[entity.id] = entity;
19001             this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
19002             if (entity.type === "way") {
19003               for (j2 = 0; j2 < entity.nodes.length; j2++) {
19004                 id2 = entity.nodes[j2];
19005                 for (k2 = 1; k2 < stack.length; k2++) {
19006                   var ents = stack[k2].entities;
19007                   if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
19008                     delete ents[id2];
19009                   }
19010                 }
19011               }
19012             }
19013           }
19014           for (i3 = 0; i3 < stack.length; i3++) {
19015             stack[i3]._updateRebased();
19016           }
19017         },
19018         _updateRebased: function() {
19019           var base = this.base();
19020           Object.keys(this._parentWays).forEach(function(child) {
19021             if (base.parentWays[child]) {
19022               base.parentWays[child].forEach(function(id2) {
19023                 if (!this.entities.hasOwnProperty(id2)) {
19024                   this._parentWays[child].add(id2);
19025                 }
19026               }, this);
19027             }
19028           }, this);
19029           Object.keys(this._parentRels).forEach(function(child) {
19030             if (base.parentRels[child]) {
19031               base.parentRels[child].forEach(function(id2) {
19032                 if (!this.entities.hasOwnProperty(id2)) {
19033                   this._parentRels[child].add(id2);
19034                 }
19035               }, this);
19036             }
19037           }, this);
19038           this.transients = {};
19039         },
19040         // Updates calculated properties (parentWays, parentRels) for the specified change
19041         _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
19042           parentWays = parentWays || this._parentWays;
19043           parentRels = parentRels || this._parentRels;
19044           var type2 = entity && entity.type || oldentity && oldentity.type;
19045           var removed, added, i3;
19046           if (type2 === "way") {
19047             if (oldentity && entity) {
19048               removed = utilArrayDifference(oldentity.nodes, entity.nodes);
19049               added = utilArrayDifference(entity.nodes, oldentity.nodes);
19050             } else if (oldentity) {
19051               removed = oldentity.nodes;
19052               added = [];
19053             } else if (entity) {
19054               removed = [];
19055               added = entity.nodes;
19056             }
19057             for (i3 = 0; i3 < removed.length; i3++) {
19058               parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
19059               parentWays[removed[i3]].delete(oldentity.id);
19060             }
19061             for (i3 = 0; i3 < added.length; i3++) {
19062               parentWays[added[i3]] = new Set(parentWays[added[i3]]);
19063               parentWays[added[i3]].add(entity.id);
19064             }
19065           } else if (type2 === "relation") {
19066             var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
19067               return m2.id;
19068             }) : [];
19069             var entityMemberIDs = entity ? entity.members.map(function(m2) {
19070               return m2.id;
19071             }) : [];
19072             if (oldentity && entity) {
19073               removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
19074               added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
19075             } else if (oldentity) {
19076               removed = oldentityMemberIDs;
19077               added = [];
19078             } else if (entity) {
19079               removed = [];
19080               added = entityMemberIDs;
19081             }
19082             for (i3 = 0; i3 < removed.length; i3++) {
19083               parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
19084               parentRels[removed[i3]].delete(oldentity.id);
19085             }
19086             for (i3 = 0; i3 < added.length; i3++) {
19087               parentRels[added[i3]] = new Set(parentRels[added[i3]]);
19088               parentRels[added[i3]].add(entity.id);
19089             }
19090           }
19091         },
19092         replace: function(entity) {
19093           if (this.entities[entity.id] === entity) return this;
19094           return this.update(function() {
19095             this._updateCalculated(this.entities[entity.id], entity);
19096             this.entities[entity.id] = entity;
19097           });
19098         },
19099         remove: function(entity) {
19100           return this.update(function() {
19101             this._updateCalculated(entity, void 0);
19102             this.entities[entity.id] = void 0;
19103           });
19104         },
19105         revert: function(id2) {
19106           var baseEntity = this.base().entities[id2];
19107           var headEntity = this.entities[id2];
19108           if (headEntity === baseEntity) return this;
19109           return this.update(function() {
19110             this._updateCalculated(headEntity, baseEntity);
19111             delete this.entities[id2];
19112           });
19113         },
19114         update: function() {
19115           var graph = this.frozen ? coreGraph(this, true) : this;
19116           for (var i3 = 0; i3 < arguments.length; i3++) {
19117             arguments[i3].call(graph, graph);
19118           }
19119           if (this.frozen) graph.frozen = true;
19120           return graph;
19121         },
19122         // Obliterates any existing entities
19123         load: function(entities) {
19124           var base = this.base();
19125           this.entities = Object.create(base.entities);
19126           for (var i3 in entities) {
19127             this.entities[i3] = entities[i3];
19128             this._updateCalculated(base.entities[i3], this.entities[i3]);
19129           }
19130           return this;
19131         }
19132       };
19133     }
19134   });
19135
19136   // modules/osm/intersection.js
19137   var intersection_exports = {};
19138   __export(intersection_exports, {
19139     osmInferRestriction: () => osmInferRestriction,
19140     osmIntersection: () => osmIntersection,
19141     osmTurn: () => osmTurn
19142   });
19143   function osmTurn(turn) {
19144     if (!(this instanceof osmTurn)) {
19145       return new osmTurn(turn);
19146     }
19147     Object.assign(this, turn);
19148   }
19149   function osmIntersection(graph, startVertexId, maxDistance) {
19150     maxDistance = maxDistance || 30;
19151     var vgraph = coreGraph();
19152     var i3, j2, k2;
19153     function memberOfRestriction(entity) {
19154       return graph.parentRelations(entity).some(function(r2) {
19155         return r2.isRestriction();
19156       });
19157     }
19158     function isRoad(way2) {
19159       if (way2.isArea() || way2.isDegenerate()) return false;
19160       var roads = {
19161         "motorway": true,
19162         "motorway_link": true,
19163         "trunk": true,
19164         "trunk_link": true,
19165         "primary": true,
19166         "primary_link": true,
19167         "secondary": true,
19168         "secondary_link": true,
19169         "tertiary": true,
19170         "tertiary_link": true,
19171         "residential": true,
19172         "unclassified": true,
19173         "living_street": true,
19174         "service": true,
19175         "busway": true,
19176         "road": true,
19177         "track": true
19178       };
19179       return roads[way2.tags.highway];
19180     }
19181     var startNode = graph.entity(startVertexId);
19182     var checkVertices = [startNode];
19183     var checkWays;
19184     var vertices = [];
19185     var vertexIds = [];
19186     var vertex;
19187     var ways = [];
19188     var wayIds = [];
19189     var way;
19190     var nodes = [];
19191     var node;
19192     var parents = [];
19193     var parent;
19194     var actions = [];
19195     while (checkVertices.length) {
19196       vertex = checkVertices.pop();
19197       checkWays = graph.parentWays(vertex);
19198       var hasWays = false;
19199       for (i3 = 0; i3 < checkWays.length; i3++) {
19200         way = checkWays[i3];
19201         if (!isRoad(way) && !memberOfRestriction(way)) continue;
19202         ways.push(way);
19203         hasWays = true;
19204         nodes = utilArrayUniq(graph.childNodes(way));
19205         for (j2 = 0; j2 < nodes.length; j2++) {
19206           node = nodes[j2];
19207           if (node === vertex) continue;
19208           if (vertices.indexOf(node) !== -1) continue;
19209           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
19210           var hasParents = false;
19211           parents = graph.parentWays(node);
19212           for (k2 = 0; k2 < parents.length; k2++) {
19213             parent = parents[k2];
19214             if (parent === way) continue;
19215             if (ways.indexOf(parent) !== -1) continue;
19216             if (!isRoad(parent)) continue;
19217             hasParents = true;
19218             break;
19219           }
19220           if (hasParents) {
19221             checkVertices.push(node);
19222           }
19223         }
19224       }
19225       if (hasWays) {
19226         vertices.push(vertex);
19227       }
19228     }
19229     vertices = utilArrayUniq(vertices);
19230     ways = utilArrayUniq(ways);
19231     ways.forEach(function(way2) {
19232       graph.childNodes(way2).forEach(function(node2) {
19233         vgraph = vgraph.replace(node2);
19234       });
19235       vgraph = vgraph.replace(way2);
19236       graph.parentRelations(way2).forEach(function(relation) {
19237         if (relation.isRestriction()) {
19238           if (relation.isValidRestriction(graph)) {
19239             vgraph = vgraph.replace(relation);
19240           } else if (relation.isComplete(graph)) {
19241             actions.push(actionDeleteRelation(relation.id));
19242           }
19243         }
19244       });
19245     });
19246     ways.forEach(function(w2) {
19247       var way2 = vgraph.entity(w2.id);
19248       if (way2.tags.oneway === "-1") {
19249         var action = actionReverse(way2.id, { reverseOneway: true });
19250         actions.push(action);
19251         vgraph = action(vgraph);
19252       }
19253     });
19254     var origCount = osmEntity.id.next.way;
19255     vertices.forEach(function(v2) {
19256       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
19257       if (!splitAll.disabled(vgraph)) {
19258         splitAll.ways(vgraph).forEach(function(way2) {
19259           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
19260           actions.push(splitOne);
19261           vgraph = splitOne(vgraph);
19262         });
19263       }
19264     });
19265     osmEntity.id.next.way = origCount;
19266     vertexIds = vertices.map(function(v2) {
19267       return v2.id;
19268     });
19269     vertices = [];
19270     ways = [];
19271     vertexIds.forEach(function(id2) {
19272       var vertex2 = vgraph.entity(id2);
19273       var parents2 = vgraph.parentWays(vertex2);
19274       vertices.push(vertex2);
19275       ways = ways.concat(parents2);
19276     });
19277     vertices = utilArrayUniq(vertices);
19278     ways = utilArrayUniq(ways);
19279     vertexIds = vertices.map(function(v2) {
19280       return v2.id;
19281     });
19282     wayIds = ways.map(function(w2) {
19283       return w2.id;
19284     });
19285     function withMetadata(way2, vertexIds2) {
19286       var __oneWay = way2.isOneWay() && !way2.isBiDirectional();
19287       var __first = vertexIds2.indexOf(way2.first()) !== -1;
19288       var __last = vertexIds2.indexOf(way2.last()) !== -1;
19289       var __via = __first && __last;
19290       var __from = __first && !__oneWay || __last;
19291       var __to = __first || __last && !__oneWay;
19292       return way2.update({
19293         __first,
19294         __last,
19295         __from,
19296         __via,
19297         __to,
19298         __oneWay
19299       });
19300     }
19301     ways = [];
19302     wayIds.forEach(function(id2) {
19303       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
19304       vgraph = vgraph.replace(way2);
19305       ways.push(way2);
19306     });
19307     var keepGoing;
19308     var removeWayIds = [];
19309     var removeVertexIds = [];
19310     do {
19311       keepGoing = false;
19312       checkVertices = vertexIds.slice();
19313       for (i3 = 0; i3 < checkVertices.length; i3++) {
19314         var vertexId = checkVertices[i3];
19315         vertex = vgraph.hasEntity(vertexId);
19316         if (!vertex) {
19317           if (vertexIds.indexOf(vertexId) !== -1) {
19318             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19319           }
19320           removeVertexIds.push(vertexId);
19321           continue;
19322         }
19323         parents = vgraph.parentWays(vertex);
19324         if (parents.length < 3) {
19325           if (vertexIds.indexOf(vertexId) !== -1) {
19326             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19327           }
19328         }
19329         if (parents.length === 2) {
19330           var a2 = parents[0];
19331           var b2 = parents[1];
19332           var aIsLeaf = a2 && !a2.__via;
19333           var bIsLeaf = b2 && !b2.__via;
19334           var leaf, survivor;
19335           if (aIsLeaf && !bIsLeaf) {
19336             leaf = a2;
19337             survivor = b2;
19338           } else if (!aIsLeaf && bIsLeaf) {
19339             leaf = b2;
19340             survivor = a2;
19341           }
19342           if (leaf && survivor) {
19343             survivor = withMetadata(survivor, vertexIds);
19344             vgraph = vgraph.replace(survivor).remove(leaf);
19345             removeWayIds.push(leaf.id);
19346             keepGoing = true;
19347           }
19348         }
19349         parents = vgraph.parentWays(vertex);
19350         if (parents.length < 2) {
19351           if (vertexIds.indexOf(vertexId) !== -1) {
19352             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
19353           }
19354           removeVertexIds.push(vertexId);
19355           keepGoing = true;
19356         }
19357         if (parents.length < 1) {
19358           vgraph = vgraph.remove(vertex);
19359         }
19360       }
19361     } while (keepGoing);
19362     vertices = vertices.filter(function(vertex2) {
19363       return removeVertexIds.indexOf(vertex2.id) === -1;
19364     }).map(function(vertex2) {
19365       return vgraph.entity(vertex2.id);
19366     });
19367     ways = ways.filter(function(way2) {
19368       return removeWayIds.indexOf(way2.id) === -1;
19369     }).map(function(way2) {
19370       return vgraph.entity(way2.id);
19371     });
19372     var intersection2 = {
19373       graph: vgraph,
19374       actions,
19375       vertices,
19376       ways
19377     };
19378     intersection2.turns = function(fromWayId, maxViaWay) {
19379       if (!fromWayId) return [];
19380       if (!maxViaWay) maxViaWay = 0;
19381       var vgraph2 = intersection2.graph;
19382       var keyVertexIds = intersection2.vertices.map(function(v2) {
19383         return v2.id;
19384       });
19385       var start2 = vgraph2.entity(fromWayId);
19386       if (!start2 || !(start2.__from || start2.__via)) return [];
19387       var maxPathLength = maxViaWay * 2 + 3;
19388       var turns = [];
19389       step(start2);
19390       return turns;
19391       function step(entity, currPath, currRestrictions, matchedRestriction) {
19392         currPath = (currPath || []).slice();
19393         if (currPath.length >= maxPathLength) return;
19394         currPath.push(entity.id);
19395         currRestrictions = (currRestrictions || []).slice();
19396         if (entity.type === "node") {
19397           stepNode(entity, currPath, currRestrictions);
19398         } else {
19399           stepWay(entity, currPath, currRestrictions, matchedRestriction);
19400         }
19401       }
19402       function stepNode(entity, currPath, currRestrictions) {
19403         var i4, j3;
19404         var parents2 = vgraph2.parentWays(entity);
19405         var nextWays = [];
19406         for (i4 = 0; i4 < parents2.length; i4++) {
19407           var way2 = parents2[i4];
19408           if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
19409           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
19410           var restrict = null;
19411           for (j3 = 0; j3 < currRestrictions.length; j3++) {
19412             var restriction = currRestrictions[j3];
19413             var f2 = restriction.memberByRole("from");
19414             var v2 = restriction.membersByRole("via");
19415             var t2 = restriction.memberByRole("to");
19416             var isNo = /^no_/.test(restriction.tags.restriction);
19417             var isOnly = /^only_/.test(restriction.tags.restriction);
19418             if (!(isNo || isOnly)) {
19419               continue;
19420             }
19421             var matchesFrom = f2.id === fromWayId;
19422             var matchesViaTo = false;
19423             var isAlongOnlyPath = false;
19424             if (t2.id === way2.id) {
19425               if (v2.length === 1 && v2[0].type === "node") {
19426                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
19427               } else {
19428                 var pathVias = [];
19429                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
19430                   pathVias.push(currPath[k2]);
19431                 }
19432                 var restrictionVias = [];
19433                 for (k2 = 0; k2 < v2.length; k2++) {
19434                   if (v2[k2].type === "way") {
19435                     restrictionVias.push(v2[k2].id);
19436                   }
19437                 }
19438                 var diff = utilArrayDifference(pathVias, restrictionVias);
19439                 matchesViaTo = !diff.length;
19440               }
19441             } else if (isOnly) {
19442               for (k2 = 0; k2 < v2.length; k2++) {
19443                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
19444                   isAlongOnlyPath = true;
19445                   break;
19446                 }
19447               }
19448             }
19449             if (matchesViaTo) {
19450               if (isOnly) {
19451                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
19452               } else {
19453                 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
19454               }
19455             } else {
19456               if (isAlongOnlyPath) {
19457                 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
19458               } else if (isOnly) {
19459                 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
19460               }
19461             }
19462             if (restrict && restrict.direct) break;
19463           }
19464           nextWays.push({ way: way2, restrict });
19465         }
19466         nextWays.forEach(function(nextWay) {
19467           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
19468         });
19469       }
19470       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
19471         var i4;
19472         if (currPath.length >= 3) {
19473           var turnPath = currPath.slice();
19474           if (matchedRestriction && matchedRestriction.direct === false) {
19475             for (i4 = 0; i4 < turnPath.length; i4++) {
19476               if (turnPath[i4] === matchedRestriction.from) {
19477                 turnPath = turnPath.slice(i4);
19478                 break;
19479               }
19480             }
19481           }
19482           var turn = pathToTurn(turnPath);
19483           if (turn) {
19484             if (matchedRestriction) {
19485               turn.restrictionID = matchedRestriction.id;
19486               turn.no = matchedRestriction.no;
19487               turn.only = matchedRestriction.only;
19488               turn.direct = matchedRestriction.direct;
19489             }
19490             turns.push(osmTurn(turn));
19491           }
19492           if (currPath[0] === currPath[2]) return;
19493         }
19494         if (matchedRestriction && matchedRestriction.end) return;
19495         var n1 = vgraph2.entity(entity.first());
19496         var n22 = vgraph2.entity(entity.last());
19497         var dist = geoSphericalDistance(n1.loc, n22.loc);
19498         var nextNodes = [];
19499         if (currPath.length > 1) {
19500           if (dist > maxDistance) return;
19501           if (!entity.__via) return;
19502         }
19503         if (!entity.__oneWay && // bidirectional..
19504         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
19505         currPath.indexOf(n1.id) === -1) {
19506           nextNodes.push(n1);
19507         }
19508         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
19509         currPath.indexOf(n22.id) === -1) {
19510           nextNodes.push(n22);
19511         }
19512         nextNodes.forEach(function(nextNode) {
19513           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
19514             if (!r2.isRestriction()) return false;
19515             var f2 = r2.memberByRole("from");
19516             if (!f2 || f2.id !== entity.id) return false;
19517             var isOnly = /^only_/.test(r2.tags.restriction);
19518             if (!isOnly) return true;
19519             var isOnlyVia = false;
19520             var v2 = r2.membersByRole("via");
19521             if (v2.length === 1 && v2[0].type === "node") {
19522               isOnlyVia = v2[0].id === nextNode.id;
19523             } else {
19524               for (var i5 = 0; i5 < v2.length; i5++) {
19525                 if (v2[i5].type !== "way") continue;
19526                 var viaWay = vgraph2.entity(v2[i5].id);
19527                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
19528                   isOnlyVia = true;
19529                   break;
19530                 }
19531               }
19532             }
19533             return isOnlyVia;
19534           });
19535           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
19536         });
19537       }
19538       function pathToTurn(path) {
19539         if (path.length < 3) return;
19540         var fromWayId2, fromNodeId, fromVertexId;
19541         var toWayId, toNodeId, toVertexId;
19542         var viaWayIds, viaNodeId, isUturn;
19543         fromWayId2 = path[0];
19544         toWayId = path[path.length - 1];
19545         if (path.length === 3 && fromWayId2 === toWayId) {
19546           var way2 = vgraph2.entity(fromWayId2);
19547           if (way2.__oneWay) return null;
19548           isUturn = true;
19549           viaNodeId = fromVertexId = toVertexId = path[1];
19550           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
19551         } else {
19552           isUturn = false;
19553           fromVertexId = path[1];
19554           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
19555           toVertexId = path[path.length - 2];
19556           toNodeId = adjacentNode(toWayId, toVertexId);
19557           if (path.length === 3) {
19558             viaNodeId = path[1];
19559           } else {
19560             viaWayIds = path.filter(function(entityId) {
19561               return entityId[0] === "w";
19562             });
19563             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
19564           }
19565         }
19566         return {
19567           key: path.join("_"),
19568           path,
19569           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
19570           via: { node: viaNodeId, ways: viaWayIds },
19571           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
19572           u: isUturn
19573         };
19574         function adjacentNode(wayId, affixId) {
19575           var nodes2 = vgraph2.entity(wayId).nodes;
19576           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
19577         }
19578       }
19579     };
19580     return intersection2;
19581   }
19582   function osmInferRestriction(graph, turn, projection2) {
19583     var fromWay = graph.entity(turn.from.way);
19584     var fromNode = graph.entity(turn.from.node);
19585     var fromVertex = graph.entity(turn.from.vertex);
19586     var toWay = graph.entity(turn.to.way);
19587     var toNode = graph.entity(turn.to.node);
19588     var toVertex = graph.entity(turn.to.vertex);
19589     var fromOneWay = fromWay.tags.oneway === "yes";
19590     var toOneWay = toWay.tags.oneway === "yes";
19591     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
19592     while (angle2 < 0) {
19593       angle2 += 360;
19594     }
19595     if (fromNode === toNode) {
19596       return "no_u_turn";
19597     }
19598     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
19599       return "no_u_turn";
19600     }
19601     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
19602       return "no_u_turn";
19603     }
19604     if (angle2 < 158) {
19605       return "no_right_turn";
19606     }
19607     if (angle2 > 202) {
19608       return "no_left_turn";
19609     }
19610     return "no_straight_on";
19611   }
19612   var init_intersection = __esm({
19613     "modules/osm/intersection.js"() {
19614       "use strict";
19615       init_delete_relation();
19616       init_reverse();
19617       init_split();
19618       init_graph();
19619       init_geo2();
19620       init_entity();
19621       init_util();
19622     }
19623   });
19624
19625   // modules/osm/lanes.js
19626   var lanes_exports = {};
19627   __export(lanes_exports, {
19628     osmLanes: () => osmLanes
19629   });
19630   function osmLanes(entity) {
19631     if (entity.type !== "way") return null;
19632     if (!entity.tags.highway) return null;
19633     var tags = entity.tags;
19634     var isOneWay = entity.isOneWay();
19635     var laneCount = getLaneCount(tags, isOneWay);
19636     var maxspeed = parseMaxspeed(tags);
19637     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
19638     var forward = laneDirections.forward;
19639     var backward = laneDirections.backward;
19640     var bothways = laneDirections.bothways;
19641     var turnLanes = {};
19642     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
19643     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
19644     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
19645     var maxspeedLanes = {};
19646     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
19647     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
19648     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
19649     var psvLanes = {};
19650     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
19651     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
19652     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
19653     var busLanes = {};
19654     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
19655     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
19656     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
19657     var taxiLanes = {};
19658     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
19659     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
19660     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
19661     var hovLanes = {};
19662     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
19663     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
19664     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
19665     var hgvLanes = {};
19666     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
19667     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
19668     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
19669     var bicyclewayLanes = {};
19670     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
19671     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
19672     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
19673     var lanesObj = {
19674       forward: [],
19675       backward: [],
19676       unspecified: []
19677     };
19678     mapToLanesObj(lanesObj, turnLanes, "turnLane");
19679     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
19680     mapToLanesObj(lanesObj, psvLanes, "psv");
19681     mapToLanesObj(lanesObj, busLanes, "bus");
19682     mapToLanesObj(lanesObj, taxiLanes, "taxi");
19683     mapToLanesObj(lanesObj, hovLanes, "hov");
19684     mapToLanesObj(lanesObj, hgvLanes, "hgv");
19685     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
19686     return {
19687       metadata: {
19688         count: laneCount,
19689         oneway: isOneWay,
19690         forward,
19691         backward,
19692         bothways,
19693         turnLanes,
19694         maxspeed,
19695         maxspeedLanes,
19696         psvLanes,
19697         busLanes,
19698         taxiLanes,
19699         hovLanes,
19700         hgvLanes,
19701         bicyclewayLanes
19702       },
19703       lanes: lanesObj
19704     };
19705   }
19706   function getLaneCount(tags, isOneWay) {
19707     var count;
19708     if (tags.lanes) {
19709       count = parseInt(tags.lanes, 10);
19710       if (count > 0) {
19711         return count;
19712       }
19713     }
19714     switch (tags.highway) {
19715       case "trunk":
19716       case "motorway":
19717         count = isOneWay ? 2 : 4;
19718         break;
19719       default:
19720         count = isOneWay ? 1 : 2;
19721         break;
19722     }
19723     return count;
19724   }
19725   function parseMaxspeed(tags) {
19726     var maxspeed = tags.maxspeed;
19727     if (!maxspeed) return;
19728     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
19729     if (!maxspeedRegex.test(maxspeed)) return;
19730     return parseInt(maxspeed, 10);
19731   }
19732   function parseLaneDirections(tags, isOneWay, laneCount) {
19733     var forward = parseInt(tags["lanes:forward"], 10);
19734     var backward = parseInt(tags["lanes:backward"], 10);
19735     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
19736     if (parseInt(tags.oneway, 10) === -1) {
19737       forward = 0;
19738       bothways = 0;
19739       backward = laneCount;
19740     } else if (isOneWay) {
19741       forward = laneCount;
19742       bothways = 0;
19743       backward = 0;
19744     } else if (isNaN(forward) && isNaN(backward)) {
19745       backward = Math.floor((laneCount - bothways) / 2);
19746       forward = laneCount - bothways - backward;
19747     } else if (isNaN(forward)) {
19748       if (backward > laneCount - bothways) {
19749         backward = laneCount - bothways;
19750       }
19751       forward = laneCount - bothways - backward;
19752     } else if (isNaN(backward)) {
19753       if (forward > laneCount - bothways) {
19754         forward = laneCount - bothways;
19755       }
19756       backward = laneCount - bothways - forward;
19757     }
19758     return {
19759       forward,
19760       backward,
19761       bothways
19762     };
19763   }
19764   function parseTurnLanes(tag2) {
19765     if (!tag2) return;
19766     var validValues = [
19767       "left",
19768       "slight_left",
19769       "sharp_left",
19770       "through",
19771       "right",
19772       "slight_right",
19773       "sharp_right",
19774       "reverse",
19775       "merge_to_left",
19776       "merge_to_right",
19777       "none"
19778     ];
19779     return tag2.split("|").map(function(s2) {
19780       if (s2 === "") s2 = "none";
19781       return s2.split(";").map(function(d2) {
19782         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
19783       });
19784     });
19785   }
19786   function parseMaxspeedLanes(tag2, maxspeed) {
19787     if (!tag2) return;
19788     return tag2.split("|").map(function(s2) {
19789       if (s2 === "none") return s2;
19790       var m2 = parseInt(s2, 10);
19791       if (s2 === "" || m2 === maxspeed) return null;
19792       return isNaN(m2) ? "unknown" : m2;
19793     });
19794   }
19795   function parseMiscLanes(tag2) {
19796     if (!tag2) return;
19797     var validValues = [
19798       "yes",
19799       "no",
19800       "designated"
19801     ];
19802     return tag2.split("|").map(function(s2) {
19803       if (s2 === "") s2 = "no";
19804       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
19805     });
19806   }
19807   function parseBicycleWay(tag2) {
19808     if (!tag2) return;
19809     var validValues = [
19810       "yes",
19811       "no",
19812       "designated",
19813       "lane"
19814     ];
19815     return tag2.split("|").map(function(s2) {
19816       if (s2 === "") s2 = "no";
19817       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
19818     });
19819   }
19820   function mapToLanesObj(lanesObj, data, key) {
19821     if (data.forward) {
19822       data.forward.forEach(function(l2, i3) {
19823         if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
19824         lanesObj.forward[i3][key] = l2;
19825       });
19826     }
19827     if (data.backward) {
19828       data.backward.forEach(function(l2, i3) {
19829         if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
19830         lanesObj.backward[i3][key] = l2;
19831       });
19832     }
19833     if (data.unspecified) {
19834       data.unspecified.forEach(function(l2, i3) {
19835         if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
19836         lanesObj.unspecified[i3][key] = l2;
19837       });
19838     }
19839   }
19840   var init_lanes = __esm({
19841     "modules/osm/lanes.js"() {
19842       "use strict";
19843     }
19844   });
19845
19846   // modules/osm/index.js
19847   var osm_exports = {};
19848   __export(osm_exports, {
19849     QAItem: () => QAItem,
19850     osmAreaKeys: () => osmAreaKeys,
19851     osmChangeset: () => osmChangeset,
19852     osmEntity: () => osmEntity,
19853     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
19854     osmInferRestriction: () => osmInferRestriction,
19855     osmIntersection: () => osmIntersection,
19856     osmIsInterestingTag: () => osmIsInterestingTag,
19857     osmJoinWays: () => osmJoinWays,
19858     osmLanes: () => osmLanes,
19859     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
19860     osmNode: () => osmNode,
19861     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
19862     osmNote: () => osmNote,
19863     osmPavedTags: () => osmPavedTags,
19864     osmPointTags: () => osmPointTags,
19865     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
19866     osmRelation: () => osmRelation,
19867     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
19868     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
19869     osmSetAreaKeys: () => osmSetAreaKeys,
19870     osmSetPointTags: () => osmSetPointTags,
19871     osmSetVertexTags: () => osmSetVertexTags,
19872     osmTagSuggestingArea: () => osmTagSuggestingArea,
19873     osmTurn: () => osmTurn,
19874     osmVertexTags: () => osmVertexTags,
19875     osmWay: () => osmWay
19876   });
19877   var init_osm = __esm({
19878     "modules/osm/index.js"() {
19879       "use strict";
19880       init_changeset();
19881       init_entity();
19882       init_node2();
19883       init_note();
19884       init_relation();
19885       init_way();
19886       init_qa_item();
19887       init_intersection();
19888       init_lanes();
19889       init_multipolygon();
19890       init_tags();
19891     }
19892   });
19893
19894   // modules/actions/merge_polygon.js
19895   var merge_polygon_exports = {};
19896   __export(merge_polygon_exports, {
19897     actionMergePolygon: () => actionMergePolygon
19898   });
19899   function actionMergePolygon(ids, newRelationId) {
19900     function groupEntities(graph) {
19901       var entities = ids.map(function(id2) {
19902         return graph.entity(id2);
19903       });
19904       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
19905         if (entity.type === "way" && entity.isClosed()) {
19906           return "closedWay";
19907         } else if (entity.type === "relation" && entity.isMultipolygon()) {
19908           return "multipolygon";
19909         } else {
19910           return "other";
19911         }
19912       });
19913       return Object.assign(
19914         { closedWay: [], multipolygon: [], other: [] },
19915         geometryGroups
19916       );
19917     }
19918     var action = function(graph) {
19919       var entities = groupEntities(graph);
19920       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
19921         return polygons2.concat(osmJoinWays(m2.members, graph));
19922       }, []).concat(entities.closedWay.map(function(d2) {
19923         var member = [{ id: d2.id }];
19924         member.nodes = graph.childNodes(d2);
19925         return member;
19926       }));
19927       var contained = polygons.map(function(w2, i3) {
19928         return polygons.map(function(d2, n3) {
19929           if (i3 === n3) return null;
19930           return geoPolygonContainsPolygon(
19931             d2.nodes.map(function(n4) {
19932               return n4.loc;
19933             }),
19934             w2.nodes.map(function(n4) {
19935               return n4.loc;
19936             })
19937           );
19938         });
19939       });
19940       var members = [];
19941       var outer = true;
19942       while (polygons.length) {
19943         extractUncontained(polygons);
19944         polygons = polygons.filter(isContained);
19945         contained = contained.filter(isContained).map(filterContained);
19946       }
19947       function isContained(d2, i3) {
19948         return contained[i3].some(function(val) {
19949           return val;
19950         });
19951       }
19952       function filterContained(d2) {
19953         return d2.filter(isContained);
19954       }
19955       function extractUncontained(polygons2) {
19956         polygons2.forEach(function(d2, i3) {
19957           if (!isContained(d2, i3)) {
19958             d2.forEach(function(member) {
19959               members.push({
19960                 type: "way",
19961                 id: member.id,
19962                 role: outer ? "outer" : "inner"
19963               });
19964             });
19965           }
19966         });
19967         outer = !outer;
19968       }
19969       var relation;
19970       if (entities.multipolygon.length > 0) {
19971         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
19972         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
19973       } else {
19974         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
19975       }
19976       entities.multipolygon.forEach(function(m2) {
19977         if (m2.id !== relation.id) {
19978           relation = relation.mergeTags(m2.tags);
19979           graph = graph.remove(m2);
19980         }
19981       });
19982       entities.closedWay.forEach(function(way) {
19983         function isThisOuter(m2) {
19984           return m2.id === way.id && m2.role !== "inner";
19985         }
19986         if (members.some(isThisOuter)) {
19987           relation = relation.mergeTags(way.tags);
19988           graph = graph.replace(way.update({ tags: {} }));
19989         }
19990       });
19991       return graph.replace(relation.update({
19992         members,
19993         tags: utilObjectOmit(relation.tags, ["area"])
19994       }));
19995     };
19996     action.disabled = function(graph) {
19997       var entities = groupEntities(graph);
19998       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
19999         return "not_eligible";
20000       }
20001       if (!entities.multipolygon.every(function(r2) {
20002         return r2.isComplete(graph);
20003       })) {
20004         return "incomplete_relation";
20005       }
20006       if (!entities.multipolygon.length) {
20007         var sharedMultipolygons = [];
20008         entities.closedWay.forEach(function(way, i3) {
20009           if (i3 === 0) {
20010             sharedMultipolygons = graph.parentMultipolygons(way);
20011           } else {
20012             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
20013           }
20014         });
20015         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
20016           return relation.members.length === entities.closedWay.length;
20017         });
20018         if (sharedMultipolygons.length) {
20019           return "not_eligible";
20020         }
20021       } else if (entities.closedWay.some(function(way) {
20022         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
20023       })) {
20024         return "not_eligible";
20025       }
20026     };
20027     return action;
20028   }
20029   var init_merge_polygon = __esm({
20030     "modules/actions/merge_polygon.js"() {
20031       "use strict";
20032       init_geo2();
20033       init_osm();
20034       init_util();
20035     }
20036   });
20037
20038   // node_modules/fast-deep-equal/index.js
20039   var require_fast_deep_equal = __commonJS({
20040     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
20041       "use strict";
20042       module2.exports = function equal(a2, b2) {
20043         if (a2 === b2) return true;
20044         if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
20045           if (a2.constructor !== b2.constructor) return false;
20046           var length2, i3, keys2;
20047           if (Array.isArray(a2)) {
20048             length2 = a2.length;
20049             if (length2 != b2.length) return false;
20050             for (i3 = length2; i3-- !== 0; )
20051               if (!equal(a2[i3], b2[i3])) return false;
20052             return true;
20053           }
20054           if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
20055           if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
20056           if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
20057           keys2 = Object.keys(a2);
20058           length2 = keys2.length;
20059           if (length2 !== Object.keys(b2).length) return false;
20060           for (i3 = length2; i3-- !== 0; )
20061             if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3])) return false;
20062           for (i3 = length2; i3-- !== 0; ) {
20063             var key = keys2[i3];
20064             if (!equal(a2[key], b2[key])) return false;
20065           }
20066           return true;
20067         }
20068         return a2 !== a2 && b2 !== b2;
20069       };
20070     }
20071   });
20072
20073   // node_modules/node-diff3/index.mjs
20074   function LCS(buffer1, buffer2) {
20075     let equivalenceClasses = {};
20076     for (let j2 = 0; j2 < buffer2.length; j2++) {
20077       const item = buffer2[j2];
20078       if (equivalenceClasses[item]) {
20079         equivalenceClasses[item].push(j2);
20080       } else {
20081         equivalenceClasses[item] = [j2];
20082       }
20083     }
20084     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
20085     let candidates = [NULLRESULT];
20086     for (let i3 = 0; i3 < buffer1.length; i3++) {
20087       const item = buffer1[i3];
20088       const buffer2indices = equivalenceClasses[item] || [];
20089       let r2 = 0;
20090       let c2 = candidates[0];
20091       for (let jx = 0; jx < buffer2indices.length; jx++) {
20092         const j2 = buffer2indices[jx];
20093         let s2;
20094         for (s2 = r2; s2 < candidates.length; s2++) {
20095           if (candidates[s2].buffer2index < j2 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j2)) {
20096             break;
20097           }
20098         }
20099         if (s2 < candidates.length) {
20100           const newCandidate = { buffer1index: i3, buffer2index: j2, chain: candidates[s2] };
20101           if (r2 === candidates.length) {
20102             candidates.push(c2);
20103           } else {
20104             candidates[r2] = c2;
20105           }
20106           r2 = s2 + 1;
20107           c2 = newCandidate;
20108           if (r2 === candidates.length) {
20109             break;
20110           }
20111         }
20112       }
20113       candidates[r2] = c2;
20114     }
20115     return candidates[candidates.length - 1];
20116   }
20117   function diffIndices(buffer1, buffer2) {
20118     const lcs = LCS(buffer1, buffer2);
20119     let result = [];
20120     let tail1 = buffer1.length;
20121     let tail2 = buffer2.length;
20122     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
20123       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
20124       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
20125       tail1 = candidate.buffer1index;
20126       tail2 = candidate.buffer2index;
20127       if (mismatchLength1 || mismatchLength2) {
20128         result.push({
20129           buffer1: [tail1 + 1, mismatchLength1],
20130           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
20131           buffer2: [tail2 + 1, mismatchLength2],
20132           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
20133         });
20134       }
20135     }
20136     result.reverse();
20137     return result;
20138   }
20139   function diff3MergeRegions(a2, o2, b2) {
20140     let hunks = [];
20141     function addHunk(h2, ab) {
20142       hunks.push({
20143         ab,
20144         oStart: h2.buffer1[0],
20145         oLength: h2.buffer1[1],
20146         // length of o to remove
20147         abStart: h2.buffer2[0],
20148         abLength: h2.buffer2[1]
20149         // length of a/b to insert
20150         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
20151       });
20152     }
20153     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
20154     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
20155     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
20156     let results = [];
20157     let currOffset = 0;
20158     function advanceTo(endOffset) {
20159       if (endOffset > currOffset) {
20160         results.push({
20161           stable: true,
20162           buffer: "o",
20163           bufferStart: currOffset,
20164           bufferLength: endOffset - currOffset,
20165           bufferContent: o2.slice(currOffset, endOffset)
20166         });
20167         currOffset = endOffset;
20168       }
20169     }
20170     while (hunks.length) {
20171       let hunk = hunks.shift();
20172       let regionStart = hunk.oStart;
20173       let regionEnd = hunk.oStart + hunk.oLength;
20174       let regionHunks = [hunk];
20175       advanceTo(regionStart);
20176       while (hunks.length) {
20177         const nextHunk = hunks[0];
20178         const nextHunkStart = nextHunk.oStart;
20179         if (nextHunkStart > regionEnd) break;
20180         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
20181         regionHunks.push(hunks.shift());
20182       }
20183       if (regionHunks.length === 1) {
20184         if (hunk.abLength > 0) {
20185           const buffer = hunk.ab === "a" ? a2 : b2;
20186           results.push({
20187             stable: true,
20188             buffer: hunk.ab,
20189             bufferStart: hunk.abStart,
20190             bufferLength: hunk.abLength,
20191             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
20192           });
20193         }
20194       } else {
20195         let bounds = {
20196           a: [a2.length, -1, o2.length, -1],
20197           b: [b2.length, -1, o2.length, -1]
20198         };
20199         while (regionHunks.length) {
20200           hunk = regionHunks.shift();
20201           const oStart = hunk.oStart;
20202           const oEnd = oStart + hunk.oLength;
20203           const abStart = hunk.abStart;
20204           const abEnd = abStart + hunk.abLength;
20205           let b3 = bounds[hunk.ab];
20206           b3[0] = Math.min(abStart, b3[0]);
20207           b3[1] = Math.max(abEnd, b3[1]);
20208           b3[2] = Math.min(oStart, b3[2]);
20209           b3[3] = Math.max(oEnd, b3[3]);
20210         }
20211         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
20212         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
20213         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
20214         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
20215         let result = {
20216           stable: false,
20217           aStart,
20218           aLength: aEnd - aStart,
20219           aContent: a2.slice(aStart, aEnd),
20220           oStart: regionStart,
20221           oLength: regionEnd - regionStart,
20222           oContent: o2.slice(regionStart, regionEnd),
20223           bStart,
20224           bLength: bEnd - bStart,
20225           bContent: b2.slice(bStart, bEnd)
20226         };
20227         results.push(result);
20228       }
20229       currOffset = regionEnd;
20230     }
20231     advanceTo(o2.length);
20232     return results;
20233   }
20234   function diff3Merge(a2, o2, b2, options2) {
20235     let defaults = {
20236       excludeFalseConflicts: true,
20237       stringSeparator: /\s+/
20238     };
20239     options2 = Object.assign(defaults, options2);
20240     if (typeof a2 === "string") a2 = a2.split(options2.stringSeparator);
20241     if (typeof o2 === "string") o2 = o2.split(options2.stringSeparator);
20242     if (typeof b2 === "string") b2 = b2.split(options2.stringSeparator);
20243     let results = [];
20244     const regions = diff3MergeRegions(a2, o2, b2);
20245     let okBuffer = [];
20246     function flushOk() {
20247       if (okBuffer.length) {
20248         results.push({ ok: okBuffer });
20249       }
20250       okBuffer = [];
20251     }
20252     function isFalseConflict(a3, b3) {
20253       if (a3.length !== b3.length) return false;
20254       for (let i3 = 0; i3 < a3.length; i3++) {
20255         if (a3[i3] !== b3[i3]) return false;
20256       }
20257       return true;
20258     }
20259     regions.forEach((region) => {
20260       if (region.stable) {
20261         okBuffer.push(...region.bufferContent);
20262       } else {
20263         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
20264           okBuffer.push(...region.aContent);
20265         } else {
20266           flushOk();
20267           results.push({
20268             conflict: {
20269               a: region.aContent,
20270               aIndex: region.aStart,
20271               o: region.oContent,
20272               oIndex: region.oStart,
20273               b: region.bContent,
20274               bIndex: region.bStart
20275             }
20276           });
20277         }
20278       }
20279     });
20280     flushOk();
20281     return results;
20282   }
20283   var init_node_diff3 = __esm({
20284     "node_modules/node-diff3/index.mjs"() {
20285     }
20286   });
20287
20288   // node_modules/lodash/lodash.js
20289   var require_lodash = __commonJS({
20290     "node_modules/lodash/lodash.js"(exports2, module2) {
20291       (function() {
20292         var undefined2;
20293         var VERSION = "4.17.21";
20294         var LARGE_ARRAY_SIZE2 = 200;
20295         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`";
20296         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
20297         var MAX_MEMOIZE_SIZE = 500;
20298         var PLACEHOLDER = "__lodash_placeholder__";
20299         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
20300         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
20301         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;
20302         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
20303         var HOT_COUNT2 = 800, HOT_SPAN2 = 16;
20304         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
20305         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
20306         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
20307         var wrapFlags = [
20308           ["ary", WRAP_ARY_FLAG],
20309           ["bind", WRAP_BIND_FLAG],
20310           ["bindKey", WRAP_BIND_KEY_FLAG],
20311           ["curry", WRAP_CURRY_FLAG],
20312           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
20313           ["flip", WRAP_FLIP_FLAG],
20314           ["partial", WRAP_PARTIAL_FLAG],
20315           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
20316           ["rearg", WRAP_REARG_FLAG]
20317         ];
20318         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]", objectTag5 = "[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]";
20319         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]";
20320         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
20321         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
20322         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
20323         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
20324         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
20325         var reTrimStart2 = /^\s+/;
20326         var reWhitespace2 = /\s/;
20327         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
20328         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
20329         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
20330         var reEscapeChar = /\\(\\)?/g;
20331         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
20332         var reFlags = /\w*$/;
20333         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
20334         var reIsBinary2 = /^0b[01]+$/i;
20335         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
20336         var reIsOctal2 = /^0o[0-7]+$/i;
20337         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
20338         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
20339         var reNoMatch = /($^)/;
20340         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
20341         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;
20342         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";
20343         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("|") + ")";
20344         var reApos = RegExp(rsApos, "g");
20345         var reComboMark = RegExp(rsCombo, "g");
20346         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
20347         var reUnicodeWord = RegExp([
20348           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
20349           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
20350           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
20351           rsUpper + "+" + rsOptContrUpper,
20352           rsOrdUpper,
20353           rsOrdLower,
20354           rsDigits,
20355           rsEmoji
20356         ].join("|"), "g");
20357         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
20358         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 ]/;
20359         var contextProps = [
20360           "Array",
20361           "Buffer",
20362           "DataView",
20363           "Date",
20364           "Error",
20365           "Float32Array",
20366           "Float64Array",
20367           "Function",
20368           "Int8Array",
20369           "Int16Array",
20370           "Int32Array",
20371           "Map",
20372           "Math",
20373           "Object",
20374           "Promise",
20375           "RegExp",
20376           "Set",
20377           "String",
20378           "Symbol",
20379           "TypeError",
20380           "Uint8Array",
20381           "Uint8ClampedArray",
20382           "Uint16Array",
20383           "Uint32Array",
20384           "WeakMap",
20385           "_",
20386           "clearTimeout",
20387           "isFinite",
20388           "parseInt",
20389           "setTimeout"
20390         ];
20391         var templateCounter = -1;
20392         var typedArrayTags2 = {};
20393         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
20394         typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag4] = typedArrayTags2[objectTag5] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
20395         var cloneableTags = {};
20396         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[objectTag5] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
20397         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
20398         var deburredLetters = {
20399           // Latin-1 Supplement block.
20400           "\xC0": "A",
20401           "\xC1": "A",
20402           "\xC2": "A",
20403           "\xC3": "A",
20404           "\xC4": "A",
20405           "\xC5": "A",
20406           "\xE0": "a",
20407           "\xE1": "a",
20408           "\xE2": "a",
20409           "\xE3": "a",
20410           "\xE4": "a",
20411           "\xE5": "a",
20412           "\xC7": "C",
20413           "\xE7": "c",
20414           "\xD0": "D",
20415           "\xF0": "d",
20416           "\xC8": "E",
20417           "\xC9": "E",
20418           "\xCA": "E",
20419           "\xCB": "E",
20420           "\xE8": "e",
20421           "\xE9": "e",
20422           "\xEA": "e",
20423           "\xEB": "e",
20424           "\xCC": "I",
20425           "\xCD": "I",
20426           "\xCE": "I",
20427           "\xCF": "I",
20428           "\xEC": "i",
20429           "\xED": "i",
20430           "\xEE": "i",
20431           "\xEF": "i",
20432           "\xD1": "N",
20433           "\xF1": "n",
20434           "\xD2": "O",
20435           "\xD3": "O",
20436           "\xD4": "O",
20437           "\xD5": "O",
20438           "\xD6": "O",
20439           "\xD8": "O",
20440           "\xF2": "o",
20441           "\xF3": "o",
20442           "\xF4": "o",
20443           "\xF5": "o",
20444           "\xF6": "o",
20445           "\xF8": "o",
20446           "\xD9": "U",
20447           "\xDA": "U",
20448           "\xDB": "U",
20449           "\xDC": "U",
20450           "\xF9": "u",
20451           "\xFA": "u",
20452           "\xFB": "u",
20453           "\xFC": "u",
20454           "\xDD": "Y",
20455           "\xFD": "y",
20456           "\xFF": "y",
20457           "\xC6": "Ae",
20458           "\xE6": "ae",
20459           "\xDE": "Th",
20460           "\xFE": "th",
20461           "\xDF": "ss",
20462           // Latin Extended-A block.
20463           "\u0100": "A",
20464           "\u0102": "A",
20465           "\u0104": "A",
20466           "\u0101": "a",
20467           "\u0103": "a",
20468           "\u0105": "a",
20469           "\u0106": "C",
20470           "\u0108": "C",
20471           "\u010A": "C",
20472           "\u010C": "C",
20473           "\u0107": "c",
20474           "\u0109": "c",
20475           "\u010B": "c",
20476           "\u010D": "c",
20477           "\u010E": "D",
20478           "\u0110": "D",
20479           "\u010F": "d",
20480           "\u0111": "d",
20481           "\u0112": "E",
20482           "\u0114": "E",
20483           "\u0116": "E",
20484           "\u0118": "E",
20485           "\u011A": "E",
20486           "\u0113": "e",
20487           "\u0115": "e",
20488           "\u0117": "e",
20489           "\u0119": "e",
20490           "\u011B": "e",
20491           "\u011C": "G",
20492           "\u011E": "G",
20493           "\u0120": "G",
20494           "\u0122": "G",
20495           "\u011D": "g",
20496           "\u011F": "g",
20497           "\u0121": "g",
20498           "\u0123": "g",
20499           "\u0124": "H",
20500           "\u0126": "H",
20501           "\u0125": "h",
20502           "\u0127": "h",
20503           "\u0128": "I",
20504           "\u012A": "I",
20505           "\u012C": "I",
20506           "\u012E": "I",
20507           "\u0130": "I",
20508           "\u0129": "i",
20509           "\u012B": "i",
20510           "\u012D": "i",
20511           "\u012F": "i",
20512           "\u0131": "i",
20513           "\u0134": "J",
20514           "\u0135": "j",
20515           "\u0136": "K",
20516           "\u0137": "k",
20517           "\u0138": "k",
20518           "\u0139": "L",
20519           "\u013B": "L",
20520           "\u013D": "L",
20521           "\u013F": "L",
20522           "\u0141": "L",
20523           "\u013A": "l",
20524           "\u013C": "l",
20525           "\u013E": "l",
20526           "\u0140": "l",
20527           "\u0142": "l",
20528           "\u0143": "N",
20529           "\u0145": "N",
20530           "\u0147": "N",
20531           "\u014A": "N",
20532           "\u0144": "n",
20533           "\u0146": "n",
20534           "\u0148": "n",
20535           "\u014B": "n",
20536           "\u014C": "O",
20537           "\u014E": "O",
20538           "\u0150": "O",
20539           "\u014D": "o",
20540           "\u014F": "o",
20541           "\u0151": "o",
20542           "\u0154": "R",
20543           "\u0156": "R",
20544           "\u0158": "R",
20545           "\u0155": "r",
20546           "\u0157": "r",
20547           "\u0159": "r",
20548           "\u015A": "S",
20549           "\u015C": "S",
20550           "\u015E": "S",
20551           "\u0160": "S",
20552           "\u015B": "s",
20553           "\u015D": "s",
20554           "\u015F": "s",
20555           "\u0161": "s",
20556           "\u0162": "T",
20557           "\u0164": "T",
20558           "\u0166": "T",
20559           "\u0163": "t",
20560           "\u0165": "t",
20561           "\u0167": "t",
20562           "\u0168": "U",
20563           "\u016A": "U",
20564           "\u016C": "U",
20565           "\u016E": "U",
20566           "\u0170": "U",
20567           "\u0172": "U",
20568           "\u0169": "u",
20569           "\u016B": "u",
20570           "\u016D": "u",
20571           "\u016F": "u",
20572           "\u0171": "u",
20573           "\u0173": "u",
20574           "\u0174": "W",
20575           "\u0175": "w",
20576           "\u0176": "Y",
20577           "\u0177": "y",
20578           "\u0178": "Y",
20579           "\u0179": "Z",
20580           "\u017B": "Z",
20581           "\u017D": "Z",
20582           "\u017A": "z",
20583           "\u017C": "z",
20584           "\u017E": "z",
20585           "\u0132": "IJ",
20586           "\u0133": "ij",
20587           "\u0152": "Oe",
20588           "\u0153": "oe",
20589           "\u0149": "'n",
20590           "\u017F": "s"
20591         };
20592         var htmlEscapes2 = {
20593           "&": "&amp;",
20594           "<": "&lt;",
20595           ">": "&gt;",
20596           '"': "&quot;",
20597           "'": "&#39;"
20598         };
20599         var htmlUnescapes2 = {
20600           "&amp;": "&",
20601           "&lt;": "<",
20602           "&gt;": ">",
20603           "&quot;": '"',
20604           "&#39;": "'"
20605         };
20606         var stringEscapes = {
20607           "\\": "\\",
20608           "'": "'",
20609           "\n": "n",
20610           "\r": "r",
20611           "\u2028": "u2028",
20612           "\u2029": "u2029"
20613         };
20614         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
20615         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
20616         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
20617         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
20618         var freeExports4 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
20619         var freeModule4 = freeExports4 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
20620         var moduleExports4 = freeModule4 && freeModule4.exports === freeExports4;
20621         var freeProcess2 = moduleExports4 && freeGlobal2.process;
20622         var nodeUtil2 = function() {
20623           try {
20624             var types = freeModule4 && freeModule4.require && freeModule4.require("util").types;
20625             if (types) {
20626               return types;
20627             }
20628             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
20629           } catch (e3) {
20630           }
20631         }();
20632         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;
20633         function apply2(func, thisArg, args) {
20634           switch (args.length) {
20635             case 0:
20636               return func.call(thisArg);
20637             case 1:
20638               return func.call(thisArg, args[0]);
20639             case 2:
20640               return func.call(thisArg, args[0], args[1]);
20641             case 3:
20642               return func.call(thisArg, args[0], args[1], args[2]);
20643           }
20644           return func.apply(thisArg, args);
20645         }
20646         function arrayAggregator(array2, setter, iteratee, accumulator) {
20647           var index = -1, length2 = array2 == null ? 0 : array2.length;
20648           while (++index < length2) {
20649             var value = array2[index];
20650             setter(accumulator, value, iteratee(value), array2);
20651           }
20652           return accumulator;
20653         }
20654         function arrayEach(array2, iteratee) {
20655           var index = -1, length2 = array2 == null ? 0 : array2.length;
20656           while (++index < length2) {
20657             if (iteratee(array2[index], index, array2) === false) {
20658               break;
20659             }
20660           }
20661           return array2;
20662         }
20663         function arrayEachRight(array2, iteratee) {
20664           var length2 = array2 == null ? 0 : array2.length;
20665           while (length2--) {
20666             if (iteratee(array2[length2], length2, array2) === false) {
20667               break;
20668             }
20669           }
20670           return array2;
20671         }
20672         function arrayEvery(array2, predicate) {
20673           var index = -1, length2 = array2 == null ? 0 : array2.length;
20674           while (++index < length2) {
20675             if (!predicate(array2[index], index, array2)) {
20676               return false;
20677             }
20678           }
20679           return true;
20680         }
20681         function arrayFilter2(array2, predicate) {
20682           var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
20683           while (++index < length2) {
20684             var value = array2[index];
20685             if (predicate(value, index, array2)) {
20686               result[resIndex++] = value;
20687             }
20688           }
20689           return result;
20690         }
20691         function arrayIncludes(array2, value) {
20692           var length2 = array2 == null ? 0 : array2.length;
20693           return !!length2 && baseIndexOf(array2, value, 0) > -1;
20694         }
20695         function arrayIncludesWith(array2, value, comparator) {
20696           var index = -1, length2 = array2 == null ? 0 : array2.length;
20697           while (++index < length2) {
20698             if (comparator(value, array2[index])) {
20699               return true;
20700             }
20701           }
20702           return false;
20703         }
20704         function arrayMap2(array2, iteratee) {
20705           var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
20706           while (++index < length2) {
20707             result[index] = iteratee(array2[index], index, array2);
20708           }
20709           return result;
20710         }
20711         function arrayPush2(array2, values) {
20712           var index = -1, length2 = values.length, offset = array2.length;
20713           while (++index < length2) {
20714             array2[offset + index] = values[index];
20715           }
20716           return array2;
20717         }
20718         function arrayReduce(array2, iteratee, accumulator, initAccum) {
20719           var index = -1, length2 = array2 == null ? 0 : array2.length;
20720           if (initAccum && length2) {
20721             accumulator = array2[++index];
20722           }
20723           while (++index < length2) {
20724             accumulator = iteratee(accumulator, array2[index], index, array2);
20725           }
20726           return accumulator;
20727         }
20728         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
20729           var length2 = array2 == null ? 0 : array2.length;
20730           if (initAccum && length2) {
20731             accumulator = array2[--length2];
20732           }
20733           while (length2--) {
20734             accumulator = iteratee(accumulator, array2[length2], length2, array2);
20735           }
20736           return accumulator;
20737         }
20738         function arraySome2(array2, predicate) {
20739           var index = -1, length2 = array2 == null ? 0 : array2.length;
20740           while (++index < length2) {
20741             if (predicate(array2[index], index, array2)) {
20742               return true;
20743             }
20744           }
20745           return false;
20746         }
20747         var asciiSize = baseProperty("length");
20748         function asciiToArray(string) {
20749           return string.split("");
20750         }
20751         function asciiWords(string) {
20752           return string.match(reAsciiWord) || [];
20753         }
20754         function baseFindKey(collection, predicate, eachFunc) {
20755           var result;
20756           eachFunc(collection, function(value, key, collection2) {
20757             if (predicate(value, key, collection2)) {
20758               result = key;
20759               return false;
20760             }
20761           });
20762           return result;
20763         }
20764         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
20765           var length2 = array2.length, index = fromIndex + (fromRight ? 1 : -1);
20766           while (fromRight ? index-- : ++index < length2) {
20767             if (predicate(array2[index], index, array2)) {
20768               return index;
20769             }
20770           }
20771           return -1;
20772         }
20773         function baseIndexOf(array2, value, fromIndex) {
20774           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
20775         }
20776         function baseIndexOfWith(array2, value, fromIndex, comparator) {
20777           var index = fromIndex - 1, length2 = array2.length;
20778           while (++index < length2) {
20779             if (comparator(array2[index], value)) {
20780               return index;
20781             }
20782           }
20783           return -1;
20784         }
20785         function baseIsNaN(value) {
20786           return value !== value;
20787         }
20788         function baseMean(array2, iteratee) {
20789           var length2 = array2 == null ? 0 : array2.length;
20790           return length2 ? baseSum(array2, iteratee) / length2 : NAN2;
20791         }
20792         function baseProperty(key) {
20793           return function(object) {
20794             return object == null ? undefined2 : object[key];
20795           };
20796         }
20797         function basePropertyOf2(object) {
20798           return function(key) {
20799             return object == null ? undefined2 : object[key];
20800           };
20801         }
20802         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
20803           eachFunc(collection, function(value, index, collection2) {
20804             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
20805           });
20806           return accumulator;
20807         }
20808         function baseSortBy(array2, comparer) {
20809           var length2 = array2.length;
20810           array2.sort(comparer);
20811           while (length2--) {
20812             array2[length2] = array2[length2].value;
20813           }
20814           return array2;
20815         }
20816         function baseSum(array2, iteratee) {
20817           var result, index = -1, length2 = array2.length;
20818           while (++index < length2) {
20819             var current = iteratee(array2[index]);
20820             if (current !== undefined2) {
20821               result = result === undefined2 ? current : result + current;
20822             }
20823           }
20824           return result;
20825         }
20826         function baseTimes2(n3, iteratee) {
20827           var index = -1, result = Array(n3);
20828           while (++index < n3) {
20829             result[index] = iteratee(index);
20830           }
20831           return result;
20832         }
20833         function baseToPairs(object, props) {
20834           return arrayMap2(props, function(key) {
20835             return [key, object[key]];
20836           });
20837         }
20838         function baseTrim2(string) {
20839           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
20840         }
20841         function baseUnary2(func) {
20842           return function(value) {
20843             return func(value);
20844           };
20845         }
20846         function baseValues(object, props) {
20847           return arrayMap2(props, function(key) {
20848             return object[key];
20849           });
20850         }
20851         function cacheHas2(cache, key) {
20852           return cache.has(key);
20853         }
20854         function charsStartIndex(strSymbols, chrSymbols) {
20855           var index = -1, length2 = strSymbols.length;
20856           while (++index < length2 && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
20857           }
20858           return index;
20859         }
20860         function charsEndIndex(strSymbols, chrSymbols) {
20861           var index = strSymbols.length;
20862           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
20863           }
20864           return index;
20865         }
20866         function countHolders(array2, placeholder) {
20867           var length2 = array2.length, result = 0;
20868           while (length2--) {
20869             if (array2[length2] === placeholder) {
20870               ++result;
20871             }
20872           }
20873           return result;
20874         }
20875         var deburrLetter = basePropertyOf2(deburredLetters);
20876         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
20877         function escapeStringChar(chr) {
20878           return "\\" + stringEscapes[chr];
20879         }
20880         function getValue2(object, key) {
20881           return object == null ? undefined2 : object[key];
20882         }
20883         function hasUnicode(string) {
20884           return reHasUnicode.test(string);
20885         }
20886         function hasUnicodeWord(string) {
20887           return reHasUnicodeWord.test(string);
20888         }
20889         function iteratorToArray(iterator) {
20890           var data, result = [];
20891           while (!(data = iterator.next()).done) {
20892             result.push(data.value);
20893           }
20894           return result;
20895         }
20896         function mapToArray2(map2) {
20897           var index = -1, result = Array(map2.size);
20898           map2.forEach(function(value, key) {
20899             result[++index] = [key, value];
20900           });
20901           return result;
20902         }
20903         function overArg2(func, transform2) {
20904           return function(arg) {
20905             return func(transform2(arg));
20906           };
20907         }
20908         function replaceHolders(array2, placeholder) {
20909           var index = -1, length2 = array2.length, resIndex = 0, result = [];
20910           while (++index < length2) {
20911             var value = array2[index];
20912             if (value === placeholder || value === PLACEHOLDER) {
20913               array2[index] = PLACEHOLDER;
20914               result[resIndex++] = index;
20915             }
20916           }
20917           return result;
20918         }
20919         function setToArray2(set4) {
20920           var index = -1, result = Array(set4.size);
20921           set4.forEach(function(value) {
20922             result[++index] = value;
20923           });
20924           return result;
20925         }
20926         function setToPairs(set4) {
20927           var index = -1, result = Array(set4.size);
20928           set4.forEach(function(value) {
20929             result[++index] = [value, value];
20930           });
20931           return result;
20932         }
20933         function strictIndexOf(array2, value, fromIndex) {
20934           var index = fromIndex - 1, length2 = array2.length;
20935           while (++index < length2) {
20936             if (array2[index] === value) {
20937               return index;
20938             }
20939           }
20940           return -1;
20941         }
20942         function strictLastIndexOf(array2, value, fromIndex) {
20943           var index = fromIndex + 1;
20944           while (index--) {
20945             if (array2[index] === value) {
20946               return index;
20947             }
20948           }
20949           return index;
20950         }
20951         function stringSize(string) {
20952           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
20953         }
20954         function stringToArray(string) {
20955           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
20956         }
20957         function trimmedEndIndex2(string) {
20958           var index = string.length;
20959           while (index-- && reWhitespace2.test(string.charAt(index))) {
20960           }
20961           return index;
20962         }
20963         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
20964         function unicodeSize(string) {
20965           var result = reUnicode.lastIndex = 0;
20966           while (reUnicode.test(string)) {
20967             ++result;
20968           }
20969           return result;
20970         }
20971         function unicodeToArray(string) {
20972           return string.match(reUnicode) || [];
20973         }
20974         function unicodeWords(string) {
20975           return string.match(reUnicodeWord) || [];
20976         }
20977         var runInContext = function runInContext2(context) {
20978           context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
20979           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;
20980           var arrayProto2 = Array2.prototype, funcProto4 = Function2.prototype, objectProto16 = Object2.prototype;
20981           var coreJsData2 = context["__core-js_shared__"];
20982           var funcToString4 = funcProto4.toString;
20983           var hasOwnProperty13 = objectProto16.hasOwnProperty;
20984           var idCounter = 0;
20985           var maskSrcKey2 = function() {
20986             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
20987             return uid ? "Symbol(src)_1." + uid : "";
20988           }();
20989           var nativeObjectToString3 = objectProto16.toString;
20990           var objectCtorString2 = funcToString4.call(Object2);
20991           var oldDash = root3._;
20992           var reIsNative2 = RegExp2(
20993             "^" + funcToString4.call(hasOwnProperty13).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
20994           );
20995           var Buffer4 = moduleExports4 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe2 = Buffer4 ? Buffer4.allocUnsafe : undefined2, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable3 = objectProto16.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
20996           var defineProperty2 = function() {
20997             try {
20998               var func = getNative2(Object2, "defineProperty");
20999               func({}, "", {});
21000               return func;
21001             } catch (e3) {
21002             }
21003           }();
21004           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
21005           var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer4 ? Buffer4.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax3 = Math2.max, nativeMin2 = Math2.min, nativeNow2 = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
21006           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");
21007           var metaMap = WeakMap2 && new WeakMap2();
21008           var realNames = {};
21009           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
21010           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
21011           function lodash(value) {
21012             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
21013               if (value instanceof LodashWrapper) {
21014                 return value;
21015               }
21016               if (hasOwnProperty13.call(value, "__wrapped__")) {
21017                 return wrapperClone(value);
21018               }
21019             }
21020             return new LodashWrapper(value);
21021           }
21022           var baseCreate2 = /* @__PURE__ */ function() {
21023             function object() {
21024             }
21025             return function(proto) {
21026               if (!isObject2(proto)) {
21027                 return {};
21028               }
21029               if (objectCreate2) {
21030                 return objectCreate2(proto);
21031               }
21032               object.prototype = proto;
21033               var result2 = new object();
21034               object.prototype = undefined2;
21035               return result2;
21036             };
21037           }();
21038           function baseLodash() {
21039           }
21040           function LodashWrapper(value, chainAll) {
21041             this.__wrapped__ = value;
21042             this.__actions__ = [];
21043             this.__chain__ = !!chainAll;
21044             this.__index__ = 0;
21045             this.__values__ = undefined2;
21046           }
21047           lodash.templateSettings = {
21048             /**
21049              * Used to detect `data` property values to be HTML-escaped.
21050              *
21051              * @memberOf _.templateSettings
21052              * @type {RegExp}
21053              */
21054             "escape": reEscape,
21055             /**
21056              * Used to detect code to be evaluated.
21057              *
21058              * @memberOf _.templateSettings
21059              * @type {RegExp}
21060              */
21061             "evaluate": reEvaluate,
21062             /**
21063              * Used to detect `data` property values to inject.
21064              *
21065              * @memberOf _.templateSettings
21066              * @type {RegExp}
21067              */
21068             "interpolate": reInterpolate,
21069             /**
21070              * Used to reference the data object in the template text.
21071              *
21072              * @memberOf _.templateSettings
21073              * @type {string}
21074              */
21075             "variable": "",
21076             /**
21077              * Used to import variables into the compiled template.
21078              *
21079              * @memberOf _.templateSettings
21080              * @type {Object}
21081              */
21082             "imports": {
21083               /**
21084                * A reference to the `lodash` function.
21085                *
21086                * @memberOf _.templateSettings.imports
21087                * @type {Function}
21088                */
21089               "_": lodash
21090             }
21091           };
21092           lodash.prototype = baseLodash.prototype;
21093           lodash.prototype.constructor = lodash;
21094           LodashWrapper.prototype = baseCreate2(baseLodash.prototype);
21095           LodashWrapper.prototype.constructor = LodashWrapper;
21096           function LazyWrapper(value) {
21097             this.__wrapped__ = value;
21098             this.__actions__ = [];
21099             this.__dir__ = 1;
21100             this.__filtered__ = false;
21101             this.__iteratees__ = [];
21102             this.__takeCount__ = MAX_ARRAY_LENGTH;
21103             this.__views__ = [];
21104           }
21105           function lazyClone() {
21106             var result2 = new LazyWrapper(this.__wrapped__);
21107             result2.__actions__ = copyArray2(this.__actions__);
21108             result2.__dir__ = this.__dir__;
21109             result2.__filtered__ = this.__filtered__;
21110             result2.__iteratees__ = copyArray2(this.__iteratees__);
21111             result2.__takeCount__ = this.__takeCount__;
21112             result2.__views__ = copyArray2(this.__views__);
21113             return result2;
21114           }
21115           function lazyReverse() {
21116             if (this.__filtered__) {
21117               var result2 = new LazyWrapper(this);
21118               result2.__dir__ = -1;
21119               result2.__filtered__ = true;
21120             } else {
21121               result2 = this.clone();
21122               result2.__dir__ *= -1;
21123             }
21124             return result2;
21125           }
21126           function lazyValue() {
21127             var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length2 = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
21128             if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
21129               return baseWrapperValue(array2, this.__actions__);
21130             }
21131             var result2 = [];
21132             outer:
21133               while (length2-- && resIndex < takeCount) {
21134                 index += dir;
21135                 var iterIndex = -1, value = array2[index];
21136                 while (++iterIndex < iterLength) {
21137                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
21138                   if (type2 == LAZY_MAP_FLAG) {
21139                     value = computed;
21140                   } else if (!computed) {
21141                     if (type2 == LAZY_FILTER_FLAG) {
21142                       continue outer;
21143                     } else {
21144                       break outer;
21145                     }
21146                   }
21147                 }
21148                 result2[resIndex++] = value;
21149               }
21150             return result2;
21151           }
21152           LazyWrapper.prototype = baseCreate2(baseLodash.prototype);
21153           LazyWrapper.prototype.constructor = LazyWrapper;
21154           function Hash2(entries) {
21155             var index = -1, length2 = entries == null ? 0 : entries.length;
21156             this.clear();
21157             while (++index < length2) {
21158               var entry = entries[index];
21159               this.set(entry[0], entry[1]);
21160             }
21161           }
21162           function hashClear2() {
21163             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
21164             this.size = 0;
21165           }
21166           function hashDelete2(key) {
21167             var result2 = this.has(key) && delete this.__data__[key];
21168             this.size -= result2 ? 1 : 0;
21169             return result2;
21170           }
21171           function hashGet2(key) {
21172             var data = this.__data__;
21173             if (nativeCreate2) {
21174               var result2 = data[key];
21175               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
21176             }
21177             return hasOwnProperty13.call(data, key) ? data[key] : undefined2;
21178           }
21179           function hashHas2(key) {
21180             var data = this.__data__;
21181             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty13.call(data, key);
21182           }
21183           function hashSet2(key, value) {
21184             var data = this.__data__;
21185             this.size += this.has(key) ? 0 : 1;
21186             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
21187             return this;
21188           }
21189           Hash2.prototype.clear = hashClear2;
21190           Hash2.prototype["delete"] = hashDelete2;
21191           Hash2.prototype.get = hashGet2;
21192           Hash2.prototype.has = hashHas2;
21193           Hash2.prototype.set = hashSet2;
21194           function ListCache2(entries) {
21195             var index = -1, length2 = entries == null ? 0 : entries.length;
21196             this.clear();
21197             while (++index < length2) {
21198               var entry = entries[index];
21199               this.set(entry[0], entry[1]);
21200             }
21201           }
21202           function listCacheClear2() {
21203             this.__data__ = [];
21204             this.size = 0;
21205           }
21206           function listCacheDelete2(key) {
21207             var data = this.__data__, index = assocIndexOf2(data, key);
21208             if (index < 0) {
21209               return false;
21210             }
21211             var lastIndex = data.length - 1;
21212             if (index == lastIndex) {
21213               data.pop();
21214             } else {
21215               splice2.call(data, index, 1);
21216             }
21217             --this.size;
21218             return true;
21219           }
21220           function listCacheGet2(key) {
21221             var data = this.__data__, index = assocIndexOf2(data, key);
21222             return index < 0 ? undefined2 : data[index][1];
21223           }
21224           function listCacheHas2(key) {
21225             return assocIndexOf2(this.__data__, key) > -1;
21226           }
21227           function listCacheSet2(key, value) {
21228             var data = this.__data__, index = assocIndexOf2(data, key);
21229             if (index < 0) {
21230               ++this.size;
21231               data.push([key, value]);
21232             } else {
21233               data[index][1] = value;
21234             }
21235             return this;
21236           }
21237           ListCache2.prototype.clear = listCacheClear2;
21238           ListCache2.prototype["delete"] = listCacheDelete2;
21239           ListCache2.prototype.get = listCacheGet2;
21240           ListCache2.prototype.has = listCacheHas2;
21241           ListCache2.prototype.set = listCacheSet2;
21242           function MapCache2(entries) {
21243             var index = -1, length2 = entries == null ? 0 : entries.length;
21244             this.clear();
21245             while (++index < length2) {
21246               var entry = entries[index];
21247               this.set(entry[0], entry[1]);
21248             }
21249           }
21250           function mapCacheClear2() {
21251             this.size = 0;
21252             this.__data__ = {
21253               "hash": new Hash2(),
21254               "map": new (Map3 || ListCache2)(),
21255               "string": new Hash2()
21256             };
21257           }
21258           function mapCacheDelete2(key) {
21259             var result2 = getMapData2(this, key)["delete"](key);
21260             this.size -= result2 ? 1 : 0;
21261             return result2;
21262           }
21263           function mapCacheGet2(key) {
21264             return getMapData2(this, key).get(key);
21265           }
21266           function mapCacheHas2(key) {
21267             return getMapData2(this, key).has(key);
21268           }
21269           function mapCacheSet2(key, value) {
21270             var data = getMapData2(this, key), size2 = data.size;
21271             data.set(key, value);
21272             this.size += data.size == size2 ? 0 : 1;
21273             return this;
21274           }
21275           MapCache2.prototype.clear = mapCacheClear2;
21276           MapCache2.prototype["delete"] = mapCacheDelete2;
21277           MapCache2.prototype.get = mapCacheGet2;
21278           MapCache2.prototype.has = mapCacheHas2;
21279           MapCache2.prototype.set = mapCacheSet2;
21280           function SetCache2(values2) {
21281             var index = -1, length2 = values2 == null ? 0 : values2.length;
21282             this.__data__ = new MapCache2();
21283             while (++index < length2) {
21284               this.add(values2[index]);
21285             }
21286           }
21287           function setCacheAdd2(value) {
21288             this.__data__.set(value, HASH_UNDEFINED4);
21289             return this;
21290           }
21291           function setCacheHas2(value) {
21292             return this.__data__.has(value);
21293           }
21294           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
21295           SetCache2.prototype.has = setCacheHas2;
21296           function Stack2(entries) {
21297             var data = this.__data__ = new ListCache2(entries);
21298             this.size = data.size;
21299           }
21300           function stackClear2() {
21301             this.__data__ = new ListCache2();
21302             this.size = 0;
21303           }
21304           function stackDelete2(key) {
21305             var data = this.__data__, result2 = data["delete"](key);
21306             this.size = data.size;
21307             return result2;
21308           }
21309           function stackGet2(key) {
21310             return this.__data__.get(key);
21311           }
21312           function stackHas2(key) {
21313             return this.__data__.has(key);
21314           }
21315           function stackSet2(key, value) {
21316             var data = this.__data__;
21317             if (data instanceof ListCache2) {
21318               var pairs2 = data.__data__;
21319               if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
21320                 pairs2.push([key, value]);
21321                 this.size = ++data.size;
21322                 return this;
21323               }
21324               data = this.__data__ = new MapCache2(pairs2);
21325             }
21326             data.set(key, value);
21327             this.size = data.size;
21328             return this;
21329           }
21330           Stack2.prototype.clear = stackClear2;
21331           Stack2.prototype["delete"] = stackDelete2;
21332           Stack2.prototype.get = stackGet2;
21333           Stack2.prototype.has = stackHas2;
21334           Stack2.prototype.set = stackSet2;
21335           function arrayLikeKeys2(value, inherited) {
21336             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length2 = result2.length;
21337             for (var key in value) {
21338               if ((inherited || hasOwnProperty13.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
21339               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
21340               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
21341               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
21342               isIndex2(key, length2)))) {
21343                 result2.push(key);
21344               }
21345             }
21346             return result2;
21347           }
21348           function arraySample(array2) {
21349             var length2 = array2.length;
21350             return length2 ? array2[baseRandom(0, length2 - 1)] : undefined2;
21351           }
21352           function arraySampleSize(array2, n3) {
21353             return shuffleSelf(copyArray2(array2), baseClamp(n3, 0, array2.length));
21354           }
21355           function arrayShuffle(array2) {
21356             return shuffleSelf(copyArray2(array2));
21357           }
21358           function assignMergeValue2(object, key, value) {
21359             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
21360               baseAssignValue2(object, key, value);
21361             }
21362           }
21363           function assignValue2(object, key, value) {
21364             var objValue = object[key];
21365             if (!(hasOwnProperty13.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
21366               baseAssignValue2(object, key, value);
21367             }
21368           }
21369           function assocIndexOf2(array2, key) {
21370             var length2 = array2.length;
21371             while (length2--) {
21372               if (eq2(array2[length2][0], key)) {
21373                 return length2;
21374               }
21375             }
21376             return -1;
21377           }
21378           function baseAggregator(collection, setter, iteratee2, accumulator) {
21379             baseEach(collection, function(value, key, collection2) {
21380               setter(accumulator, value, iteratee2(value), collection2);
21381             });
21382             return accumulator;
21383           }
21384           function baseAssign(object, source) {
21385             return object && copyObject2(source, keys2(source), object);
21386           }
21387           function baseAssignIn(object, source) {
21388             return object && copyObject2(source, keysIn2(source), object);
21389           }
21390           function baseAssignValue2(object, key, value) {
21391             if (key == "__proto__" && defineProperty2) {
21392               defineProperty2(object, key, {
21393                 "configurable": true,
21394                 "enumerable": true,
21395                 "value": value,
21396                 "writable": true
21397               });
21398             } else {
21399               object[key] = value;
21400             }
21401           }
21402           function baseAt(object, paths) {
21403             var index = -1, length2 = paths.length, result2 = Array2(length2), skip = object == null;
21404             while (++index < length2) {
21405               result2[index] = skip ? undefined2 : get4(object, paths[index]);
21406             }
21407             return result2;
21408           }
21409           function baseClamp(number3, lower2, upper) {
21410             if (number3 === number3) {
21411               if (upper !== undefined2) {
21412                 number3 = number3 <= upper ? number3 : upper;
21413               }
21414               if (lower2 !== undefined2) {
21415                 number3 = number3 >= lower2 ? number3 : lower2;
21416               }
21417             }
21418             return number3;
21419           }
21420           function baseClone(value, bitmask, customizer, key, object, stack) {
21421             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
21422             if (customizer) {
21423               result2 = object ? customizer(value, key, object, stack) : customizer(value);
21424             }
21425             if (result2 !== undefined2) {
21426               return result2;
21427             }
21428             if (!isObject2(value)) {
21429               return value;
21430             }
21431             var isArr = isArray2(value);
21432             if (isArr) {
21433               result2 = initCloneArray(value);
21434               if (!isDeep) {
21435                 return copyArray2(value, result2);
21436               }
21437             } else {
21438               var tag2 = getTag2(value), isFunc = tag2 == funcTag3 || tag2 == genTag2;
21439               if (isBuffer2(value)) {
21440                 return cloneBuffer2(value, isDeep);
21441               }
21442               if (tag2 == objectTag5 || tag2 == argsTag4 || isFunc && !object) {
21443                 result2 = isFlat || isFunc ? {} : initCloneObject2(value);
21444                 if (!isDeep) {
21445                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
21446                 }
21447               } else {
21448                 if (!cloneableTags[tag2]) {
21449                   return object ? value : {};
21450                 }
21451                 result2 = initCloneByTag(value, tag2, isDeep);
21452               }
21453             }
21454             stack || (stack = new Stack2());
21455             var stacked = stack.get(value);
21456             if (stacked) {
21457               return stacked;
21458             }
21459             stack.set(value, result2);
21460             if (isSet(value)) {
21461               value.forEach(function(subValue) {
21462                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
21463               });
21464             } else if (isMap(value)) {
21465               value.forEach(function(subValue, key2) {
21466                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
21467               });
21468             }
21469             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn2 : keys2;
21470             var props = isArr ? undefined2 : keysFunc(value);
21471             arrayEach(props || value, function(subValue, key2) {
21472               if (props) {
21473                 key2 = subValue;
21474                 subValue = value[key2];
21475               }
21476               assignValue2(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
21477             });
21478             return result2;
21479           }
21480           function baseConforms(source) {
21481             var props = keys2(source);
21482             return function(object) {
21483               return baseConformsTo(object, source, props);
21484             };
21485           }
21486           function baseConformsTo(object, source, props) {
21487             var length2 = props.length;
21488             if (object == null) {
21489               return !length2;
21490             }
21491             object = Object2(object);
21492             while (length2--) {
21493               var key = props[length2], predicate = source[key], value = object[key];
21494               if (value === undefined2 && !(key in object) || !predicate(value)) {
21495                 return false;
21496               }
21497             }
21498             return true;
21499           }
21500           function baseDelay(func, wait, args) {
21501             if (typeof func != "function") {
21502               throw new TypeError2(FUNC_ERROR_TEXT3);
21503             }
21504             return setTimeout2(function() {
21505               func.apply(undefined2, args);
21506             }, wait);
21507           }
21508           function baseDifference(array2, values2, iteratee2, comparator) {
21509             var index = -1, includes2 = arrayIncludes, isCommon = true, length2 = array2.length, result2 = [], valuesLength = values2.length;
21510             if (!length2) {
21511               return result2;
21512             }
21513             if (iteratee2) {
21514               values2 = arrayMap2(values2, baseUnary2(iteratee2));
21515             }
21516             if (comparator) {
21517               includes2 = arrayIncludesWith;
21518               isCommon = false;
21519             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
21520               includes2 = cacheHas2;
21521               isCommon = false;
21522               values2 = new SetCache2(values2);
21523             }
21524             outer:
21525               while (++index < length2) {
21526                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
21527                 value = comparator || value !== 0 ? value : 0;
21528                 if (isCommon && computed === computed) {
21529                   var valuesIndex = valuesLength;
21530                   while (valuesIndex--) {
21531                     if (values2[valuesIndex] === computed) {
21532                       continue outer;
21533                     }
21534                   }
21535                   result2.push(value);
21536                 } else if (!includes2(values2, computed, comparator)) {
21537                   result2.push(value);
21538                 }
21539               }
21540             return result2;
21541           }
21542           var baseEach = createBaseEach(baseForOwn);
21543           var baseEachRight = createBaseEach(baseForOwnRight, true);
21544           function baseEvery(collection, predicate) {
21545             var result2 = true;
21546             baseEach(collection, function(value, index, collection2) {
21547               result2 = !!predicate(value, index, collection2);
21548               return result2;
21549             });
21550             return result2;
21551           }
21552           function baseExtremum(array2, iteratee2, comparator) {
21553             var index = -1, length2 = array2.length;
21554             while (++index < length2) {
21555               var value = array2[index], current = iteratee2(value);
21556               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
21557                 var computed = current, result2 = value;
21558               }
21559             }
21560             return result2;
21561           }
21562           function baseFill(array2, value, start2, end) {
21563             var length2 = array2.length;
21564             start2 = toInteger(start2);
21565             if (start2 < 0) {
21566               start2 = -start2 > length2 ? 0 : length2 + start2;
21567             }
21568             end = end === undefined2 || end > length2 ? length2 : toInteger(end);
21569             if (end < 0) {
21570               end += length2;
21571             }
21572             end = start2 > end ? 0 : toLength(end);
21573             while (start2 < end) {
21574               array2[start2++] = value;
21575             }
21576             return array2;
21577           }
21578           function baseFilter(collection, predicate) {
21579             var result2 = [];
21580             baseEach(collection, function(value, index, collection2) {
21581               if (predicate(value, index, collection2)) {
21582                 result2.push(value);
21583               }
21584             });
21585             return result2;
21586           }
21587           function baseFlatten(array2, depth, predicate, isStrict, result2) {
21588             var index = -1, length2 = array2.length;
21589             predicate || (predicate = isFlattenable);
21590             result2 || (result2 = []);
21591             while (++index < length2) {
21592               var value = array2[index];
21593               if (depth > 0 && predicate(value)) {
21594                 if (depth > 1) {
21595                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
21596                 } else {
21597                   arrayPush2(result2, value);
21598                 }
21599               } else if (!isStrict) {
21600                 result2[result2.length] = value;
21601               }
21602             }
21603             return result2;
21604           }
21605           var baseFor2 = createBaseFor2();
21606           var baseForRight = createBaseFor2(true);
21607           function baseForOwn(object, iteratee2) {
21608             return object && baseFor2(object, iteratee2, keys2);
21609           }
21610           function baseForOwnRight(object, iteratee2) {
21611             return object && baseForRight(object, iteratee2, keys2);
21612           }
21613           function baseFunctions(object, props) {
21614             return arrayFilter2(props, function(key) {
21615               return isFunction2(object[key]);
21616             });
21617           }
21618           function baseGet(object, path) {
21619             path = castPath(path, object);
21620             var index = 0, length2 = path.length;
21621             while (object != null && index < length2) {
21622               object = object[toKey(path[index++])];
21623             }
21624             return index && index == length2 ? object : undefined2;
21625           }
21626           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
21627             var result2 = keysFunc(object);
21628             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
21629           }
21630           function baseGetTag2(value) {
21631             if (value == null) {
21632               return value === undefined2 ? undefinedTag2 : nullTag2;
21633             }
21634             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
21635           }
21636           function baseGt(value, other2) {
21637             return value > other2;
21638           }
21639           function baseHas(object, key) {
21640             return object != null && hasOwnProperty13.call(object, key);
21641           }
21642           function baseHasIn(object, key) {
21643             return object != null && key in Object2(object);
21644           }
21645           function baseInRange(number3, start2, end) {
21646             return number3 >= nativeMin2(start2, end) && number3 < nativeMax3(start2, end);
21647           }
21648           function baseIntersection(arrays, iteratee2, comparator) {
21649             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
21650             while (othIndex--) {
21651               var array2 = arrays[othIndex];
21652               if (othIndex && iteratee2) {
21653                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
21654               }
21655               maxLength = nativeMin2(array2.length, maxLength);
21656               caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
21657             }
21658             array2 = arrays[0];
21659             var index = -1, seen = caches[0];
21660             outer:
21661               while (++index < length2 && result2.length < maxLength) {
21662                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
21663                 value = comparator || value !== 0 ? value : 0;
21664                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
21665                   othIndex = othLength;
21666                   while (--othIndex) {
21667                     var cache = caches[othIndex];
21668                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
21669                       continue outer;
21670                     }
21671                   }
21672                   if (seen) {
21673                     seen.push(computed);
21674                   }
21675                   result2.push(value);
21676                 }
21677               }
21678             return result2;
21679           }
21680           function baseInverter(object, setter, iteratee2, accumulator) {
21681             baseForOwn(object, function(value, key, object2) {
21682               setter(accumulator, iteratee2(value), key, object2);
21683             });
21684             return accumulator;
21685           }
21686           function baseInvoke(object, path, args) {
21687             path = castPath(path, object);
21688             object = parent(object, path);
21689             var func = object == null ? object : object[toKey(last(path))];
21690             return func == null ? undefined2 : apply2(func, object, args);
21691           }
21692           function baseIsArguments2(value) {
21693             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
21694           }
21695           function baseIsArrayBuffer(value) {
21696             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
21697           }
21698           function baseIsDate(value) {
21699             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
21700           }
21701           function baseIsEqual2(value, other2, bitmask, customizer, stack) {
21702             if (value === other2) {
21703               return true;
21704             }
21705             if (value == null || other2 == null || !isObjectLike2(value) && !isObjectLike2(other2)) {
21706               return value !== value && other2 !== other2;
21707             }
21708             return baseIsEqualDeep2(value, other2, bitmask, customizer, baseIsEqual2, stack);
21709           }
21710           function baseIsEqualDeep2(object, other2, bitmask, customizer, equalFunc, stack) {
21711             var objIsArr = isArray2(object), othIsArr = isArray2(other2), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other2);
21712             objTag = objTag == argsTag4 ? objectTag5 : objTag;
21713             othTag = othTag == argsTag4 ? objectTag5 : othTag;
21714             var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
21715             if (isSameTag && isBuffer2(object)) {
21716               if (!isBuffer2(other2)) {
21717                 return false;
21718               }
21719               objIsArr = true;
21720               objIsObj = false;
21721             }
21722             if (isSameTag && !objIsObj) {
21723               stack || (stack = new Stack2());
21724               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other2, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other2, objTag, bitmask, customizer, equalFunc, stack);
21725             }
21726             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
21727               var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other2, "__wrapped__");
21728               if (objIsWrapped || othIsWrapped) {
21729                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other2.value() : other2;
21730                 stack || (stack = new Stack2());
21731                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
21732               }
21733             }
21734             if (!isSameTag) {
21735               return false;
21736             }
21737             stack || (stack = new Stack2());
21738             return equalObjects2(object, other2, bitmask, customizer, equalFunc, stack);
21739           }
21740           function baseIsMap(value) {
21741             return isObjectLike2(value) && getTag2(value) == mapTag4;
21742           }
21743           function baseIsMatch(object, source, matchData, customizer) {
21744             var index = matchData.length, length2 = index, noCustomizer = !customizer;
21745             if (object == null) {
21746               return !length2;
21747             }
21748             object = Object2(object);
21749             while (index--) {
21750               var data = matchData[index];
21751               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
21752                 return false;
21753               }
21754             }
21755             while (++index < length2) {
21756               data = matchData[index];
21757               var key = data[0], objValue = object[key], srcValue = data[1];
21758               if (noCustomizer && data[2]) {
21759                 if (objValue === undefined2 && !(key in object)) {
21760                   return false;
21761                 }
21762               } else {
21763                 var stack = new Stack2();
21764                 if (customizer) {
21765                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
21766                 }
21767                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
21768                   return false;
21769                 }
21770               }
21771             }
21772             return true;
21773           }
21774           function baseIsNative2(value) {
21775             if (!isObject2(value) || isMasked2(value)) {
21776               return false;
21777             }
21778             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
21779             return pattern.test(toSource2(value));
21780           }
21781           function baseIsRegExp(value) {
21782             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
21783           }
21784           function baseIsSet(value) {
21785             return isObjectLike2(value) && getTag2(value) == setTag4;
21786           }
21787           function baseIsTypedArray2(value) {
21788             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
21789           }
21790           function baseIteratee(value) {
21791             if (typeof value == "function") {
21792               return value;
21793             }
21794             if (value == null) {
21795               return identity5;
21796             }
21797             if (typeof value == "object") {
21798               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
21799             }
21800             return property(value);
21801           }
21802           function baseKeys2(object) {
21803             if (!isPrototype2(object)) {
21804               return nativeKeys2(object);
21805             }
21806             var result2 = [];
21807             for (var key in Object2(object)) {
21808               if (hasOwnProperty13.call(object, key) && key != "constructor") {
21809                 result2.push(key);
21810               }
21811             }
21812             return result2;
21813           }
21814           function baseKeysIn2(object) {
21815             if (!isObject2(object)) {
21816               return nativeKeysIn2(object);
21817             }
21818             var isProto = isPrototype2(object), result2 = [];
21819             for (var key in object) {
21820               if (!(key == "constructor" && (isProto || !hasOwnProperty13.call(object, key)))) {
21821                 result2.push(key);
21822               }
21823             }
21824             return result2;
21825           }
21826           function baseLt(value, other2) {
21827             return value < other2;
21828           }
21829           function baseMap(collection, iteratee2) {
21830             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
21831             baseEach(collection, function(value, key, collection2) {
21832               result2[++index] = iteratee2(value, key, collection2);
21833             });
21834             return result2;
21835           }
21836           function baseMatches(source) {
21837             var matchData = getMatchData(source);
21838             if (matchData.length == 1 && matchData[0][2]) {
21839               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
21840             }
21841             return function(object) {
21842               return object === source || baseIsMatch(object, source, matchData);
21843             };
21844           }
21845           function baseMatchesProperty(path, srcValue) {
21846             if (isKey(path) && isStrictComparable(srcValue)) {
21847               return matchesStrictComparable(toKey(path), srcValue);
21848             }
21849             return function(object) {
21850               var objValue = get4(object, path);
21851               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
21852             };
21853           }
21854           function baseMerge2(object, source, srcIndex, customizer, stack) {
21855             if (object === source) {
21856               return;
21857             }
21858             baseFor2(source, function(srcValue, key) {
21859               stack || (stack = new Stack2());
21860               if (isObject2(srcValue)) {
21861                 baseMergeDeep2(object, source, key, srcIndex, baseMerge2, customizer, stack);
21862               } else {
21863                 var newValue = customizer ? customizer(safeGet2(object, key), srcValue, key + "", object, source, stack) : undefined2;
21864                 if (newValue === undefined2) {
21865                   newValue = srcValue;
21866                 }
21867                 assignMergeValue2(object, key, newValue);
21868               }
21869             }, keysIn2);
21870           }
21871           function baseMergeDeep2(object, source, key, srcIndex, mergeFunc, customizer, stack) {
21872             var objValue = safeGet2(object, key), srcValue = safeGet2(source, key), stacked = stack.get(srcValue);
21873             if (stacked) {
21874               assignMergeValue2(object, key, stacked);
21875               return;
21876             }
21877             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
21878             var isCommon = newValue === undefined2;
21879             if (isCommon) {
21880               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
21881               newValue = srcValue;
21882               if (isArr || isBuff || isTyped) {
21883                 if (isArray2(objValue)) {
21884                   newValue = objValue;
21885                 } else if (isArrayLikeObject2(objValue)) {
21886                   newValue = copyArray2(objValue);
21887                 } else if (isBuff) {
21888                   isCommon = false;
21889                   newValue = cloneBuffer2(srcValue, true);
21890                 } else if (isTyped) {
21891                   isCommon = false;
21892                   newValue = cloneTypedArray2(srcValue, true);
21893                 } else {
21894                   newValue = [];
21895                 }
21896               } else if (isPlainObject2(srcValue) || isArguments2(srcValue)) {
21897                 newValue = objValue;
21898                 if (isArguments2(objValue)) {
21899                   newValue = toPlainObject2(objValue);
21900                 } else if (!isObject2(objValue) || isFunction2(objValue)) {
21901                   newValue = initCloneObject2(srcValue);
21902                 }
21903               } else {
21904                 isCommon = false;
21905               }
21906             }
21907             if (isCommon) {
21908               stack.set(srcValue, newValue);
21909               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
21910               stack["delete"](srcValue);
21911             }
21912             assignMergeValue2(object, key, newValue);
21913           }
21914           function baseNth(array2, n3) {
21915             var length2 = array2.length;
21916             if (!length2) {
21917               return;
21918             }
21919             n3 += n3 < 0 ? length2 : 0;
21920             return isIndex2(n3, length2) ? array2[n3] : undefined2;
21921           }
21922           function baseOrderBy(collection, iteratees, orders) {
21923             if (iteratees.length) {
21924               iteratees = arrayMap2(iteratees, function(iteratee2) {
21925                 if (isArray2(iteratee2)) {
21926                   return function(value) {
21927                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
21928                   };
21929                 }
21930                 return iteratee2;
21931               });
21932             } else {
21933               iteratees = [identity5];
21934             }
21935             var index = -1;
21936             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
21937             var result2 = baseMap(collection, function(value, key, collection2) {
21938               var criteria = arrayMap2(iteratees, function(iteratee2) {
21939                 return iteratee2(value);
21940               });
21941               return { "criteria": criteria, "index": ++index, "value": value };
21942             });
21943             return baseSortBy(result2, function(object, other2) {
21944               return compareMultiple(object, other2, orders);
21945             });
21946           }
21947           function basePick(object, paths) {
21948             return basePickBy(object, paths, function(value, path) {
21949               return hasIn(object, path);
21950             });
21951           }
21952           function basePickBy(object, paths, predicate) {
21953             var index = -1, length2 = paths.length, result2 = {};
21954             while (++index < length2) {
21955               var path = paths[index], value = baseGet(object, path);
21956               if (predicate(value, path)) {
21957                 baseSet(result2, castPath(path, object), value);
21958               }
21959             }
21960             return result2;
21961           }
21962           function basePropertyDeep(path) {
21963             return function(object) {
21964               return baseGet(object, path);
21965             };
21966           }
21967           function basePullAll(array2, values2, iteratee2, comparator) {
21968             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length2 = values2.length, seen = array2;
21969             if (array2 === values2) {
21970               values2 = copyArray2(values2);
21971             }
21972             if (iteratee2) {
21973               seen = arrayMap2(array2, baseUnary2(iteratee2));
21974             }
21975             while (++index < length2) {
21976               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
21977               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
21978                 if (seen !== array2) {
21979                   splice2.call(seen, fromIndex, 1);
21980                 }
21981                 splice2.call(array2, fromIndex, 1);
21982               }
21983             }
21984             return array2;
21985           }
21986           function basePullAt(array2, indexes) {
21987             var length2 = array2 ? indexes.length : 0, lastIndex = length2 - 1;
21988             while (length2--) {
21989               var index = indexes[length2];
21990               if (length2 == lastIndex || index !== previous) {
21991                 var previous = index;
21992                 if (isIndex2(index)) {
21993                   splice2.call(array2, index, 1);
21994                 } else {
21995                   baseUnset(array2, index);
21996                 }
21997               }
21998             }
21999             return array2;
22000           }
22001           function baseRandom(lower2, upper) {
22002             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
22003           }
22004           function baseRange(start2, end, step, fromRight) {
22005             var index = -1, length2 = nativeMax3(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length2);
22006             while (length2--) {
22007               result2[fromRight ? length2 : ++index] = start2;
22008               start2 += step;
22009             }
22010             return result2;
22011           }
22012           function baseRepeat(string, n3) {
22013             var result2 = "";
22014             if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
22015               return result2;
22016             }
22017             do {
22018               if (n3 % 2) {
22019                 result2 += string;
22020               }
22021               n3 = nativeFloor(n3 / 2);
22022               if (n3) {
22023                 string += string;
22024               }
22025             } while (n3);
22026             return result2;
22027           }
22028           function baseRest2(func, start2) {
22029             return setToString2(overRest2(func, start2, identity5), func + "");
22030           }
22031           function baseSample(collection) {
22032             return arraySample(values(collection));
22033           }
22034           function baseSampleSize(collection, n3) {
22035             var array2 = values(collection);
22036             return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
22037           }
22038           function baseSet(object, path, value, customizer) {
22039             if (!isObject2(object)) {
22040               return object;
22041             }
22042             path = castPath(path, object);
22043             var index = -1, length2 = path.length, lastIndex = length2 - 1, nested = object;
22044             while (nested != null && ++index < length2) {
22045               var key = toKey(path[index]), newValue = value;
22046               if (key === "__proto__" || key === "constructor" || key === "prototype") {
22047                 return object;
22048               }
22049               if (index != lastIndex) {
22050                 var objValue = nested[key];
22051                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
22052                 if (newValue === undefined2) {
22053                   newValue = isObject2(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
22054                 }
22055               }
22056               assignValue2(nested, key, newValue);
22057               nested = nested[key];
22058             }
22059             return object;
22060           }
22061           var baseSetData = !metaMap ? identity5 : function(func, data) {
22062             metaMap.set(func, data);
22063             return func;
22064           };
22065           var baseSetToString2 = !defineProperty2 ? identity5 : function(func, string) {
22066             return defineProperty2(func, "toString", {
22067               "configurable": true,
22068               "enumerable": false,
22069               "value": constant2(string),
22070               "writable": true
22071             });
22072           };
22073           function baseShuffle(collection) {
22074             return shuffleSelf(values(collection));
22075           }
22076           function baseSlice(array2, start2, end) {
22077             var index = -1, length2 = array2.length;
22078             if (start2 < 0) {
22079               start2 = -start2 > length2 ? 0 : length2 + start2;
22080             }
22081             end = end > length2 ? length2 : end;
22082             if (end < 0) {
22083               end += length2;
22084             }
22085             length2 = start2 > end ? 0 : end - start2 >>> 0;
22086             start2 >>>= 0;
22087             var result2 = Array2(length2);
22088             while (++index < length2) {
22089               result2[index] = array2[index + start2];
22090             }
22091             return result2;
22092           }
22093           function baseSome(collection, predicate) {
22094             var result2;
22095             baseEach(collection, function(value, index, collection2) {
22096               result2 = predicate(value, index, collection2);
22097               return !result2;
22098             });
22099             return !!result2;
22100           }
22101           function baseSortedIndex(array2, value, retHighest) {
22102             var low = 0, high = array2 == null ? low : array2.length;
22103             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
22104               while (low < high) {
22105                 var mid = low + high >>> 1, computed = array2[mid];
22106                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
22107                   low = mid + 1;
22108                 } else {
22109                   high = mid;
22110                 }
22111               }
22112               return high;
22113             }
22114             return baseSortedIndexBy(array2, value, identity5, retHighest);
22115           }
22116           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
22117             var low = 0, high = array2 == null ? 0 : array2.length;
22118             if (high === 0) {
22119               return 0;
22120             }
22121             value = iteratee2(value);
22122             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
22123             while (low < high) {
22124               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
22125               if (valIsNaN) {
22126                 var setLow = retHighest || othIsReflexive;
22127               } else if (valIsUndefined) {
22128                 setLow = othIsReflexive && (retHighest || othIsDefined);
22129               } else if (valIsNull) {
22130                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
22131               } else if (valIsSymbol) {
22132                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
22133               } else if (othIsNull || othIsSymbol) {
22134                 setLow = false;
22135               } else {
22136                 setLow = retHighest ? computed <= value : computed < value;
22137               }
22138               if (setLow) {
22139                 low = mid + 1;
22140               } else {
22141                 high = mid;
22142               }
22143             }
22144             return nativeMin2(high, MAX_ARRAY_INDEX);
22145           }
22146           function baseSortedUniq(array2, iteratee2) {
22147             var index = -1, length2 = array2.length, resIndex = 0, result2 = [];
22148             while (++index < length2) {
22149               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
22150               if (!index || !eq2(computed, seen)) {
22151                 var seen = computed;
22152                 result2[resIndex++] = value === 0 ? 0 : value;
22153               }
22154             }
22155             return result2;
22156           }
22157           function baseToNumber(value) {
22158             if (typeof value == "number") {
22159               return value;
22160             }
22161             if (isSymbol2(value)) {
22162               return NAN2;
22163             }
22164             return +value;
22165           }
22166           function baseToString2(value) {
22167             if (typeof value == "string") {
22168               return value;
22169             }
22170             if (isArray2(value)) {
22171               return arrayMap2(value, baseToString2) + "";
22172             }
22173             if (isSymbol2(value)) {
22174               return symbolToString2 ? symbolToString2.call(value) : "";
22175             }
22176             var result2 = value + "";
22177             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
22178           }
22179           function baseUniq(array2, iteratee2, comparator) {
22180             var index = -1, includes2 = arrayIncludes, length2 = array2.length, isCommon = true, result2 = [], seen = result2;
22181             if (comparator) {
22182               isCommon = false;
22183               includes2 = arrayIncludesWith;
22184             } else if (length2 >= LARGE_ARRAY_SIZE2) {
22185               var set5 = iteratee2 ? null : createSet(array2);
22186               if (set5) {
22187                 return setToArray2(set5);
22188               }
22189               isCommon = false;
22190               includes2 = cacheHas2;
22191               seen = new SetCache2();
22192             } else {
22193               seen = iteratee2 ? [] : result2;
22194             }
22195             outer:
22196               while (++index < length2) {
22197                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
22198                 value = comparator || value !== 0 ? value : 0;
22199                 if (isCommon && computed === computed) {
22200                   var seenIndex = seen.length;
22201                   while (seenIndex--) {
22202                     if (seen[seenIndex] === computed) {
22203                       continue outer;
22204                     }
22205                   }
22206                   if (iteratee2) {
22207                     seen.push(computed);
22208                   }
22209                   result2.push(value);
22210                 } else if (!includes2(seen, computed, comparator)) {
22211                   if (seen !== result2) {
22212                     seen.push(computed);
22213                   }
22214                   result2.push(value);
22215                 }
22216               }
22217             return result2;
22218           }
22219           function baseUnset(object, path) {
22220             path = castPath(path, object);
22221             object = parent(object, path);
22222             return object == null || delete object[toKey(last(path))];
22223           }
22224           function baseUpdate(object, path, updater, customizer) {
22225             return baseSet(object, path, updater(baseGet(object, path)), customizer);
22226           }
22227           function baseWhile(array2, predicate, isDrop, fromRight) {
22228             var length2 = array2.length, index = fromRight ? length2 : -1;
22229             while ((fromRight ? index-- : ++index < length2) && predicate(array2[index], index, array2)) {
22230             }
22231             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length2) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length2 : index);
22232           }
22233           function baseWrapperValue(value, actions) {
22234             var result2 = value;
22235             if (result2 instanceof LazyWrapper) {
22236               result2 = result2.value();
22237             }
22238             return arrayReduce(actions, function(result3, action) {
22239               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
22240             }, result2);
22241           }
22242           function baseXor(arrays, iteratee2, comparator) {
22243             var length2 = arrays.length;
22244             if (length2 < 2) {
22245               return length2 ? baseUniq(arrays[0]) : [];
22246             }
22247             var index = -1, result2 = Array2(length2);
22248             while (++index < length2) {
22249               var array2 = arrays[index], othIndex = -1;
22250               while (++othIndex < length2) {
22251                 if (othIndex != index) {
22252                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
22253                 }
22254               }
22255             }
22256             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
22257           }
22258           function baseZipObject(props, values2, assignFunc) {
22259             var index = -1, length2 = props.length, valsLength = values2.length, result2 = {};
22260             while (++index < length2) {
22261               var value = index < valsLength ? values2[index] : undefined2;
22262               assignFunc(result2, props[index], value);
22263             }
22264             return result2;
22265           }
22266           function castArrayLikeObject(value) {
22267             return isArrayLikeObject2(value) ? value : [];
22268           }
22269           function castFunction(value) {
22270             return typeof value == "function" ? value : identity5;
22271           }
22272           function castPath(value, object) {
22273             if (isArray2(value)) {
22274               return value;
22275             }
22276             return isKey(value, object) ? [value] : stringToPath(toString2(value));
22277           }
22278           var castRest = baseRest2;
22279           function castSlice(array2, start2, end) {
22280             var length2 = array2.length;
22281             end = end === undefined2 ? length2 : end;
22282             return !start2 && end >= length2 ? array2 : baseSlice(array2, start2, end);
22283           }
22284           var clearTimeout2 = ctxClearTimeout || function(id2) {
22285             return root3.clearTimeout(id2);
22286           };
22287           function cloneBuffer2(buffer, isDeep) {
22288             if (isDeep) {
22289               return buffer.slice();
22290             }
22291             var length2 = buffer.length, result2 = allocUnsafe2 ? allocUnsafe2(length2) : new buffer.constructor(length2);
22292             buffer.copy(result2);
22293             return result2;
22294           }
22295           function cloneArrayBuffer2(arrayBuffer) {
22296             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
22297             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
22298             return result2;
22299           }
22300           function cloneDataView(dataView, isDeep) {
22301             var buffer = isDeep ? cloneArrayBuffer2(dataView.buffer) : dataView.buffer;
22302             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
22303           }
22304           function cloneRegExp(regexp) {
22305             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
22306             result2.lastIndex = regexp.lastIndex;
22307             return result2;
22308           }
22309           function cloneSymbol(symbol) {
22310             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
22311           }
22312           function cloneTypedArray2(typedArray, isDeep) {
22313             var buffer = isDeep ? cloneArrayBuffer2(typedArray.buffer) : typedArray.buffer;
22314             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
22315           }
22316           function compareAscending(value, other2) {
22317             if (value !== other2) {
22318               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
22319               var othIsDefined = other2 !== undefined2, othIsNull = other2 === null, othIsReflexive = other2 === other2, othIsSymbol = isSymbol2(other2);
22320               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other2 || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
22321                 return 1;
22322               }
22323               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other2 || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
22324                 return -1;
22325               }
22326             }
22327             return 0;
22328           }
22329           function compareMultiple(object, other2, orders) {
22330             var index = -1, objCriteria = object.criteria, othCriteria = other2.criteria, length2 = objCriteria.length, ordersLength = orders.length;
22331             while (++index < length2) {
22332               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
22333               if (result2) {
22334                 if (index >= ordersLength) {
22335                   return result2;
22336                 }
22337                 var order = orders[index];
22338                 return result2 * (order == "desc" ? -1 : 1);
22339               }
22340             }
22341             return object.index - other2.index;
22342           }
22343           function composeArgs(args, partials, holders, isCurried) {
22344             var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax3(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
22345             while (++leftIndex < leftLength) {
22346               result2[leftIndex] = partials[leftIndex];
22347             }
22348             while (++argsIndex < holdersLength) {
22349               if (isUncurried || argsIndex < argsLength) {
22350                 result2[holders[argsIndex]] = args[argsIndex];
22351               }
22352             }
22353             while (rangeLength--) {
22354               result2[leftIndex++] = args[argsIndex++];
22355             }
22356             return result2;
22357           }
22358           function composeArgsRight(args, partials, holders, isCurried) {
22359             var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax3(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
22360             while (++argsIndex < rangeLength) {
22361               result2[argsIndex] = args[argsIndex];
22362             }
22363             var offset = argsIndex;
22364             while (++rightIndex < rightLength) {
22365               result2[offset + rightIndex] = partials[rightIndex];
22366             }
22367             while (++holdersIndex < holdersLength) {
22368               if (isUncurried || argsIndex < argsLength) {
22369                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
22370               }
22371             }
22372             return result2;
22373           }
22374           function copyArray2(source, array2) {
22375             var index = -1, length2 = source.length;
22376             array2 || (array2 = Array2(length2));
22377             while (++index < length2) {
22378               array2[index] = source[index];
22379             }
22380             return array2;
22381           }
22382           function copyObject2(source, props, object, customizer) {
22383             var isNew = !object;
22384             object || (object = {});
22385             var index = -1, length2 = props.length;
22386             while (++index < length2) {
22387               var key = props[index];
22388               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
22389               if (newValue === undefined2) {
22390                 newValue = source[key];
22391               }
22392               if (isNew) {
22393                 baseAssignValue2(object, key, newValue);
22394               } else {
22395                 assignValue2(object, key, newValue);
22396               }
22397             }
22398             return object;
22399           }
22400           function copySymbols(source, object) {
22401             return copyObject2(source, getSymbols2(source), object);
22402           }
22403           function copySymbolsIn(source, object) {
22404             return copyObject2(source, getSymbolsIn(source), object);
22405           }
22406           function createAggregator(setter, initializer) {
22407             return function(collection, iteratee2) {
22408               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
22409               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
22410             };
22411           }
22412           function createAssigner2(assigner) {
22413             return baseRest2(function(object, sources) {
22414               var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined2, guard = length2 > 2 ? sources[2] : undefined2;
22415               customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined2;
22416               if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
22417                 customizer = length2 < 3 ? undefined2 : customizer;
22418                 length2 = 1;
22419               }
22420               object = Object2(object);
22421               while (++index < length2) {
22422                 var source = sources[index];
22423                 if (source) {
22424                   assigner(object, source, index, customizer);
22425                 }
22426               }
22427               return object;
22428             });
22429           }
22430           function createBaseEach(eachFunc, fromRight) {
22431             return function(collection, iteratee2) {
22432               if (collection == null) {
22433                 return collection;
22434               }
22435               if (!isArrayLike2(collection)) {
22436                 return eachFunc(collection, iteratee2);
22437               }
22438               var length2 = collection.length, index = fromRight ? length2 : -1, iterable = Object2(collection);
22439               while (fromRight ? index-- : ++index < length2) {
22440                 if (iteratee2(iterable[index], index, iterable) === false) {
22441                   break;
22442                 }
22443               }
22444               return collection;
22445             };
22446           }
22447           function createBaseFor2(fromRight) {
22448             return function(object, iteratee2, keysFunc) {
22449               var index = -1, iterable = Object2(object), props = keysFunc(object), length2 = props.length;
22450               while (length2--) {
22451                 var key = props[fromRight ? length2 : ++index];
22452                 if (iteratee2(iterable[key], key, iterable) === false) {
22453                   break;
22454                 }
22455               }
22456               return object;
22457             };
22458           }
22459           function createBind(func, bitmask, thisArg) {
22460             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
22461             function wrapper() {
22462               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22463               return fn.apply(isBind ? thisArg : this, arguments);
22464             }
22465             return wrapper;
22466           }
22467           function createCaseFirst(methodName) {
22468             return function(string) {
22469               string = toString2(string);
22470               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
22471               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
22472               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
22473               return chr[methodName]() + trailing;
22474             };
22475           }
22476           function createCompounder(callback) {
22477             return function(string) {
22478               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
22479             };
22480           }
22481           function createCtor(Ctor) {
22482             return function() {
22483               var args = arguments;
22484               switch (args.length) {
22485                 case 0:
22486                   return new Ctor();
22487                 case 1:
22488                   return new Ctor(args[0]);
22489                 case 2:
22490                   return new Ctor(args[0], args[1]);
22491                 case 3:
22492                   return new Ctor(args[0], args[1], args[2]);
22493                 case 4:
22494                   return new Ctor(args[0], args[1], args[2], args[3]);
22495                 case 5:
22496                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
22497                 case 6:
22498                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
22499                 case 7:
22500                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
22501               }
22502               var thisBinding = baseCreate2(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
22503               return isObject2(result2) ? result2 : thisBinding;
22504             };
22505           }
22506           function createCurry(func, bitmask, arity) {
22507             var Ctor = createCtor(func);
22508             function wrapper() {
22509               var length2 = arguments.length, args = Array2(length2), index = length2, placeholder = getHolder(wrapper);
22510               while (index--) {
22511                 args[index] = arguments[index];
22512               }
22513               var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
22514               length2 -= holders.length;
22515               if (length2 < arity) {
22516                 return createRecurry(
22517                   func,
22518                   bitmask,
22519                   createHybrid,
22520                   wrapper.placeholder,
22521                   undefined2,
22522                   args,
22523                   holders,
22524                   undefined2,
22525                   undefined2,
22526                   arity - length2
22527                 );
22528               }
22529               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22530               return apply2(fn, this, args);
22531             }
22532             return wrapper;
22533           }
22534           function createFind(findIndexFunc) {
22535             return function(collection, predicate, fromIndex) {
22536               var iterable = Object2(collection);
22537               if (!isArrayLike2(collection)) {
22538                 var iteratee2 = getIteratee(predicate, 3);
22539                 collection = keys2(collection);
22540                 predicate = function(key) {
22541                   return iteratee2(iterable[key], key, iterable);
22542                 };
22543               }
22544               var index = findIndexFunc(collection, predicate, fromIndex);
22545               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
22546             };
22547           }
22548           function createFlow(fromRight) {
22549             return flatRest(function(funcs) {
22550               var length2 = funcs.length, index = length2, prereq = LodashWrapper.prototype.thru;
22551               if (fromRight) {
22552                 funcs.reverse();
22553               }
22554               while (index--) {
22555                 var func = funcs[index];
22556                 if (typeof func != "function") {
22557                   throw new TypeError2(FUNC_ERROR_TEXT3);
22558                 }
22559                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
22560                   var wrapper = new LodashWrapper([], true);
22561                 }
22562               }
22563               index = wrapper ? index : length2;
22564               while (++index < length2) {
22565                 func = funcs[index];
22566                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
22567                 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) {
22568                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
22569                 } else {
22570                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
22571                 }
22572               }
22573               return function() {
22574                 var args = arguments, value = args[0];
22575                 if (wrapper && args.length == 1 && isArray2(value)) {
22576                   return wrapper.plant(value).value();
22577                 }
22578                 var index2 = 0, result2 = length2 ? funcs[index2].apply(this, args) : value;
22579                 while (++index2 < length2) {
22580                   result2 = funcs[index2].call(this, result2);
22581                 }
22582                 return result2;
22583               };
22584             });
22585           }
22586           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
22587             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);
22588             function wrapper() {
22589               var length2 = arguments.length, args = Array2(length2), index = length2;
22590               while (index--) {
22591                 args[index] = arguments[index];
22592               }
22593               if (isCurried) {
22594                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
22595               }
22596               if (partials) {
22597                 args = composeArgs(args, partials, holders, isCurried);
22598               }
22599               if (partialsRight) {
22600                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
22601               }
22602               length2 -= holdersCount;
22603               if (isCurried && length2 < arity) {
22604                 var newHolders = replaceHolders(args, placeholder);
22605                 return createRecurry(
22606                   func,
22607                   bitmask,
22608                   createHybrid,
22609                   wrapper.placeholder,
22610                   thisArg,
22611                   args,
22612                   newHolders,
22613                   argPos,
22614                   ary2,
22615                   arity - length2
22616                 );
22617               }
22618               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
22619               length2 = args.length;
22620               if (argPos) {
22621                 args = reorder(args, argPos);
22622               } else if (isFlip && length2 > 1) {
22623                 args.reverse();
22624               }
22625               if (isAry && ary2 < length2) {
22626                 args.length = ary2;
22627               }
22628               if (this && this !== root3 && this instanceof wrapper) {
22629                 fn = Ctor || createCtor(fn);
22630               }
22631               return fn.apply(thisBinding, args);
22632             }
22633             return wrapper;
22634           }
22635           function createInverter(setter, toIteratee) {
22636             return function(object, iteratee2) {
22637               return baseInverter(object, setter, toIteratee(iteratee2), {});
22638             };
22639           }
22640           function createMathOperation(operator, defaultValue) {
22641             return function(value, other2) {
22642               var result2;
22643               if (value === undefined2 && other2 === undefined2) {
22644                 return defaultValue;
22645               }
22646               if (value !== undefined2) {
22647                 result2 = value;
22648               }
22649               if (other2 !== undefined2) {
22650                 if (result2 === undefined2) {
22651                   return other2;
22652                 }
22653                 if (typeof value == "string" || typeof other2 == "string") {
22654                   value = baseToString2(value);
22655                   other2 = baseToString2(other2);
22656                 } else {
22657                   value = baseToNumber(value);
22658                   other2 = baseToNumber(other2);
22659                 }
22660                 result2 = operator(value, other2);
22661               }
22662               return result2;
22663             };
22664           }
22665           function createOver(arrayFunc) {
22666             return flatRest(function(iteratees) {
22667               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
22668               return baseRest2(function(args) {
22669                 var thisArg = this;
22670                 return arrayFunc(iteratees, function(iteratee2) {
22671                   return apply2(iteratee2, thisArg, args);
22672                 });
22673               });
22674             });
22675           }
22676           function createPadding(length2, chars) {
22677             chars = chars === undefined2 ? " " : baseToString2(chars);
22678             var charsLength = chars.length;
22679             if (charsLength < 2) {
22680               return charsLength ? baseRepeat(chars, length2) : chars;
22681             }
22682             var result2 = baseRepeat(chars, nativeCeil(length2 / stringSize(chars)));
22683             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length2).join("") : result2.slice(0, length2);
22684           }
22685           function createPartial(func, bitmask, thisArg, partials) {
22686             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
22687             function wrapper() {
22688               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
22689               while (++leftIndex < leftLength) {
22690                 args[leftIndex] = partials[leftIndex];
22691               }
22692               while (argsLength--) {
22693                 args[leftIndex++] = arguments[++argsIndex];
22694               }
22695               return apply2(fn, isBind ? thisArg : this, args);
22696             }
22697             return wrapper;
22698           }
22699           function createRange(fromRight) {
22700             return function(start2, end, step) {
22701               if (step && typeof step != "number" && isIterateeCall2(start2, end, step)) {
22702                 end = step = undefined2;
22703               }
22704               start2 = toFinite(start2);
22705               if (end === undefined2) {
22706                 end = start2;
22707                 start2 = 0;
22708               } else {
22709                 end = toFinite(end);
22710               }
22711               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
22712               return baseRange(start2, end, step, fromRight);
22713             };
22714           }
22715           function createRelationalOperation(operator) {
22716             return function(value, other2) {
22717               if (!(typeof value == "string" && typeof other2 == "string")) {
22718                 value = toNumber3(value);
22719                 other2 = toNumber3(other2);
22720               }
22721               return operator(value, other2);
22722             };
22723           }
22724           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
22725             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
22726             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
22727             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
22728             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
22729               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
22730             }
22731             var newData = [
22732               func,
22733               bitmask,
22734               thisArg,
22735               newPartials,
22736               newHolders,
22737               newPartialsRight,
22738               newHoldersRight,
22739               argPos,
22740               ary2,
22741               arity
22742             ];
22743             var result2 = wrapFunc.apply(undefined2, newData);
22744             if (isLaziable(func)) {
22745               setData(result2, newData);
22746             }
22747             result2.placeholder = placeholder;
22748             return setWrapToString(result2, func, bitmask);
22749           }
22750           function createRound(methodName) {
22751             var func = Math2[methodName];
22752             return function(number3, precision3) {
22753               number3 = toNumber3(number3);
22754               precision3 = precision3 == null ? 0 : nativeMin2(toInteger(precision3), 292);
22755               if (precision3 && nativeIsFinite(number3)) {
22756                 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision3));
22757                 pair3 = (toString2(value) + "e").split("e");
22758                 return +(pair3[0] + "e" + (+pair3[1] - precision3));
22759               }
22760               return func(number3);
22761             };
22762           }
22763           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
22764             return new Set3(values2);
22765           };
22766           function createToPairs(keysFunc) {
22767             return function(object) {
22768               var tag2 = getTag2(object);
22769               if (tag2 == mapTag4) {
22770                 return mapToArray2(object);
22771               }
22772               if (tag2 == setTag4) {
22773                 return setToPairs(object);
22774               }
22775               return baseToPairs(object, keysFunc(object));
22776             };
22777           }
22778           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
22779             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
22780             if (!isBindKey && typeof func != "function") {
22781               throw new TypeError2(FUNC_ERROR_TEXT3);
22782             }
22783             var length2 = partials ? partials.length : 0;
22784             if (!length2) {
22785               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
22786               partials = holders = undefined2;
22787             }
22788             ary2 = ary2 === undefined2 ? ary2 : nativeMax3(toInteger(ary2), 0);
22789             arity = arity === undefined2 ? arity : toInteger(arity);
22790             length2 -= holders ? holders.length : 0;
22791             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
22792               var partialsRight = partials, holdersRight = holders;
22793               partials = holders = undefined2;
22794             }
22795             var data = isBindKey ? undefined2 : getData(func);
22796             var newData = [
22797               func,
22798               bitmask,
22799               thisArg,
22800               partials,
22801               holders,
22802               partialsRight,
22803               holdersRight,
22804               argPos,
22805               ary2,
22806               arity
22807             ];
22808             if (data) {
22809               mergeData(newData, data);
22810             }
22811             func = newData[0];
22812             bitmask = newData[1];
22813             thisArg = newData[2];
22814             partials = newData[3];
22815             holders = newData[4];
22816             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax3(newData[9] - length2, 0);
22817             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
22818               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
22819             }
22820             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
22821               var result2 = createBind(func, bitmask, thisArg);
22822             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
22823               result2 = createCurry(func, bitmask, arity);
22824             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
22825               result2 = createPartial(func, bitmask, thisArg, partials);
22826             } else {
22827               result2 = createHybrid.apply(undefined2, newData);
22828             }
22829             var setter = data ? baseSetData : setData;
22830             return setWrapToString(setter(result2, newData), func, bitmask);
22831           }
22832           function customDefaultsAssignIn(objValue, srcValue, key, object) {
22833             if (objValue === undefined2 || eq2(objValue, objectProto16[key]) && !hasOwnProperty13.call(object, key)) {
22834               return srcValue;
22835             }
22836             return objValue;
22837           }
22838           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
22839             if (isObject2(objValue) && isObject2(srcValue)) {
22840               stack.set(srcValue, objValue);
22841               baseMerge2(objValue, srcValue, undefined2, customDefaultsMerge, stack);
22842               stack["delete"](srcValue);
22843             }
22844             return objValue;
22845           }
22846           function customOmitClone(value) {
22847             return isPlainObject2(value) ? undefined2 : value;
22848           }
22849           function equalArrays2(array2, other2, bitmask, customizer, equalFunc, stack) {
22850             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other2.length;
22851             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
22852               return false;
22853             }
22854             var arrStacked = stack.get(array2);
22855             var othStacked = stack.get(other2);
22856             if (arrStacked && othStacked) {
22857               return arrStacked == other2 && othStacked == array2;
22858             }
22859             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
22860             stack.set(array2, other2);
22861             stack.set(other2, array2);
22862             while (++index < arrLength) {
22863               var arrValue = array2[index], othValue = other2[index];
22864               if (customizer) {
22865                 var compared = isPartial ? customizer(othValue, arrValue, index, other2, array2, stack) : customizer(arrValue, othValue, index, array2, other2, stack);
22866               }
22867               if (compared !== undefined2) {
22868                 if (compared) {
22869                   continue;
22870                 }
22871                 result2 = false;
22872                 break;
22873               }
22874               if (seen) {
22875                 if (!arraySome2(other2, function(othValue2, othIndex) {
22876                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
22877                     return seen.push(othIndex);
22878                   }
22879                 })) {
22880                   result2 = false;
22881                   break;
22882                 }
22883               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
22884                 result2 = false;
22885                 break;
22886               }
22887             }
22888             stack["delete"](array2);
22889             stack["delete"](other2);
22890             return result2;
22891           }
22892           function equalByTag2(object, other2, tag2, bitmask, customizer, equalFunc, stack) {
22893             switch (tag2) {
22894               case dataViewTag4:
22895                 if (object.byteLength != other2.byteLength || object.byteOffset != other2.byteOffset) {
22896                   return false;
22897                 }
22898                 object = object.buffer;
22899                 other2 = other2.buffer;
22900               case arrayBufferTag3:
22901                 if (object.byteLength != other2.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other2))) {
22902                   return false;
22903                 }
22904                 return true;
22905               case boolTag3:
22906               case dateTag3:
22907               case numberTag4:
22908                 return eq2(+object, +other2);
22909               case errorTag3:
22910                 return object.name == other2.name && object.message == other2.message;
22911               case regexpTag3:
22912               case stringTag3:
22913                 return object == other2 + "";
22914               case mapTag4:
22915                 var convert = mapToArray2;
22916               case setTag4:
22917                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
22918                 convert || (convert = setToArray2);
22919                 if (object.size != other2.size && !isPartial) {
22920                   return false;
22921                 }
22922                 var stacked = stack.get(object);
22923                 if (stacked) {
22924                   return stacked == other2;
22925                 }
22926                 bitmask |= COMPARE_UNORDERED_FLAG3;
22927                 stack.set(object, other2);
22928                 var result2 = equalArrays2(convert(object), convert(other2), bitmask, customizer, equalFunc, stack);
22929                 stack["delete"](object);
22930                 return result2;
22931               case symbolTag3:
22932                 if (symbolValueOf2) {
22933                   return symbolValueOf2.call(object) == symbolValueOf2.call(other2);
22934                 }
22935             }
22936             return false;
22937           }
22938           function equalObjects2(object, other2, bitmask, customizer, equalFunc, stack) {
22939             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other2), othLength = othProps.length;
22940             if (objLength != othLength && !isPartial) {
22941               return false;
22942             }
22943             var index = objLength;
22944             while (index--) {
22945               var key = objProps[index];
22946               if (!(isPartial ? key in other2 : hasOwnProperty13.call(other2, key))) {
22947                 return false;
22948               }
22949             }
22950             var objStacked = stack.get(object);
22951             var othStacked = stack.get(other2);
22952             if (objStacked && othStacked) {
22953               return objStacked == other2 && othStacked == object;
22954             }
22955             var result2 = true;
22956             stack.set(object, other2);
22957             stack.set(other2, object);
22958             var skipCtor = isPartial;
22959             while (++index < objLength) {
22960               key = objProps[index];
22961               var objValue = object[key], othValue = other2[key];
22962               if (customizer) {
22963                 var compared = isPartial ? customizer(othValue, objValue, key, other2, object, stack) : customizer(objValue, othValue, key, object, other2, stack);
22964               }
22965               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
22966                 result2 = false;
22967                 break;
22968               }
22969               skipCtor || (skipCtor = key == "constructor");
22970             }
22971             if (result2 && !skipCtor) {
22972               var objCtor = object.constructor, othCtor = other2.constructor;
22973               if (objCtor != othCtor && ("constructor" in object && "constructor" in other2) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
22974                 result2 = false;
22975               }
22976             }
22977             stack["delete"](object);
22978             stack["delete"](other2);
22979             return result2;
22980           }
22981           function flatRest(func) {
22982             return setToString2(overRest2(func, undefined2, flatten2), func + "");
22983           }
22984           function getAllKeys2(object) {
22985             return baseGetAllKeys2(object, keys2, getSymbols2);
22986           }
22987           function getAllKeysIn(object) {
22988             return baseGetAllKeys2(object, keysIn2, getSymbolsIn);
22989           }
22990           var getData = !metaMap ? noop3 : function(func) {
22991             return metaMap.get(func);
22992           };
22993           function getFuncName(func) {
22994             var result2 = func.name + "", array2 = realNames[result2], length2 = hasOwnProperty13.call(realNames, result2) ? array2.length : 0;
22995             while (length2--) {
22996               var data = array2[length2], otherFunc = data.func;
22997               if (otherFunc == null || otherFunc == func) {
22998                 return data.name;
22999               }
23000             }
23001             return result2;
23002           }
23003           function getHolder(func) {
23004             var object = hasOwnProperty13.call(lodash, "placeholder") ? lodash : func;
23005             return object.placeholder;
23006           }
23007           function getIteratee() {
23008             var result2 = lodash.iteratee || iteratee;
23009             result2 = result2 === iteratee ? baseIteratee : result2;
23010             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
23011           }
23012           function getMapData2(map3, key) {
23013             var data = map3.__data__;
23014             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
23015           }
23016           function getMatchData(object) {
23017             var result2 = keys2(object), length2 = result2.length;
23018             while (length2--) {
23019               var key = result2[length2], value = object[key];
23020               result2[length2] = [key, value, isStrictComparable(value)];
23021             }
23022             return result2;
23023           }
23024           function getNative2(object, key) {
23025             var value = getValue2(object, key);
23026             return baseIsNative2(value) ? value : undefined2;
23027           }
23028           function getRawTag2(value) {
23029             var isOwn = hasOwnProperty13.call(value, symToStringTag3), tag2 = value[symToStringTag3];
23030             try {
23031               value[symToStringTag3] = undefined2;
23032               var unmasked = true;
23033             } catch (e3) {
23034             }
23035             var result2 = nativeObjectToString3.call(value);
23036             if (unmasked) {
23037               if (isOwn) {
23038                 value[symToStringTag3] = tag2;
23039               } else {
23040                 delete value[symToStringTag3];
23041               }
23042             }
23043             return result2;
23044           }
23045           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
23046             if (object == null) {
23047               return [];
23048             }
23049             object = Object2(object);
23050             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
23051               return propertyIsEnumerable3.call(object, symbol);
23052             });
23053           };
23054           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
23055             var result2 = [];
23056             while (object) {
23057               arrayPush2(result2, getSymbols2(object));
23058               object = getPrototype2(object);
23059             }
23060             return result2;
23061           };
23062           var getTag2 = baseGetTag2;
23063           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) {
23064             getTag2 = function(value) {
23065               var result2 = baseGetTag2(value), Ctor = result2 == objectTag5 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
23066               if (ctorString) {
23067                 switch (ctorString) {
23068                   case dataViewCtorString2:
23069                     return dataViewTag4;
23070                   case mapCtorString2:
23071                     return mapTag4;
23072                   case promiseCtorString2:
23073                     return promiseTag2;
23074                   case setCtorString2:
23075                     return setTag4;
23076                   case weakMapCtorString2:
23077                     return weakMapTag3;
23078                 }
23079               }
23080               return result2;
23081             };
23082           }
23083           function getView(start2, end, transforms) {
23084             var index = -1, length2 = transforms.length;
23085             while (++index < length2) {
23086               var data = transforms[index], size2 = data.size;
23087               switch (data.type) {
23088                 case "drop":
23089                   start2 += size2;
23090                   break;
23091                 case "dropRight":
23092                   end -= size2;
23093                   break;
23094                 case "take":
23095                   end = nativeMin2(end, start2 + size2);
23096                   break;
23097                 case "takeRight":
23098                   start2 = nativeMax3(start2, end - size2);
23099                   break;
23100               }
23101             }
23102             return { "start": start2, "end": end };
23103           }
23104           function getWrapDetails(source) {
23105             var match = source.match(reWrapDetails);
23106             return match ? match[1].split(reSplitDetails) : [];
23107           }
23108           function hasPath(object, path, hasFunc) {
23109             path = castPath(path, object);
23110             var index = -1, length2 = path.length, result2 = false;
23111             while (++index < length2) {
23112               var key = toKey(path[index]);
23113               if (!(result2 = object != null && hasFunc(object, key))) {
23114                 break;
23115               }
23116               object = object[key];
23117             }
23118             if (result2 || ++index != length2) {
23119               return result2;
23120             }
23121             length2 = object == null ? 0 : object.length;
23122             return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray2(object) || isArguments2(object));
23123           }
23124           function initCloneArray(array2) {
23125             var length2 = array2.length, result2 = new array2.constructor(length2);
23126             if (length2 && typeof array2[0] == "string" && hasOwnProperty13.call(array2, "index")) {
23127               result2.index = array2.index;
23128               result2.input = array2.input;
23129             }
23130             return result2;
23131           }
23132           function initCloneObject2(object) {
23133             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate2(getPrototype2(object)) : {};
23134           }
23135           function initCloneByTag(object, tag2, isDeep) {
23136             var Ctor = object.constructor;
23137             switch (tag2) {
23138               case arrayBufferTag3:
23139                 return cloneArrayBuffer2(object);
23140               case boolTag3:
23141               case dateTag3:
23142                 return new Ctor(+object);
23143               case dataViewTag4:
23144                 return cloneDataView(object, isDeep);
23145               case float32Tag2:
23146               case float64Tag2:
23147               case int8Tag2:
23148               case int16Tag2:
23149               case int32Tag2:
23150               case uint8Tag2:
23151               case uint8ClampedTag2:
23152               case uint16Tag2:
23153               case uint32Tag2:
23154                 return cloneTypedArray2(object, isDeep);
23155               case mapTag4:
23156                 return new Ctor();
23157               case numberTag4:
23158               case stringTag3:
23159                 return new Ctor(object);
23160               case regexpTag3:
23161                 return cloneRegExp(object);
23162               case setTag4:
23163                 return new Ctor();
23164               case symbolTag3:
23165                 return cloneSymbol(object);
23166             }
23167           }
23168           function insertWrapDetails(source, details) {
23169             var length2 = details.length;
23170             if (!length2) {
23171               return source;
23172             }
23173             var lastIndex = length2 - 1;
23174             details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
23175             details = details.join(length2 > 2 ? ", " : " ");
23176             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
23177           }
23178           function isFlattenable(value) {
23179             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
23180           }
23181           function isIndex2(value, length2) {
23182             var type2 = typeof value;
23183             length2 = length2 == null ? MAX_SAFE_INTEGER4 : length2;
23184             return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
23185           }
23186           function isIterateeCall2(value, index, object) {
23187             if (!isObject2(object)) {
23188               return false;
23189             }
23190             var type2 = typeof index;
23191             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
23192               return eq2(object[index], value);
23193             }
23194             return false;
23195           }
23196           function isKey(value, object) {
23197             if (isArray2(value)) {
23198               return false;
23199             }
23200             var type2 = typeof value;
23201             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
23202               return true;
23203             }
23204             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
23205           }
23206           function isKeyable2(value) {
23207             var type2 = typeof value;
23208             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
23209           }
23210           function isLaziable(func) {
23211             var funcName = getFuncName(func), other2 = lodash[funcName];
23212             if (typeof other2 != "function" || !(funcName in LazyWrapper.prototype)) {
23213               return false;
23214             }
23215             if (func === other2) {
23216               return true;
23217             }
23218             var data = getData(other2);
23219             return !!data && func === data[0];
23220           }
23221           function isMasked2(func) {
23222             return !!maskSrcKey2 && maskSrcKey2 in func;
23223           }
23224           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
23225           function isPrototype2(value) {
23226             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto16;
23227             return value === proto;
23228           }
23229           function isStrictComparable(value) {
23230             return value === value && !isObject2(value);
23231           }
23232           function matchesStrictComparable(key, srcValue) {
23233             return function(object) {
23234               if (object == null) {
23235                 return false;
23236               }
23237               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
23238             };
23239           }
23240           function memoizeCapped(func) {
23241             var result2 = memoize(func, function(key) {
23242               if (cache.size === MAX_MEMOIZE_SIZE) {
23243                 cache.clear();
23244               }
23245               return key;
23246             });
23247             var cache = result2.cache;
23248             return result2;
23249           }
23250           function mergeData(data, source) {
23251             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
23252             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;
23253             if (!(isCommon || isCombo)) {
23254               return data;
23255             }
23256             if (srcBitmask & WRAP_BIND_FLAG) {
23257               data[2] = source[2];
23258               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
23259             }
23260             var value = source[3];
23261             if (value) {
23262               var partials = data[3];
23263               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
23264               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
23265             }
23266             value = source[5];
23267             if (value) {
23268               partials = data[5];
23269               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
23270               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
23271             }
23272             value = source[7];
23273             if (value) {
23274               data[7] = value;
23275             }
23276             if (srcBitmask & WRAP_ARY_FLAG) {
23277               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
23278             }
23279             if (data[9] == null) {
23280               data[9] = source[9];
23281             }
23282             data[0] = source[0];
23283             data[1] = newBitmask;
23284             return data;
23285           }
23286           function nativeKeysIn2(object) {
23287             var result2 = [];
23288             if (object != null) {
23289               for (var key in Object2(object)) {
23290                 result2.push(key);
23291               }
23292             }
23293             return result2;
23294           }
23295           function objectToString2(value) {
23296             return nativeObjectToString3.call(value);
23297           }
23298           function overRest2(func, start2, transform3) {
23299             start2 = nativeMax3(start2 === undefined2 ? func.length - 1 : start2, 0);
23300             return function() {
23301               var args = arguments, index = -1, length2 = nativeMax3(args.length - start2, 0), array2 = Array2(length2);
23302               while (++index < length2) {
23303                 array2[index] = args[start2 + index];
23304               }
23305               index = -1;
23306               var otherArgs = Array2(start2 + 1);
23307               while (++index < start2) {
23308                 otherArgs[index] = args[index];
23309               }
23310               otherArgs[start2] = transform3(array2);
23311               return apply2(func, this, otherArgs);
23312             };
23313           }
23314           function parent(object, path) {
23315             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
23316           }
23317           function reorder(array2, indexes) {
23318             var arrLength = array2.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray2(array2);
23319             while (length2--) {
23320               var index = indexes[length2];
23321               array2[length2] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
23322             }
23323             return array2;
23324           }
23325           function safeGet2(object, key) {
23326             if (key === "constructor" && typeof object[key] === "function") {
23327               return;
23328             }
23329             if (key == "__proto__") {
23330               return;
23331             }
23332             return object[key];
23333           }
23334           var setData = shortOut2(baseSetData);
23335           var setTimeout2 = ctxSetTimeout || function(func, wait) {
23336             return root3.setTimeout(func, wait);
23337           };
23338           var setToString2 = shortOut2(baseSetToString2);
23339           function setWrapToString(wrapper, reference, bitmask) {
23340             var source = reference + "";
23341             return setToString2(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
23342           }
23343           function shortOut2(func) {
23344             var count = 0, lastCalled = 0;
23345             return function() {
23346               var stamp = nativeNow2(), remaining = HOT_SPAN2 - (stamp - lastCalled);
23347               lastCalled = stamp;
23348               if (remaining > 0) {
23349                 if (++count >= HOT_COUNT2) {
23350                   return arguments[0];
23351                 }
23352               } else {
23353                 count = 0;
23354               }
23355               return func.apply(undefined2, arguments);
23356             };
23357           }
23358           function shuffleSelf(array2, size2) {
23359             var index = -1, length2 = array2.length, lastIndex = length2 - 1;
23360             size2 = size2 === undefined2 ? length2 : size2;
23361             while (++index < size2) {
23362               var rand = baseRandom(index, lastIndex), value = array2[rand];
23363               array2[rand] = array2[index];
23364               array2[index] = value;
23365             }
23366             array2.length = size2;
23367             return array2;
23368           }
23369           var stringToPath = memoizeCapped(function(string) {
23370             var result2 = [];
23371             if (string.charCodeAt(0) === 46) {
23372               result2.push("");
23373             }
23374             string.replace(rePropName, function(match, number3, quote, subString) {
23375               result2.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
23376             });
23377             return result2;
23378           });
23379           function toKey(value) {
23380             if (typeof value == "string" || isSymbol2(value)) {
23381               return value;
23382             }
23383             var result2 = value + "";
23384             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
23385           }
23386           function toSource2(func) {
23387             if (func != null) {
23388               try {
23389                 return funcToString4.call(func);
23390               } catch (e3) {
23391               }
23392               try {
23393                 return func + "";
23394               } catch (e3) {
23395               }
23396             }
23397             return "";
23398           }
23399           function updateWrapDetails(details, bitmask) {
23400             arrayEach(wrapFlags, function(pair3) {
23401               var value = "_." + pair3[0];
23402               if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
23403                 details.push(value);
23404               }
23405             });
23406             return details.sort();
23407           }
23408           function wrapperClone(wrapper) {
23409             if (wrapper instanceof LazyWrapper) {
23410               return wrapper.clone();
23411             }
23412             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
23413             result2.__actions__ = copyArray2(wrapper.__actions__);
23414             result2.__index__ = wrapper.__index__;
23415             result2.__values__ = wrapper.__values__;
23416             return result2;
23417           }
23418           function chunk(array2, size2, guard) {
23419             if (guard ? isIterateeCall2(array2, size2, guard) : size2 === undefined2) {
23420               size2 = 1;
23421             } else {
23422               size2 = nativeMax3(toInteger(size2), 0);
23423             }
23424             var length2 = array2 == null ? 0 : array2.length;
23425             if (!length2 || size2 < 1) {
23426               return [];
23427             }
23428             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size2));
23429             while (index < length2) {
23430               result2[resIndex++] = baseSlice(array2, index, index += size2);
23431             }
23432             return result2;
23433           }
23434           function compact(array2) {
23435             var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
23436             while (++index < length2) {
23437               var value = array2[index];
23438               if (value) {
23439                 result2[resIndex++] = value;
23440               }
23441             }
23442             return result2;
23443           }
23444           function concat() {
23445             var length2 = arguments.length;
23446             if (!length2) {
23447               return [];
23448             }
23449             var args = Array2(length2 - 1), array2 = arguments[0], index = length2;
23450             while (index--) {
23451               args[index - 1] = arguments[index];
23452             }
23453             return arrayPush2(isArray2(array2) ? copyArray2(array2) : [array2], baseFlatten(args, 1));
23454           }
23455           var difference2 = baseRest2(function(array2, values2) {
23456             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true)) : [];
23457           });
23458           var differenceBy = baseRest2(function(array2, values2) {
23459             var iteratee2 = last(values2);
23460             if (isArrayLikeObject2(iteratee2)) {
23461               iteratee2 = undefined2;
23462             }
23463             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2)) : [];
23464           });
23465           var differenceWith = baseRest2(function(array2, values2) {
23466             var comparator = last(values2);
23467             if (isArrayLikeObject2(comparator)) {
23468               comparator = undefined2;
23469             }
23470             return isArrayLikeObject2(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject2, true), undefined2, comparator) : [];
23471           });
23472           function drop(array2, n3, guard) {
23473             var length2 = array2 == null ? 0 : array2.length;
23474             if (!length2) {
23475               return [];
23476             }
23477             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23478             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
23479           }
23480           function dropRight(array2, n3, guard) {
23481             var length2 = array2 == null ? 0 : array2.length;
23482             if (!length2) {
23483               return [];
23484             }
23485             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23486             n3 = length2 - n3;
23487             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
23488           }
23489           function dropRightWhile(array2, predicate) {
23490             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
23491           }
23492           function dropWhile(array2, predicate) {
23493             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
23494           }
23495           function fill(array2, value, start2, end) {
23496             var length2 = array2 == null ? 0 : array2.length;
23497             if (!length2) {
23498               return [];
23499             }
23500             if (start2 && typeof start2 != "number" && isIterateeCall2(array2, value, start2)) {
23501               start2 = 0;
23502               end = length2;
23503             }
23504             return baseFill(array2, value, start2, end);
23505           }
23506           function findIndex(array2, predicate, fromIndex) {
23507             var length2 = array2 == null ? 0 : array2.length;
23508             if (!length2) {
23509               return -1;
23510             }
23511             var index = fromIndex == null ? 0 : toInteger(fromIndex);
23512             if (index < 0) {
23513               index = nativeMax3(length2 + index, 0);
23514             }
23515             return baseFindIndex(array2, getIteratee(predicate, 3), index);
23516           }
23517           function findLastIndex(array2, predicate, fromIndex) {
23518             var length2 = array2 == null ? 0 : array2.length;
23519             if (!length2) {
23520               return -1;
23521             }
23522             var index = length2 - 1;
23523             if (fromIndex !== undefined2) {
23524               index = toInteger(fromIndex);
23525               index = fromIndex < 0 ? nativeMax3(length2 + index, 0) : nativeMin2(index, length2 - 1);
23526             }
23527             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
23528           }
23529           function flatten2(array2) {
23530             var length2 = array2 == null ? 0 : array2.length;
23531             return length2 ? baseFlatten(array2, 1) : [];
23532           }
23533           function flattenDeep(array2) {
23534             var length2 = array2 == null ? 0 : array2.length;
23535             return length2 ? baseFlatten(array2, INFINITY2) : [];
23536           }
23537           function flattenDepth(array2, depth) {
23538             var length2 = array2 == null ? 0 : array2.length;
23539             if (!length2) {
23540               return [];
23541             }
23542             depth = depth === undefined2 ? 1 : toInteger(depth);
23543             return baseFlatten(array2, depth);
23544           }
23545           function fromPairs(pairs2) {
23546             var index = -1, length2 = pairs2 == null ? 0 : pairs2.length, result2 = {};
23547             while (++index < length2) {
23548               var pair3 = pairs2[index];
23549               result2[pair3[0]] = pair3[1];
23550             }
23551             return result2;
23552           }
23553           function head(array2) {
23554             return array2 && array2.length ? array2[0] : undefined2;
23555           }
23556           function indexOf(array2, value, fromIndex) {
23557             var length2 = array2 == null ? 0 : array2.length;
23558             if (!length2) {
23559               return -1;
23560             }
23561             var index = fromIndex == null ? 0 : toInteger(fromIndex);
23562             if (index < 0) {
23563               index = nativeMax3(length2 + index, 0);
23564             }
23565             return baseIndexOf(array2, value, index);
23566           }
23567           function initial(array2) {
23568             var length2 = array2 == null ? 0 : array2.length;
23569             return length2 ? baseSlice(array2, 0, -1) : [];
23570           }
23571           var intersection2 = baseRest2(function(arrays) {
23572             var mapped = arrayMap2(arrays, castArrayLikeObject);
23573             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
23574           });
23575           var intersectionBy = baseRest2(function(arrays) {
23576             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
23577             if (iteratee2 === last(mapped)) {
23578               iteratee2 = undefined2;
23579             } else {
23580               mapped.pop();
23581             }
23582             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
23583           });
23584           var intersectionWith = baseRest2(function(arrays) {
23585             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
23586             comparator = typeof comparator == "function" ? comparator : undefined2;
23587             if (comparator) {
23588               mapped.pop();
23589             }
23590             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
23591           });
23592           function join(array2, separator) {
23593             return array2 == null ? "" : nativeJoin.call(array2, separator);
23594           }
23595           function last(array2) {
23596             var length2 = array2 == null ? 0 : array2.length;
23597             return length2 ? array2[length2 - 1] : undefined2;
23598           }
23599           function lastIndexOf(array2, value, fromIndex) {
23600             var length2 = array2 == null ? 0 : array2.length;
23601             if (!length2) {
23602               return -1;
23603             }
23604             var index = length2;
23605             if (fromIndex !== undefined2) {
23606               index = toInteger(fromIndex);
23607               index = index < 0 ? nativeMax3(length2 + index, 0) : nativeMin2(index, length2 - 1);
23608             }
23609             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
23610           }
23611           function nth(array2, n3) {
23612             return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
23613           }
23614           var pull = baseRest2(pullAll);
23615           function pullAll(array2, values2) {
23616             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
23617           }
23618           function pullAllBy(array2, values2, iteratee2) {
23619             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
23620           }
23621           function pullAllWith(array2, values2, comparator) {
23622             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
23623           }
23624           var pullAt = flatRest(function(array2, indexes) {
23625             var length2 = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
23626             basePullAt(array2, arrayMap2(indexes, function(index) {
23627               return isIndex2(index, length2) ? +index : index;
23628             }).sort(compareAscending));
23629             return result2;
23630           });
23631           function remove2(array2, predicate) {
23632             var result2 = [];
23633             if (!(array2 && array2.length)) {
23634               return result2;
23635             }
23636             var index = -1, indexes = [], length2 = array2.length;
23637             predicate = getIteratee(predicate, 3);
23638             while (++index < length2) {
23639               var value = array2[index];
23640               if (predicate(value, index, array2)) {
23641                 result2.push(value);
23642                 indexes.push(index);
23643               }
23644             }
23645             basePullAt(array2, indexes);
23646             return result2;
23647           }
23648           function reverse(array2) {
23649             return array2 == null ? array2 : nativeReverse.call(array2);
23650           }
23651           function slice(array2, start2, end) {
23652             var length2 = array2 == null ? 0 : array2.length;
23653             if (!length2) {
23654               return [];
23655             }
23656             if (end && typeof end != "number" && isIterateeCall2(array2, start2, end)) {
23657               start2 = 0;
23658               end = length2;
23659             } else {
23660               start2 = start2 == null ? 0 : toInteger(start2);
23661               end = end === undefined2 ? length2 : toInteger(end);
23662             }
23663             return baseSlice(array2, start2, end);
23664           }
23665           function sortedIndex(array2, value) {
23666             return baseSortedIndex(array2, value);
23667           }
23668           function sortedIndexBy(array2, value, iteratee2) {
23669             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
23670           }
23671           function sortedIndexOf(array2, value) {
23672             var length2 = array2 == null ? 0 : array2.length;
23673             if (length2) {
23674               var index = baseSortedIndex(array2, value);
23675               if (index < length2 && eq2(array2[index], value)) {
23676                 return index;
23677               }
23678             }
23679             return -1;
23680           }
23681           function sortedLastIndex(array2, value) {
23682             return baseSortedIndex(array2, value, true);
23683           }
23684           function sortedLastIndexBy(array2, value, iteratee2) {
23685             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
23686           }
23687           function sortedLastIndexOf(array2, value) {
23688             var length2 = array2 == null ? 0 : array2.length;
23689             if (length2) {
23690               var index = baseSortedIndex(array2, value, true) - 1;
23691               if (eq2(array2[index], value)) {
23692                 return index;
23693               }
23694             }
23695             return -1;
23696           }
23697           function sortedUniq(array2) {
23698             return array2 && array2.length ? baseSortedUniq(array2) : [];
23699           }
23700           function sortedUniqBy(array2, iteratee2) {
23701             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
23702           }
23703           function tail(array2) {
23704             var length2 = array2 == null ? 0 : array2.length;
23705             return length2 ? baseSlice(array2, 1, length2) : [];
23706           }
23707           function take(array2, n3, guard) {
23708             if (!(array2 && array2.length)) {
23709               return [];
23710             }
23711             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23712             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
23713           }
23714           function takeRight(array2, n3, guard) {
23715             var length2 = array2 == null ? 0 : array2.length;
23716             if (!length2) {
23717               return [];
23718             }
23719             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
23720             n3 = length2 - n3;
23721             return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
23722           }
23723           function takeRightWhile(array2, predicate) {
23724             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
23725           }
23726           function takeWhile(array2, predicate) {
23727             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
23728           }
23729           var union2 = baseRest2(function(arrays) {
23730             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true));
23731           });
23732           var unionBy = baseRest2(function(arrays) {
23733             var iteratee2 = last(arrays);
23734             if (isArrayLikeObject2(iteratee2)) {
23735               iteratee2 = undefined2;
23736             }
23737             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2));
23738           });
23739           var unionWith = baseRest2(function(arrays) {
23740             var comparator = last(arrays);
23741             comparator = typeof comparator == "function" ? comparator : undefined2;
23742             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), undefined2, comparator);
23743           });
23744           function uniq(array2) {
23745             return array2 && array2.length ? baseUniq(array2) : [];
23746           }
23747           function uniqBy(array2, iteratee2) {
23748             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
23749           }
23750           function uniqWith(array2, comparator) {
23751             comparator = typeof comparator == "function" ? comparator : undefined2;
23752             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
23753           }
23754           function unzip(array2) {
23755             if (!(array2 && array2.length)) {
23756               return [];
23757             }
23758             var length2 = 0;
23759             array2 = arrayFilter2(array2, function(group) {
23760               if (isArrayLikeObject2(group)) {
23761                 length2 = nativeMax3(group.length, length2);
23762                 return true;
23763               }
23764             });
23765             return baseTimes2(length2, function(index) {
23766               return arrayMap2(array2, baseProperty(index));
23767             });
23768           }
23769           function unzipWith(array2, iteratee2) {
23770             if (!(array2 && array2.length)) {
23771               return [];
23772             }
23773             var result2 = unzip(array2);
23774             if (iteratee2 == null) {
23775               return result2;
23776             }
23777             return arrayMap2(result2, function(group) {
23778               return apply2(iteratee2, undefined2, group);
23779             });
23780           }
23781           var without = baseRest2(function(array2, values2) {
23782             return isArrayLikeObject2(array2) ? baseDifference(array2, values2) : [];
23783           });
23784           var xor = baseRest2(function(arrays) {
23785             return baseXor(arrayFilter2(arrays, isArrayLikeObject2));
23786           });
23787           var xorBy = baseRest2(function(arrays) {
23788             var iteratee2 = last(arrays);
23789             if (isArrayLikeObject2(iteratee2)) {
23790               iteratee2 = undefined2;
23791             }
23792             return baseXor(arrayFilter2(arrays, isArrayLikeObject2), getIteratee(iteratee2, 2));
23793           });
23794           var xorWith = baseRest2(function(arrays) {
23795             var comparator = last(arrays);
23796             comparator = typeof comparator == "function" ? comparator : undefined2;
23797             return baseXor(arrayFilter2(arrays, isArrayLikeObject2), undefined2, comparator);
23798           });
23799           var zip = baseRest2(unzip);
23800           function zipObject(props, values2) {
23801             return baseZipObject(props || [], values2 || [], assignValue2);
23802           }
23803           function zipObjectDeep(props, values2) {
23804             return baseZipObject(props || [], values2 || [], baseSet);
23805           }
23806           var zipWith = baseRest2(function(arrays) {
23807             var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined2;
23808             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
23809             return unzipWith(arrays, iteratee2);
23810           });
23811           function chain(value) {
23812             var result2 = lodash(value);
23813             result2.__chain__ = true;
23814             return result2;
23815           }
23816           function tap(value, interceptor) {
23817             interceptor(value);
23818             return value;
23819           }
23820           function thru(value, interceptor) {
23821             return interceptor(value);
23822           }
23823           var wrapperAt = flatRest(function(paths) {
23824             var length2 = paths.length, start2 = length2 ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
23825               return baseAt(object, paths);
23826             };
23827             if (length2 > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
23828               return this.thru(interceptor);
23829             }
23830             value = value.slice(start2, +start2 + (length2 ? 1 : 0));
23831             value.__actions__.push({
23832               "func": thru,
23833               "args": [interceptor],
23834               "thisArg": undefined2
23835             });
23836             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
23837               if (length2 && !array2.length) {
23838                 array2.push(undefined2);
23839               }
23840               return array2;
23841             });
23842           });
23843           function wrapperChain() {
23844             return chain(this);
23845           }
23846           function wrapperCommit() {
23847             return new LodashWrapper(this.value(), this.__chain__);
23848           }
23849           function wrapperNext() {
23850             if (this.__values__ === undefined2) {
23851               this.__values__ = toArray(this.value());
23852             }
23853             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
23854             return { "done": done, "value": value };
23855           }
23856           function wrapperToIterator() {
23857             return this;
23858           }
23859           function wrapperPlant(value) {
23860             var result2, parent2 = this;
23861             while (parent2 instanceof baseLodash) {
23862               var clone3 = wrapperClone(parent2);
23863               clone3.__index__ = 0;
23864               clone3.__values__ = undefined2;
23865               if (result2) {
23866                 previous.__wrapped__ = clone3;
23867               } else {
23868                 result2 = clone3;
23869               }
23870               var previous = clone3;
23871               parent2 = parent2.__wrapped__;
23872             }
23873             previous.__wrapped__ = value;
23874             return result2;
23875           }
23876           function wrapperReverse() {
23877             var value = this.__wrapped__;
23878             if (value instanceof LazyWrapper) {
23879               var wrapped = value;
23880               if (this.__actions__.length) {
23881                 wrapped = new LazyWrapper(this);
23882               }
23883               wrapped = wrapped.reverse();
23884               wrapped.__actions__.push({
23885                 "func": thru,
23886                 "args": [reverse],
23887                 "thisArg": undefined2
23888               });
23889               return new LodashWrapper(wrapped, this.__chain__);
23890             }
23891             return this.thru(reverse);
23892           }
23893           function wrapperValue() {
23894             return baseWrapperValue(this.__wrapped__, this.__actions__);
23895           }
23896           var countBy = createAggregator(function(result2, value, key) {
23897             if (hasOwnProperty13.call(result2, key)) {
23898               ++result2[key];
23899             } else {
23900               baseAssignValue2(result2, key, 1);
23901             }
23902           });
23903           function every(collection, predicate, guard) {
23904             var func = isArray2(collection) ? arrayEvery : baseEvery;
23905             if (guard && isIterateeCall2(collection, predicate, guard)) {
23906               predicate = undefined2;
23907             }
23908             return func(collection, getIteratee(predicate, 3));
23909           }
23910           function filter2(collection, predicate) {
23911             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
23912             return func(collection, getIteratee(predicate, 3));
23913           }
23914           var find2 = createFind(findIndex);
23915           var findLast = createFind(findLastIndex);
23916           function flatMap(collection, iteratee2) {
23917             return baseFlatten(map2(collection, iteratee2), 1);
23918           }
23919           function flatMapDeep(collection, iteratee2) {
23920             return baseFlatten(map2(collection, iteratee2), INFINITY2);
23921           }
23922           function flatMapDepth(collection, iteratee2, depth) {
23923             depth = depth === undefined2 ? 1 : toInteger(depth);
23924             return baseFlatten(map2(collection, iteratee2), depth);
23925           }
23926           function forEach(collection, iteratee2) {
23927             var func = isArray2(collection) ? arrayEach : baseEach;
23928             return func(collection, getIteratee(iteratee2, 3));
23929           }
23930           function forEachRight(collection, iteratee2) {
23931             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
23932             return func(collection, getIteratee(iteratee2, 3));
23933           }
23934           var groupBy = createAggregator(function(result2, value, key) {
23935             if (hasOwnProperty13.call(result2, key)) {
23936               result2[key].push(value);
23937             } else {
23938               baseAssignValue2(result2, key, [value]);
23939             }
23940           });
23941           function includes(collection, value, fromIndex, guard) {
23942             collection = isArrayLike2(collection) ? collection : values(collection);
23943             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
23944             var length2 = collection.length;
23945             if (fromIndex < 0) {
23946               fromIndex = nativeMax3(length2 + fromIndex, 0);
23947             }
23948             return isString(collection) ? fromIndex <= length2 && collection.indexOf(value, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value, fromIndex) > -1;
23949           }
23950           var invokeMap = baseRest2(function(collection, path, args) {
23951             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
23952             baseEach(collection, function(value) {
23953               result2[++index] = isFunc ? apply2(path, value, args) : baseInvoke(value, path, args);
23954             });
23955             return result2;
23956           });
23957           var keyBy = createAggregator(function(result2, value, key) {
23958             baseAssignValue2(result2, key, value);
23959           });
23960           function map2(collection, iteratee2) {
23961             var func = isArray2(collection) ? arrayMap2 : baseMap;
23962             return func(collection, getIteratee(iteratee2, 3));
23963           }
23964           function orderBy(collection, iteratees, orders, guard) {
23965             if (collection == null) {
23966               return [];
23967             }
23968             if (!isArray2(iteratees)) {
23969               iteratees = iteratees == null ? [] : [iteratees];
23970             }
23971             orders = guard ? undefined2 : orders;
23972             if (!isArray2(orders)) {
23973               orders = orders == null ? [] : [orders];
23974             }
23975             return baseOrderBy(collection, iteratees, orders);
23976           }
23977           var partition = createAggregator(function(result2, value, key) {
23978             result2[key ? 0 : 1].push(value);
23979           }, function() {
23980             return [[], []];
23981           });
23982           function reduce(collection, iteratee2, accumulator) {
23983             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
23984             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
23985           }
23986           function reduceRight(collection, iteratee2, accumulator) {
23987             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
23988             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
23989           }
23990           function reject(collection, predicate) {
23991             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
23992             return func(collection, negate(getIteratee(predicate, 3)));
23993           }
23994           function sample(collection) {
23995             var func = isArray2(collection) ? arraySample : baseSample;
23996             return func(collection);
23997           }
23998           function sampleSize(collection, n3, guard) {
23999             if (guard ? isIterateeCall2(collection, n3, guard) : n3 === undefined2) {
24000               n3 = 1;
24001             } else {
24002               n3 = toInteger(n3);
24003             }
24004             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
24005             return func(collection, n3);
24006           }
24007           function shuffle(collection) {
24008             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
24009             return func(collection);
24010           }
24011           function size(collection) {
24012             if (collection == null) {
24013               return 0;
24014             }
24015             if (isArrayLike2(collection)) {
24016               return isString(collection) ? stringSize(collection) : collection.length;
24017             }
24018             var tag2 = getTag2(collection);
24019             if (tag2 == mapTag4 || tag2 == setTag4) {
24020               return collection.size;
24021             }
24022             return baseKeys2(collection).length;
24023           }
24024           function some(collection, predicate, guard) {
24025             var func = isArray2(collection) ? arraySome2 : baseSome;
24026             if (guard && isIterateeCall2(collection, predicate, guard)) {
24027               predicate = undefined2;
24028             }
24029             return func(collection, getIteratee(predicate, 3));
24030           }
24031           var sortBy = baseRest2(function(collection, iteratees) {
24032             if (collection == null) {
24033               return [];
24034             }
24035             var length2 = iteratees.length;
24036             if (length2 > 1 && isIterateeCall2(collection, iteratees[0], iteratees[1])) {
24037               iteratees = [];
24038             } else if (length2 > 2 && isIterateeCall2(iteratees[0], iteratees[1], iteratees[2])) {
24039               iteratees = [iteratees[0]];
24040             }
24041             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
24042           });
24043           var now3 = ctxNow || function() {
24044             return root3.Date.now();
24045           };
24046           function after(n3, func) {
24047             if (typeof func != "function") {
24048               throw new TypeError2(FUNC_ERROR_TEXT3);
24049             }
24050             n3 = toInteger(n3);
24051             return function() {
24052               if (--n3 < 1) {
24053                 return func.apply(this, arguments);
24054               }
24055             };
24056           }
24057           function ary(func, n3, guard) {
24058             n3 = guard ? undefined2 : n3;
24059             n3 = func && n3 == null ? func.length : n3;
24060             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
24061           }
24062           function before(n3, func) {
24063             var result2;
24064             if (typeof func != "function") {
24065               throw new TypeError2(FUNC_ERROR_TEXT3);
24066             }
24067             n3 = toInteger(n3);
24068             return function() {
24069               if (--n3 > 0) {
24070                 result2 = func.apply(this, arguments);
24071               }
24072               if (n3 <= 1) {
24073                 func = undefined2;
24074               }
24075               return result2;
24076             };
24077           }
24078           var bind = baseRest2(function(func, thisArg, partials) {
24079             var bitmask = WRAP_BIND_FLAG;
24080             if (partials.length) {
24081               var holders = replaceHolders(partials, getHolder(bind));
24082               bitmask |= WRAP_PARTIAL_FLAG;
24083             }
24084             return createWrap(func, bitmask, thisArg, partials, holders);
24085           });
24086           var bindKey2 = baseRest2(function(object, key, partials) {
24087             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
24088             if (partials.length) {
24089               var holders = replaceHolders(partials, getHolder(bindKey2));
24090               bitmask |= WRAP_PARTIAL_FLAG;
24091             }
24092             return createWrap(key, bitmask, object, partials, holders);
24093           });
24094           function curry(func, arity, guard) {
24095             arity = guard ? undefined2 : arity;
24096             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
24097             result2.placeholder = curry.placeholder;
24098             return result2;
24099           }
24100           function curryRight(func, arity, guard) {
24101             arity = guard ? undefined2 : arity;
24102             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
24103             result2.placeholder = curryRight.placeholder;
24104             return result2;
24105           }
24106           function debounce2(func, wait, options2) {
24107             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
24108             if (typeof func != "function") {
24109               throw new TypeError2(FUNC_ERROR_TEXT3);
24110             }
24111             wait = toNumber3(wait) || 0;
24112             if (isObject2(options2)) {
24113               leading = !!options2.leading;
24114               maxing = "maxWait" in options2;
24115               maxWait = maxing ? nativeMax3(toNumber3(options2.maxWait) || 0, wait) : maxWait;
24116               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24117             }
24118             function invokeFunc(time) {
24119               var args = lastArgs, thisArg = lastThis;
24120               lastArgs = lastThis = undefined2;
24121               lastInvokeTime = time;
24122               result2 = func.apply(thisArg, args);
24123               return result2;
24124             }
24125             function leadingEdge(time) {
24126               lastInvokeTime = time;
24127               timerId = setTimeout2(timerExpired, wait);
24128               return leading ? invokeFunc(time) : result2;
24129             }
24130             function remainingWait(time) {
24131               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
24132               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
24133             }
24134             function shouldInvoke(time) {
24135               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
24136               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
24137             }
24138             function timerExpired() {
24139               var time = now3();
24140               if (shouldInvoke(time)) {
24141                 return trailingEdge(time);
24142               }
24143               timerId = setTimeout2(timerExpired, remainingWait(time));
24144             }
24145             function trailingEdge(time) {
24146               timerId = undefined2;
24147               if (trailing && lastArgs) {
24148                 return invokeFunc(time);
24149               }
24150               lastArgs = lastThis = undefined2;
24151               return result2;
24152             }
24153             function cancel() {
24154               if (timerId !== undefined2) {
24155                 clearTimeout2(timerId);
24156               }
24157               lastInvokeTime = 0;
24158               lastArgs = lastCallTime = lastThis = timerId = undefined2;
24159             }
24160             function flush() {
24161               return timerId === undefined2 ? result2 : trailingEdge(now3());
24162             }
24163             function debounced() {
24164               var time = now3(), isInvoking = shouldInvoke(time);
24165               lastArgs = arguments;
24166               lastThis = this;
24167               lastCallTime = time;
24168               if (isInvoking) {
24169                 if (timerId === undefined2) {
24170                   return leadingEdge(lastCallTime);
24171                 }
24172                 if (maxing) {
24173                   clearTimeout2(timerId);
24174                   timerId = setTimeout2(timerExpired, wait);
24175                   return invokeFunc(lastCallTime);
24176                 }
24177               }
24178               if (timerId === undefined2) {
24179                 timerId = setTimeout2(timerExpired, wait);
24180               }
24181               return result2;
24182             }
24183             debounced.cancel = cancel;
24184             debounced.flush = flush;
24185             return debounced;
24186           }
24187           var defer = baseRest2(function(func, args) {
24188             return baseDelay(func, 1, args);
24189           });
24190           var delay = baseRest2(function(func, wait, args) {
24191             return baseDelay(func, toNumber3(wait) || 0, args);
24192           });
24193           function flip(func) {
24194             return createWrap(func, WRAP_FLIP_FLAG);
24195           }
24196           function memoize(func, resolver) {
24197             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
24198               throw new TypeError2(FUNC_ERROR_TEXT3);
24199             }
24200             var memoized = function() {
24201               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
24202               if (cache.has(key)) {
24203                 return cache.get(key);
24204               }
24205               var result2 = func.apply(this, args);
24206               memoized.cache = cache.set(key, result2) || cache;
24207               return result2;
24208             };
24209             memoized.cache = new (memoize.Cache || MapCache2)();
24210             return memoized;
24211           }
24212           memoize.Cache = MapCache2;
24213           function negate(predicate) {
24214             if (typeof predicate != "function") {
24215               throw new TypeError2(FUNC_ERROR_TEXT3);
24216             }
24217             return function() {
24218               var args = arguments;
24219               switch (args.length) {
24220                 case 0:
24221                   return !predicate.call(this);
24222                 case 1:
24223                   return !predicate.call(this, args[0]);
24224                 case 2:
24225                   return !predicate.call(this, args[0], args[1]);
24226                 case 3:
24227                   return !predicate.call(this, args[0], args[1], args[2]);
24228               }
24229               return !predicate.apply(this, args);
24230             };
24231           }
24232           function once(func) {
24233             return before(2, func);
24234           }
24235           var overArgs = castRest(function(func, transforms) {
24236             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
24237             var funcsLength = transforms.length;
24238             return baseRest2(function(args) {
24239               var index = -1, length2 = nativeMin2(args.length, funcsLength);
24240               while (++index < length2) {
24241                 args[index] = transforms[index].call(this, args[index]);
24242               }
24243               return apply2(func, this, args);
24244             });
24245           });
24246           var partial = baseRest2(function(func, partials) {
24247             var holders = replaceHolders(partials, getHolder(partial));
24248             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
24249           });
24250           var partialRight = baseRest2(function(func, partials) {
24251             var holders = replaceHolders(partials, getHolder(partialRight));
24252             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
24253           });
24254           var rearg = flatRest(function(func, indexes) {
24255             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
24256           });
24257           function rest(func, start2) {
24258             if (typeof func != "function") {
24259               throw new TypeError2(FUNC_ERROR_TEXT3);
24260             }
24261             start2 = start2 === undefined2 ? start2 : toInteger(start2);
24262             return baseRest2(func, start2);
24263           }
24264           function spread(func, start2) {
24265             if (typeof func != "function") {
24266               throw new TypeError2(FUNC_ERROR_TEXT3);
24267             }
24268             start2 = start2 == null ? 0 : nativeMax3(toInteger(start2), 0);
24269             return baseRest2(function(args) {
24270               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
24271               if (array2) {
24272                 arrayPush2(otherArgs, array2);
24273               }
24274               return apply2(func, this, otherArgs);
24275             });
24276           }
24277           function throttle2(func, wait, options2) {
24278             var leading = true, trailing = true;
24279             if (typeof func != "function") {
24280               throw new TypeError2(FUNC_ERROR_TEXT3);
24281             }
24282             if (isObject2(options2)) {
24283               leading = "leading" in options2 ? !!options2.leading : leading;
24284               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
24285             }
24286             return debounce2(func, wait, {
24287               "leading": leading,
24288               "maxWait": wait,
24289               "trailing": trailing
24290             });
24291           }
24292           function unary(func) {
24293             return ary(func, 1);
24294           }
24295           function wrap2(value, wrapper) {
24296             return partial(castFunction(wrapper), value);
24297           }
24298           function castArray() {
24299             if (!arguments.length) {
24300               return [];
24301             }
24302             var value = arguments[0];
24303             return isArray2(value) ? value : [value];
24304           }
24305           function clone2(value) {
24306             return baseClone(value, CLONE_SYMBOLS_FLAG);
24307           }
24308           function cloneWith(value, customizer) {
24309             customizer = typeof customizer == "function" ? customizer : undefined2;
24310             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
24311           }
24312           function cloneDeep(value) {
24313             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
24314           }
24315           function cloneDeepWith(value, customizer) {
24316             customizer = typeof customizer == "function" ? customizer : undefined2;
24317             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
24318           }
24319           function conformsTo(object, source) {
24320             return source == null || baseConformsTo(object, source, keys2(source));
24321           }
24322           function eq2(value, other2) {
24323             return value === other2 || value !== value && other2 !== other2;
24324           }
24325           var gt2 = createRelationalOperation(baseGt);
24326           var gte = createRelationalOperation(function(value, other2) {
24327             return value >= other2;
24328           });
24329           var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
24330             return arguments;
24331           }()) ? baseIsArguments2 : function(value) {
24332             return isObjectLike2(value) && hasOwnProperty13.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
24333           };
24334           var isArray2 = Array2.isArray;
24335           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
24336           function isArrayLike2(value) {
24337             return value != null && isLength2(value.length) && !isFunction2(value);
24338           }
24339           function isArrayLikeObject2(value) {
24340             return isObjectLike2(value) && isArrayLike2(value);
24341           }
24342           function isBoolean(value) {
24343             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
24344           }
24345           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
24346           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
24347           function isElement2(value) {
24348             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject2(value);
24349           }
24350           function isEmpty(value) {
24351             if (value == null) {
24352               return true;
24353             }
24354             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
24355               return !value.length;
24356             }
24357             var tag2 = getTag2(value);
24358             if (tag2 == mapTag4 || tag2 == setTag4) {
24359               return !value.size;
24360             }
24361             if (isPrototype2(value)) {
24362               return !baseKeys2(value).length;
24363             }
24364             for (var key in value) {
24365               if (hasOwnProperty13.call(value, key)) {
24366                 return false;
24367               }
24368             }
24369             return true;
24370           }
24371           function isEqual5(value, other2) {
24372             return baseIsEqual2(value, other2);
24373           }
24374           function isEqualWith(value, other2, customizer) {
24375             customizer = typeof customizer == "function" ? customizer : undefined2;
24376             var result2 = customizer ? customizer(value, other2) : undefined2;
24377             return result2 === undefined2 ? baseIsEqual2(value, other2, undefined2, customizer) : !!result2;
24378           }
24379           function isError(value) {
24380             if (!isObjectLike2(value)) {
24381               return false;
24382             }
24383             var tag2 = baseGetTag2(value);
24384             return tag2 == errorTag3 || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value);
24385           }
24386           function isFinite2(value) {
24387             return typeof value == "number" && nativeIsFinite(value);
24388           }
24389           function isFunction2(value) {
24390             if (!isObject2(value)) {
24391               return false;
24392             }
24393             var tag2 = baseGetTag2(value);
24394             return tag2 == funcTag3 || tag2 == genTag2 || tag2 == asyncTag2 || tag2 == proxyTag2;
24395           }
24396           function isInteger(value) {
24397             return typeof value == "number" && value == toInteger(value);
24398           }
24399           function isLength2(value) {
24400             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER4;
24401           }
24402           function isObject2(value) {
24403             var type2 = typeof value;
24404             return value != null && (type2 == "object" || type2 == "function");
24405           }
24406           function isObjectLike2(value) {
24407             return value != null && typeof value == "object";
24408           }
24409           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
24410           function isMatch(object, source) {
24411             return object === source || baseIsMatch(object, source, getMatchData(source));
24412           }
24413           function isMatchWith(object, source, customizer) {
24414             customizer = typeof customizer == "function" ? customizer : undefined2;
24415             return baseIsMatch(object, source, getMatchData(source), customizer);
24416           }
24417           function isNaN2(value) {
24418             return isNumber2(value) && value != +value;
24419           }
24420           function isNative(value) {
24421             if (isMaskable(value)) {
24422               throw new Error2(CORE_ERROR_TEXT);
24423             }
24424             return baseIsNative2(value);
24425           }
24426           function isNull(value) {
24427             return value === null;
24428           }
24429           function isNil(value) {
24430             return value == null;
24431           }
24432           function isNumber2(value) {
24433             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
24434           }
24435           function isPlainObject2(value) {
24436             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag5) {
24437               return false;
24438             }
24439             var proto = getPrototype2(value);
24440             if (proto === null) {
24441               return true;
24442             }
24443             var Ctor = hasOwnProperty13.call(proto, "constructor") && proto.constructor;
24444             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString4.call(Ctor) == objectCtorString2;
24445           }
24446           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
24447           function isSafeInteger(value) {
24448             return isInteger(value) && value >= -MAX_SAFE_INTEGER4 && value <= MAX_SAFE_INTEGER4;
24449           }
24450           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
24451           function isString(value) {
24452             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
24453           }
24454           function isSymbol2(value) {
24455             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
24456           }
24457           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
24458           function isUndefined(value) {
24459             return value === undefined2;
24460           }
24461           function isWeakMap(value) {
24462             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
24463           }
24464           function isWeakSet(value) {
24465             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
24466           }
24467           var lt2 = createRelationalOperation(baseLt);
24468           var lte = createRelationalOperation(function(value, other2) {
24469             return value <= other2;
24470           });
24471           function toArray(value) {
24472             if (!value) {
24473               return [];
24474             }
24475             if (isArrayLike2(value)) {
24476               return isString(value) ? stringToArray(value) : copyArray2(value);
24477             }
24478             if (symIterator && value[symIterator]) {
24479               return iteratorToArray(value[symIterator]());
24480             }
24481             var tag2 = getTag2(value), func = tag2 == mapTag4 ? mapToArray2 : tag2 == setTag4 ? setToArray2 : values;
24482             return func(value);
24483           }
24484           function toFinite(value) {
24485             if (!value) {
24486               return value === 0 ? value : 0;
24487             }
24488             value = toNumber3(value);
24489             if (value === INFINITY2 || value === -INFINITY2) {
24490               var sign2 = value < 0 ? -1 : 1;
24491               return sign2 * MAX_INTEGER;
24492             }
24493             return value === value ? value : 0;
24494           }
24495           function toInteger(value) {
24496             var result2 = toFinite(value), remainder = result2 % 1;
24497             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
24498           }
24499           function toLength(value) {
24500             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
24501           }
24502           function toNumber3(value) {
24503             if (typeof value == "number") {
24504               return value;
24505             }
24506             if (isSymbol2(value)) {
24507               return NAN2;
24508             }
24509             if (isObject2(value)) {
24510               var other2 = typeof value.valueOf == "function" ? value.valueOf() : value;
24511               value = isObject2(other2) ? other2 + "" : other2;
24512             }
24513             if (typeof value != "string") {
24514               return value === 0 ? value : +value;
24515             }
24516             value = baseTrim2(value);
24517             var isBinary = reIsBinary2.test(value);
24518             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
24519           }
24520           function toPlainObject2(value) {
24521             return copyObject2(value, keysIn2(value));
24522           }
24523           function toSafeInteger(value) {
24524             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value === 0 ? value : 0;
24525           }
24526           function toString2(value) {
24527             return value == null ? "" : baseToString2(value);
24528           }
24529           var assign = createAssigner2(function(object, source) {
24530             if (isPrototype2(source) || isArrayLike2(source)) {
24531               copyObject2(source, keys2(source), object);
24532               return;
24533             }
24534             for (var key in source) {
24535               if (hasOwnProperty13.call(source, key)) {
24536                 assignValue2(object, key, source[key]);
24537               }
24538             }
24539           });
24540           var assignIn = createAssigner2(function(object, source) {
24541             copyObject2(source, keysIn2(source), object);
24542           });
24543           var assignInWith = createAssigner2(function(object, source, srcIndex, customizer) {
24544             copyObject2(source, keysIn2(source), object, customizer);
24545           });
24546           var assignWith = createAssigner2(function(object, source, srcIndex, customizer) {
24547             copyObject2(source, keys2(source), object, customizer);
24548           });
24549           var at2 = flatRest(baseAt);
24550           function create2(prototype4, properties) {
24551             var result2 = baseCreate2(prototype4);
24552             return properties == null ? result2 : baseAssign(result2, properties);
24553           }
24554           var defaults = baseRest2(function(object, sources) {
24555             object = Object2(object);
24556             var index = -1;
24557             var length2 = sources.length;
24558             var guard = length2 > 2 ? sources[2] : undefined2;
24559             if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
24560               length2 = 1;
24561             }
24562             while (++index < length2) {
24563               var source = sources[index];
24564               var props = keysIn2(source);
24565               var propsIndex = -1;
24566               var propsLength = props.length;
24567               while (++propsIndex < propsLength) {
24568                 var key = props[propsIndex];
24569                 var value = object[key];
24570                 if (value === undefined2 || eq2(value, objectProto16[key]) && !hasOwnProperty13.call(object, key)) {
24571                   object[key] = source[key];
24572                 }
24573               }
24574             }
24575             return object;
24576           });
24577           var defaultsDeep = baseRest2(function(args) {
24578             args.push(undefined2, customDefaultsMerge);
24579             return apply2(mergeWith, undefined2, args);
24580           });
24581           function findKey(object, predicate) {
24582             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
24583           }
24584           function findLastKey(object, predicate) {
24585             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
24586           }
24587           function forIn(object, iteratee2) {
24588             return object == null ? object : baseFor2(object, getIteratee(iteratee2, 3), keysIn2);
24589           }
24590           function forInRight(object, iteratee2) {
24591             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn2);
24592           }
24593           function forOwn(object, iteratee2) {
24594             return object && baseForOwn(object, getIteratee(iteratee2, 3));
24595           }
24596           function forOwnRight(object, iteratee2) {
24597             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
24598           }
24599           function functions(object) {
24600             return object == null ? [] : baseFunctions(object, keys2(object));
24601           }
24602           function functionsIn(object) {
24603             return object == null ? [] : baseFunctions(object, keysIn2(object));
24604           }
24605           function get4(object, path, defaultValue) {
24606             var result2 = object == null ? undefined2 : baseGet(object, path);
24607             return result2 === undefined2 ? defaultValue : result2;
24608           }
24609           function has(object, path) {
24610             return object != null && hasPath(object, path, baseHas);
24611           }
24612           function hasIn(object, path) {
24613             return object != null && hasPath(object, path, baseHasIn);
24614           }
24615           var invert = createInverter(function(result2, value, key) {
24616             if (value != null && typeof value.toString != "function") {
24617               value = nativeObjectToString3.call(value);
24618             }
24619             result2[value] = key;
24620           }, constant2(identity5));
24621           var invertBy = createInverter(function(result2, value, key) {
24622             if (value != null && typeof value.toString != "function") {
24623               value = nativeObjectToString3.call(value);
24624             }
24625             if (hasOwnProperty13.call(result2, value)) {
24626               result2[value].push(key);
24627             } else {
24628               result2[value] = [key];
24629             }
24630           }, getIteratee);
24631           var invoke = baseRest2(baseInvoke);
24632           function keys2(object) {
24633             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
24634           }
24635           function keysIn2(object) {
24636             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn2(object);
24637           }
24638           function mapKeys(object, iteratee2) {
24639             var result2 = {};
24640             iteratee2 = getIteratee(iteratee2, 3);
24641             baseForOwn(object, function(value, key, object2) {
24642               baseAssignValue2(result2, iteratee2(value, key, object2), value);
24643             });
24644             return result2;
24645           }
24646           function mapValues(object, iteratee2) {
24647             var result2 = {};
24648             iteratee2 = getIteratee(iteratee2, 3);
24649             baseForOwn(object, function(value, key, object2) {
24650               baseAssignValue2(result2, key, iteratee2(value, key, object2));
24651             });
24652             return result2;
24653           }
24654           var merge3 = createAssigner2(function(object, source, srcIndex) {
24655             baseMerge2(object, source, srcIndex);
24656           });
24657           var mergeWith = createAssigner2(function(object, source, srcIndex, customizer) {
24658             baseMerge2(object, source, srcIndex, customizer);
24659           });
24660           var omit = flatRest(function(object, paths) {
24661             var result2 = {};
24662             if (object == null) {
24663               return result2;
24664             }
24665             var isDeep = false;
24666             paths = arrayMap2(paths, function(path) {
24667               path = castPath(path, object);
24668               isDeep || (isDeep = path.length > 1);
24669               return path;
24670             });
24671             copyObject2(object, getAllKeysIn(object), result2);
24672             if (isDeep) {
24673               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
24674             }
24675             var length2 = paths.length;
24676             while (length2--) {
24677               baseUnset(result2, paths[length2]);
24678             }
24679             return result2;
24680           });
24681           function omitBy(object, predicate) {
24682             return pickBy(object, negate(getIteratee(predicate)));
24683           }
24684           var pick = flatRest(function(object, paths) {
24685             return object == null ? {} : basePick(object, paths);
24686           });
24687           function pickBy(object, predicate) {
24688             if (object == null) {
24689               return {};
24690             }
24691             var props = arrayMap2(getAllKeysIn(object), function(prop) {
24692               return [prop];
24693             });
24694             predicate = getIteratee(predicate);
24695             return basePickBy(object, props, function(value, path) {
24696               return predicate(value, path[0]);
24697             });
24698           }
24699           function result(object, path, defaultValue) {
24700             path = castPath(path, object);
24701             var index = -1, length2 = path.length;
24702             if (!length2) {
24703               length2 = 1;
24704               object = undefined2;
24705             }
24706             while (++index < length2) {
24707               var value = object == null ? undefined2 : object[toKey(path[index])];
24708               if (value === undefined2) {
24709                 index = length2;
24710                 value = defaultValue;
24711               }
24712               object = isFunction2(value) ? value.call(object) : value;
24713             }
24714             return object;
24715           }
24716           function set4(object, path, value) {
24717             return object == null ? object : baseSet(object, path, value);
24718           }
24719           function setWith(object, path, value, customizer) {
24720             customizer = typeof customizer == "function" ? customizer : undefined2;
24721             return object == null ? object : baseSet(object, path, value, customizer);
24722           }
24723           var toPairs = createToPairs(keys2);
24724           var toPairsIn = createToPairs(keysIn2);
24725           function transform2(object, iteratee2, accumulator) {
24726             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
24727             iteratee2 = getIteratee(iteratee2, 4);
24728             if (accumulator == null) {
24729               var Ctor = object && object.constructor;
24730               if (isArrLike) {
24731                 accumulator = isArr ? new Ctor() : [];
24732               } else if (isObject2(object)) {
24733                 accumulator = isFunction2(Ctor) ? baseCreate2(getPrototype2(object)) : {};
24734               } else {
24735                 accumulator = {};
24736               }
24737             }
24738             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
24739               return iteratee2(accumulator, value, index, object2);
24740             });
24741             return accumulator;
24742           }
24743           function unset(object, path) {
24744             return object == null ? true : baseUnset(object, path);
24745           }
24746           function update(object, path, updater) {
24747             return object == null ? object : baseUpdate(object, path, castFunction(updater));
24748           }
24749           function updateWith(object, path, updater, customizer) {
24750             customizer = typeof customizer == "function" ? customizer : undefined2;
24751             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
24752           }
24753           function values(object) {
24754             return object == null ? [] : baseValues(object, keys2(object));
24755           }
24756           function valuesIn(object) {
24757             return object == null ? [] : baseValues(object, keysIn2(object));
24758           }
24759           function clamp3(number3, lower2, upper) {
24760             if (upper === undefined2) {
24761               upper = lower2;
24762               lower2 = undefined2;
24763             }
24764             if (upper !== undefined2) {
24765               upper = toNumber3(upper);
24766               upper = upper === upper ? upper : 0;
24767             }
24768             if (lower2 !== undefined2) {
24769               lower2 = toNumber3(lower2);
24770               lower2 = lower2 === lower2 ? lower2 : 0;
24771             }
24772             return baseClamp(toNumber3(number3), lower2, upper);
24773           }
24774           function inRange(number3, start2, end) {
24775             start2 = toFinite(start2);
24776             if (end === undefined2) {
24777               end = start2;
24778               start2 = 0;
24779             } else {
24780               end = toFinite(end);
24781             }
24782             number3 = toNumber3(number3);
24783             return baseInRange(number3, start2, end);
24784           }
24785           function random(lower2, upper, floating) {
24786             if (floating && typeof floating != "boolean" && isIterateeCall2(lower2, upper, floating)) {
24787               upper = floating = undefined2;
24788             }
24789             if (floating === undefined2) {
24790               if (typeof upper == "boolean") {
24791                 floating = upper;
24792                 upper = undefined2;
24793               } else if (typeof lower2 == "boolean") {
24794                 floating = lower2;
24795                 lower2 = undefined2;
24796               }
24797             }
24798             if (lower2 === undefined2 && upper === undefined2) {
24799               lower2 = 0;
24800               upper = 1;
24801             } else {
24802               lower2 = toFinite(lower2);
24803               if (upper === undefined2) {
24804                 upper = lower2;
24805                 lower2 = 0;
24806               } else {
24807                 upper = toFinite(upper);
24808               }
24809             }
24810             if (lower2 > upper) {
24811               var temp = lower2;
24812               lower2 = upper;
24813               upper = temp;
24814             }
24815             if (floating || lower2 % 1 || upper % 1) {
24816               var rand = nativeRandom();
24817               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
24818             }
24819             return baseRandom(lower2, upper);
24820           }
24821           var camelCase = createCompounder(function(result2, word, index) {
24822             word = word.toLowerCase();
24823             return result2 + (index ? capitalize(word) : word);
24824           });
24825           function capitalize(string) {
24826             return upperFirst(toString2(string).toLowerCase());
24827           }
24828           function deburr(string) {
24829             string = toString2(string);
24830             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
24831           }
24832           function endsWith(string, target, position) {
24833             string = toString2(string);
24834             target = baseToString2(target);
24835             var length2 = string.length;
24836             position = position === undefined2 ? length2 : baseClamp(toInteger(position), 0, length2);
24837             var end = position;
24838             position -= target.length;
24839             return position >= 0 && string.slice(position, end) == target;
24840           }
24841           function escape6(string) {
24842             string = toString2(string);
24843             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
24844           }
24845           function escapeRegExp(string) {
24846             string = toString2(string);
24847             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
24848           }
24849           var kebabCase = createCompounder(function(result2, word, index) {
24850             return result2 + (index ? "-" : "") + word.toLowerCase();
24851           });
24852           var lowerCase = createCompounder(function(result2, word, index) {
24853             return result2 + (index ? " " : "") + word.toLowerCase();
24854           });
24855           var lowerFirst = createCaseFirst("toLowerCase");
24856           function pad3(string, length2, chars) {
24857             string = toString2(string);
24858             length2 = toInteger(length2);
24859             var strLength = length2 ? stringSize(string) : 0;
24860             if (!length2 || strLength >= length2) {
24861               return string;
24862             }
24863             var mid = (length2 - strLength) / 2;
24864             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
24865           }
24866           function padEnd(string, length2, chars) {
24867             string = toString2(string);
24868             length2 = toInteger(length2);
24869             var strLength = length2 ? stringSize(string) : 0;
24870             return length2 && strLength < length2 ? string + createPadding(length2 - strLength, chars) : string;
24871           }
24872           function padStart(string, length2, chars) {
24873             string = toString2(string);
24874             length2 = toInteger(length2);
24875             var strLength = length2 ? stringSize(string) : 0;
24876             return length2 && strLength < length2 ? createPadding(length2 - strLength, chars) + string : string;
24877           }
24878           function parseInt2(string, radix, guard) {
24879             if (guard || radix == null) {
24880               radix = 0;
24881             } else if (radix) {
24882               radix = +radix;
24883             }
24884             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
24885           }
24886           function repeat(string, n3, guard) {
24887             if (guard ? isIterateeCall2(string, n3, guard) : n3 === undefined2) {
24888               n3 = 1;
24889             } else {
24890               n3 = toInteger(n3);
24891             }
24892             return baseRepeat(toString2(string), n3);
24893           }
24894           function replace() {
24895             var args = arguments, string = toString2(args[0]);
24896             return args.length < 3 ? string : string.replace(args[1], args[2]);
24897           }
24898           var snakeCase = createCompounder(function(result2, word, index) {
24899             return result2 + (index ? "_" : "") + word.toLowerCase();
24900           });
24901           function split(string, separator, limit) {
24902             if (limit && typeof limit != "number" && isIterateeCall2(string, separator, limit)) {
24903               separator = limit = undefined2;
24904             }
24905             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
24906             if (!limit) {
24907               return [];
24908             }
24909             string = toString2(string);
24910             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
24911               separator = baseToString2(separator);
24912               if (!separator && hasUnicode(string)) {
24913                 return castSlice(stringToArray(string), 0, limit);
24914               }
24915             }
24916             return string.split(separator, limit);
24917           }
24918           var startCase = createCompounder(function(result2, word, index) {
24919             return result2 + (index ? " " : "") + upperFirst(word);
24920           });
24921           function startsWith(string, target, position) {
24922             string = toString2(string);
24923             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
24924             target = baseToString2(target);
24925             return string.slice(position, position + target.length) == target;
24926           }
24927           function template(string, options2, guard) {
24928             var settings = lodash.templateSettings;
24929             if (guard && isIterateeCall2(string, options2, guard)) {
24930               options2 = undefined2;
24931             }
24932             string = toString2(string);
24933             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
24934             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
24935             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
24936             var reDelimiters = RegExp2(
24937               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
24938               "g"
24939             );
24940             var sourceURL = "//# sourceURL=" + (hasOwnProperty13.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
24941             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
24942               interpolateValue || (interpolateValue = esTemplateValue);
24943               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
24944               if (escapeValue) {
24945                 isEscaping = true;
24946                 source += "' +\n__e(" + escapeValue + ") +\n'";
24947               }
24948               if (evaluateValue) {
24949                 isEvaluating = true;
24950                 source += "';\n" + evaluateValue + ";\n__p += '";
24951               }
24952               if (interpolateValue) {
24953                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
24954               }
24955               index = offset + match.length;
24956               return match;
24957             });
24958             source += "';\n";
24959             var variable = hasOwnProperty13.call(options2, "variable") && options2.variable;
24960             if (!variable) {
24961               source = "with (obj) {\n" + source + "\n}\n";
24962             } else if (reForbiddenIdentifierChars.test(variable)) {
24963               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
24964             }
24965             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
24966             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}";
24967             var result2 = attempt(function() {
24968               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
24969             });
24970             result2.source = source;
24971             if (isError(result2)) {
24972               throw result2;
24973             }
24974             return result2;
24975           }
24976           function toLower(value) {
24977             return toString2(value).toLowerCase();
24978           }
24979           function toUpper(value) {
24980             return toString2(value).toUpperCase();
24981           }
24982           function trim(string, chars, guard) {
24983             string = toString2(string);
24984             if (string && (guard || chars === undefined2)) {
24985               return baseTrim2(string);
24986             }
24987             if (!string || !(chars = baseToString2(chars))) {
24988               return string;
24989             }
24990             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
24991             return castSlice(strSymbols, start2, end).join("");
24992           }
24993           function trimEnd(string, chars, guard) {
24994             string = toString2(string);
24995             if (string && (guard || chars === undefined2)) {
24996               return string.slice(0, trimmedEndIndex2(string) + 1);
24997             }
24998             if (!string || !(chars = baseToString2(chars))) {
24999               return string;
25000             }
25001             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
25002             return castSlice(strSymbols, 0, end).join("");
25003           }
25004           function trimStart(string, chars, guard) {
25005             string = toString2(string);
25006             if (string && (guard || chars === undefined2)) {
25007               return string.replace(reTrimStart2, "");
25008             }
25009             if (!string || !(chars = baseToString2(chars))) {
25010               return string;
25011             }
25012             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
25013             return castSlice(strSymbols, start2).join("");
25014           }
25015           function truncate(string, options2) {
25016             var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
25017             if (isObject2(options2)) {
25018               var separator = "separator" in options2 ? options2.separator : separator;
25019               length2 = "length" in options2 ? toInteger(options2.length) : length2;
25020               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
25021             }
25022             string = toString2(string);
25023             var strLength = string.length;
25024             if (hasUnicode(string)) {
25025               var strSymbols = stringToArray(string);
25026               strLength = strSymbols.length;
25027             }
25028             if (length2 >= strLength) {
25029               return string;
25030             }
25031             var end = length2 - stringSize(omission);
25032             if (end < 1) {
25033               return omission;
25034             }
25035             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
25036             if (separator === undefined2) {
25037               return result2 + omission;
25038             }
25039             if (strSymbols) {
25040               end += result2.length - end;
25041             }
25042             if (isRegExp(separator)) {
25043               if (string.slice(end).search(separator)) {
25044                 var match, substring = result2;
25045                 if (!separator.global) {
25046                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
25047                 }
25048                 separator.lastIndex = 0;
25049                 while (match = separator.exec(substring)) {
25050                   var newEnd = match.index;
25051                 }
25052                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
25053               }
25054             } else if (string.indexOf(baseToString2(separator), end) != end) {
25055               var index = result2.lastIndexOf(separator);
25056               if (index > -1) {
25057                 result2 = result2.slice(0, index);
25058               }
25059             }
25060             return result2 + omission;
25061           }
25062           function unescape2(string) {
25063             string = toString2(string);
25064             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
25065           }
25066           var upperCase = createCompounder(function(result2, word, index) {
25067             return result2 + (index ? " " : "") + word.toUpperCase();
25068           });
25069           var upperFirst = createCaseFirst("toUpperCase");
25070           function words(string, pattern, guard) {
25071             string = toString2(string);
25072             pattern = guard ? undefined2 : pattern;
25073             if (pattern === undefined2) {
25074               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
25075             }
25076             return string.match(pattern) || [];
25077           }
25078           var attempt = baseRest2(function(func, args) {
25079             try {
25080               return apply2(func, undefined2, args);
25081             } catch (e3) {
25082               return isError(e3) ? e3 : new Error2(e3);
25083             }
25084           });
25085           var bindAll = flatRest(function(object, methodNames) {
25086             arrayEach(methodNames, function(key) {
25087               key = toKey(key);
25088               baseAssignValue2(object, key, bind(object[key], object));
25089             });
25090             return object;
25091           });
25092           function cond(pairs2) {
25093             var length2 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
25094             pairs2 = !length2 ? [] : arrayMap2(pairs2, function(pair3) {
25095               if (typeof pair3[1] != "function") {
25096                 throw new TypeError2(FUNC_ERROR_TEXT3);
25097               }
25098               return [toIteratee(pair3[0]), pair3[1]];
25099             });
25100             return baseRest2(function(args) {
25101               var index = -1;
25102               while (++index < length2) {
25103                 var pair3 = pairs2[index];
25104                 if (apply2(pair3[0], this, args)) {
25105                   return apply2(pair3[1], this, args);
25106                 }
25107               }
25108             });
25109           }
25110           function conforms(source) {
25111             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
25112           }
25113           function constant2(value) {
25114             return function() {
25115               return value;
25116             };
25117           }
25118           function defaultTo(value, defaultValue) {
25119             return value == null || value !== value ? defaultValue : value;
25120           }
25121           var flow = createFlow();
25122           var flowRight = createFlow(true);
25123           function identity5(value) {
25124             return value;
25125           }
25126           function iteratee(func) {
25127             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
25128           }
25129           function matches(source) {
25130             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
25131           }
25132           function matchesProperty(path, srcValue) {
25133             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
25134           }
25135           var method = baseRest2(function(path, args) {
25136             return function(object) {
25137               return baseInvoke(object, path, args);
25138             };
25139           });
25140           var methodOf = baseRest2(function(object, args) {
25141             return function(path) {
25142               return baseInvoke(object, path, args);
25143             };
25144           });
25145           function mixin(object, source, options2) {
25146             var props = keys2(source), methodNames = baseFunctions(source, props);
25147             if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
25148               options2 = source;
25149               source = object;
25150               object = this;
25151               methodNames = baseFunctions(source, keys2(source));
25152             }
25153             var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
25154             arrayEach(methodNames, function(methodName) {
25155               var func = source[methodName];
25156               object[methodName] = func;
25157               if (isFunc) {
25158                 object.prototype[methodName] = function() {
25159                   var chainAll = this.__chain__;
25160                   if (chain2 || chainAll) {
25161                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray2(this.__actions__);
25162                     actions.push({ "func": func, "args": arguments, "thisArg": object });
25163                     result2.__chain__ = chainAll;
25164                     return result2;
25165                   }
25166                   return func.apply(object, arrayPush2([this.value()], arguments));
25167                 };
25168               }
25169             });
25170             return object;
25171           }
25172           function noConflict() {
25173             if (root3._ === this) {
25174               root3._ = oldDash;
25175             }
25176             return this;
25177           }
25178           function noop3() {
25179           }
25180           function nthArg(n3) {
25181             n3 = toInteger(n3);
25182             return baseRest2(function(args) {
25183               return baseNth(args, n3);
25184             });
25185           }
25186           var over = createOver(arrayMap2);
25187           var overEvery = createOver(arrayEvery);
25188           var overSome = createOver(arraySome2);
25189           function property(path) {
25190             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
25191           }
25192           function propertyOf(object) {
25193             return function(path) {
25194               return object == null ? undefined2 : baseGet(object, path);
25195             };
25196           }
25197           var range3 = createRange();
25198           var rangeRight = createRange(true);
25199           function stubArray2() {
25200             return [];
25201           }
25202           function stubFalse2() {
25203             return false;
25204           }
25205           function stubObject() {
25206             return {};
25207           }
25208           function stubString() {
25209             return "";
25210           }
25211           function stubTrue() {
25212             return true;
25213           }
25214           function times(n3, iteratee2) {
25215             n3 = toInteger(n3);
25216             if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
25217               return [];
25218             }
25219             var index = MAX_ARRAY_LENGTH, length2 = nativeMin2(n3, MAX_ARRAY_LENGTH);
25220             iteratee2 = getIteratee(iteratee2);
25221             n3 -= MAX_ARRAY_LENGTH;
25222             var result2 = baseTimes2(length2, iteratee2);
25223             while (++index < n3) {
25224               iteratee2(index);
25225             }
25226             return result2;
25227           }
25228           function toPath(value) {
25229             if (isArray2(value)) {
25230               return arrayMap2(value, toKey);
25231             }
25232             return isSymbol2(value) ? [value] : copyArray2(stringToPath(toString2(value)));
25233           }
25234           function uniqueId(prefix) {
25235             var id2 = ++idCounter;
25236             return toString2(prefix) + id2;
25237           }
25238           var add = createMathOperation(function(augend, addend) {
25239             return augend + addend;
25240           }, 0);
25241           var ceil = createRound("ceil");
25242           var divide = createMathOperation(function(dividend, divisor) {
25243             return dividend / divisor;
25244           }, 1);
25245           var floor = createRound("floor");
25246           function max3(array2) {
25247             return array2 && array2.length ? baseExtremum(array2, identity5, baseGt) : undefined2;
25248           }
25249           function maxBy(array2, iteratee2) {
25250             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
25251           }
25252           function mean(array2) {
25253             return baseMean(array2, identity5);
25254           }
25255           function meanBy(array2, iteratee2) {
25256             return baseMean(array2, getIteratee(iteratee2, 2));
25257           }
25258           function min3(array2) {
25259             return array2 && array2.length ? baseExtremum(array2, identity5, baseLt) : undefined2;
25260           }
25261           function minBy(array2, iteratee2) {
25262             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
25263           }
25264           var multiply = createMathOperation(function(multiplier, multiplicand) {
25265             return multiplier * multiplicand;
25266           }, 1);
25267           var round = createRound("round");
25268           var subtract = createMathOperation(function(minuend, subtrahend) {
25269             return minuend - subtrahend;
25270           }, 0);
25271           function sum(array2) {
25272             return array2 && array2.length ? baseSum(array2, identity5) : 0;
25273           }
25274           function sumBy(array2, iteratee2) {
25275             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
25276           }
25277           lodash.after = after;
25278           lodash.ary = ary;
25279           lodash.assign = assign;
25280           lodash.assignIn = assignIn;
25281           lodash.assignInWith = assignInWith;
25282           lodash.assignWith = assignWith;
25283           lodash.at = at2;
25284           lodash.before = before;
25285           lodash.bind = bind;
25286           lodash.bindAll = bindAll;
25287           lodash.bindKey = bindKey2;
25288           lodash.castArray = castArray;
25289           lodash.chain = chain;
25290           lodash.chunk = chunk;
25291           lodash.compact = compact;
25292           lodash.concat = concat;
25293           lodash.cond = cond;
25294           lodash.conforms = conforms;
25295           lodash.constant = constant2;
25296           lodash.countBy = countBy;
25297           lodash.create = create2;
25298           lodash.curry = curry;
25299           lodash.curryRight = curryRight;
25300           lodash.debounce = debounce2;
25301           lodash.defaults = defaults;
25302           lodash.defaultsDeep = defaultsDeep;
25303           lodash.defer = defer;
25304           lodash.delay = delay;
25305           lodash.difference = difference2;
25306           lodash.differenceBy = differenceBy;
25307           lodash.differenceWith = differenceWith;
25308           lodash.drop = drop;
25309           lodash.dropRight = dropRight;
25310           lodash.dropRightWhile = dropRightWhile;
25311           lodash.dropWhile = dropWhile;
25312           lodash.fill = fill;
25313           lodash.filter = filter2;
25314           lodash.flatMap = flatMap;
25315           lodash.flatMapDeep = flatMapDeep;
25316           lodash.flatMapDepth = flatMapDepth;
25317           lodash.flatten = flatten2;
25318           lodash.flattenDeep = flattenDeep;
25319           lodash.flattenDepth = flattenDepth;
25320           lodash.flip = flip;
25321           lodash.flow = flow;
25322           lodash.flowRight = flowRight;
25323           lodash.fromPairs = fromPairs;
25324           lodash.functions = functions;
25325           lodash.functionsIn = functionsIn;
25326           lodash.groupBy = groupBy;
25327           lodash.initial = initial;
25328           lodash.intersection = intersection2;
25329           lodash.intersectionBy = intersectionBy;
25330           lodash.intersectionWith = intersectionWith;
25331           lodash.invert = invert;
25332           lodash.invertBy = invertBy;
25333           lodash.invokeMap = invokeMap;
25334           lodash.iteratee = iteratee;
25335           lodash.keyBy = keyBy;
25336           lodash.keys = keys2;
25337           lodash.keysIn = keysIn2;
25338           lodash.map = map2;
25339           lodash.mapKeys = mapKeys;
25340           lodash.mapValues = mapValues;
25341           lodash.matches = matches;
25342           lodash.matchesProperty = matchesProperty;
25343           lodash.memoize = memoize;
25344           lodash.merge = merge3;
25345           lodash.mergeWith = mergeWith;
25346           lodash.method = method;
25347           lodash.methodOf = methodOf;
25348           lodash.mixin = mixin;
25349           lodash.negate = negate;
25350           lodash.nthArg = nthArg;
25351           lodash.omit = omit;
25352           lodash.omitBy = omitBy;
25353           lodash.once = once;
25354           lodash.orderBy = orderBy;
25355           lodash.over = over;
25356           lodash.overArgs = overArgs;
25357           lodash.overEvery = overEvery;
25358           lodash.overSome = overSome;
25359           lodash.partial = partial;
25360           lodash.partialRight = partialRight;
25361           lodash.partition = partition;
25362           lodash.pick = pick;
25363           lodash.pickBy = pickBy;
25364           lodash.property = property;
25365           lodash.propertyOf = propertyOf;
25366           lodash.pull = pull;
25367           lodash.pullAll = pullAll;
25368           lodash.pullAllBy = pullAllBy;
25369           lodash.pullAllWith = pullAllWith;
25370           lodash.pullAt = pullAt;
25371           lodash.range = range3;
25372           lodash.rangeRight = rangeRight;
25373           lodash.rearg = rearg;
25374           lodash.reject = reject;
25375           lodash.remove = remove2;
25376           lodash.rest = rest;
25377           lodash.reverse = reverse;
25378           lodash.sampleSize = sampleSize;
25379           lodash.set = set4;
25380           lodash.setWith = setWith;
25381           lodash.shuffle = shuffle;
25382           lodash.slice = slice;
25383           lodash.sortBy = sortBy;
25384           lodash.sortedUniq = sortedUniq;
25385           lodash.sortedUniqBy = sortedUniqBy;
25386           lodash.split = split;
25387           lodash.spread = spread;
25388           lodash.tail = tail;
25389           lodash.take = take;
25390           lodash.takeRight = takeRight;
25391           lodash.takeRightWhile = takeRightWhile;
25392           lodash.takeWhile = takeWhile;
25393           lodash.tap = tap;
25394           lodash.throttle = throttle2;
25395           lodash.thru = thru;
25396           lodash.toArray = toArray;
25397           lodash.toPairs = toPairs;
25398           lodash.toPairsIn = toPairsIn;
25399           lodash.toPath = toPath;
25400           lodash.toPlainObject = toPlainObject2;
25401           lodash.transform = transform2;
25402           lodash.unary = unary;
25403           lodash.union = union2;
25404           lodash.unionBy = unionBy;
25405           lodash.unionWith = unionWith;
25406           lodash.uniq = uniq;
25407           lodash.uniqBy = uniqBy;
25408           lodash.uniqWith = uniqWith;
25409           lodash.unset = unset;
25410           lodash.unzip = unzip;
25411           lodash.unzipWith = unzipWith;
25412           lodash.update = update;
25413           lodash.updateWith = updateWith;
25414           lodash.values = values;
25415           lodash.valuesIn = valuesIn;
25416           lodash.without = without;
25417           lodash.words = words;
25418           lodash.wrap = wrap2;
25419           lodash.xor = xor;
25420           lodash.xorBy = xorBy;
25421           lodash.xorWith = xorWith;
25422           lodash.zip = zip;
25423           lodash.zipObject = zipObject;
25424           lodash.zipObjectDeep = zipObjectDeep;
25425           lodash.zipWith = zipWith;
25426           lodash.entries = toPairs;
25427           lodash.entriesIn = toPairsIn;
25428           lodash.extend = assignIn;
25429           lodash.extendWith = assignInWith;
25430           mixin(lodash, lodash);
25431           lodash.add = add;
25432           lodash.attempt = attempt;
25433           lodash.camelCase = camelCase;
25434           lodash.capitalize = capitalize;
25435           lodash.ceil = ceil;
25436           lodash.clamp = clamp3;
25437           lodash.clone = clone2;
25438           lodash.cloneDeep = cloneDeep;
25439           lodash.cloneDeepWith = cloneDeepWith;
25440           lodash.cloneWith = cloneWith;
25441           lodash.conformsTo = conformsTo;
25442           lodash.deburr = deburr;
25443           lodash.defaultTo = defaultTo;
25444           lodash.divide = divide;
25445           lodash.endsWith = endsWith;
25446           lodash.eq = eq2;
25447           lodash.escape = escape6;
25448           lodash.escapeRegExp = escapeRegExp;
25449           lodash.every = every;
25450           lodash.find = find2;
25451           lodash.findIndex = findIndex;
25452           lodash.findKey = findKey;
25453           lodash.findLast = findLast;
25454           lodash.findLastIndex = findLastIndex;
25455           lodash.findLastKey = findLastKey;
25456           lodash.floor = floor;
25457           lodash.forEach = forEach;
25458           lodash.forEachRight = forEachRight;
25459           lodash.forIn = forIn;
25460           lodash.forInRight = forInRight;
25461           lodash.forOwn = forOwn;
25462           lodash.forOwnRight = forOwnRight;
25463           lodash.get = get4;
25464           lodash.gt = gt2;
25465           lodash.gte = gte;
25466           lodash.has = has;
25467           lodash.hasIn = hasIn;
25468           lodash.head = head;
25469           lodash.identity = identity5;
25470           lodash.includes = includes;
25471           lodash.indexOf = indexOf;
25472           lodash.inRange = inRange;
25473           lodash.invoke = invoke;
25474           lodash.isArguments = isArguments2;
25475           lodash.isArray = isArray2;
25476           lodash.isArrayBuffer = isArrayBuffer;
25477           lodash.isArrayLike = isArrayLike2;
25478           lodash.isArrayLikeObject = isArrayLikeObject2;
25479           lodash.isBoolean = isBoolean;
25480           lodash.isBuffer = isBuffer2;
25481           lodash.isDate = isDate;
25482           lodash.isElement = isElement2;
25483           lodash.isEmpty = isEmpty;
25484           lodash.isEqual = isEqual5;
25485           lodash.isEqualWith = isEqualWith;
25486           lodash.isError = isError;
25487           lodash.isFinite = isFinite2;
25488           lodash.isFunction = isFunction2;
25489           lodash.isInteger = isInteger;
25490           lodash.isLength = isLength2;
25491           lodash.isMap = isMap;
25492           lodash.isMatch = isMatch;
25493           lodash.isMatchWith = isMatchWith;
25494           lodash.isNaN = isNaN2;
25495           lodash.isNative = isNative;
25496           lodash.isNil = isNil;
25497           lodash.isNull = isNull;
25498           lodash.isNumber = isNumber2;
25499           lodash.isObject = isObject2;
25500           lodash.isObjectLike = isObjectLike2;
25501           lodash.isPlainObject = isPlainObject2;
25502           lodash.isRegExp = isRegExp;
25503           lodash.isSafeInteger = isSafeInteger;
25504           lodash.isSet = isSet;
25505           lodash.isString = isString;
25506           lodash.isSymbol = isSymbol2;
25507           lodash.isTypedArray = isTypedArray2;
25508           lodash.isUndefined = isUndefined;
25509           lodash.isWeakMap = isWeakMap;
25510           lodash.isWeakSet = isWeakSet;
25511           lodash.join = join;
25512           lodash.kebabCase = kebabCase;
25513           lodash.last = last;
25514           lodash.lastIndexOf = lastIndexOf;
25515           lodash.lowerCase = lowerCase;
25516           lodash.lowerFirst = lowerFirst;
25517           lodash.lt = lt2;
25518           lodash.lte = lte;
25519           lodash.max = max3;
25520           lodash.maxBy = maxBy;
25521           lodash.mean = mean;
25522           lodash.meanBy = meanBy;
25523           lodash.min = min3;
25524           lodash.minBy = minBy;
25525           lodash.stubArray = stubArray2;
25526           lodash.stubFalse = stubFalse2;
25527           lodash.stubObject = stubObject;
25528           lodash.stubString = stubString;
25529           lodash.stubTrue = stubTrue;
25530           lodash.multiply = multiply;
25531           lodash.nth = nth;
25532           lodash.noConflict = noConflict;
25533           lodash.noop = noop3;
25534           lodash.now = now3;
25535           lodash.pad = pad3;
25536           lodash.padEnd = padEnd;
25537           lodash.padStart = padStart;
25538           lodash.parseInt = parseInt2;
25539           lodash.random = random;
25540           lodash.reduce = reduce;
25541           lodash.reduceRight = reduceRight;
25542           lodash.repeat = repeat;
25543           lodash.replace = replace;
25544           lodash.result = result;
25545           lodash.round = round;
25546           lodash.runInContext = runInContext2;
25547           lodash.sample = sample;
25548           lodash.size = size;
25549           lodash.snakeCase = snakeCase;
25550           lodash.some = some;
25551           lodash.sortedIndex = sortedIndex;
25552           lodash.sortedIndexBy = sortedIndexBy;
25553           lodash.sortedIndexOf = sortedIndexOf;
25554           lodash.sortedLastIndex = sortedLastIndex;
25555           lodash.sortedLastIndexBy = sortedLastIndexBy;
25556           lodash.sortedLastIndexOf = sortedLastIndexOf;
25557           lodash.startCase = startCase;
25558           lodash.startsWith = startsWith;
25559           lodash.subtract = subtract;
25560           lodash.sum = sum;
25561           lodash.sumBy = sumBy;
25562           lodash.template = template;
25563           lodash.times = times;
25564           lodash.toFinite = toFinite;
25565           lodash.toInteger = toInteger;
25566           lodash.toLength = toLength;
25567           lodash.toLower = toLower;
25568           lodash.toNumber = toNumber3;
25569           lodash.toSafeInteger = toSafeInteger;
25570           lodash.toString = toString2;
25571           lodash.toUpper = toUpper;
25572           lodash.trim = trim;
25573           lodash.trimEnd = trimEnd;
25574           lodash.trimStart = trimStart;
25575           lodash.truncate = truncate;
25576           lodash.unescape = unescape2;
25577           lodash.uniqueId = uniqueId;
25578           lodash.upperCase = upperCase;
25579           lodash.upperFirst = upperFirst;
25580           lodash.each = forEach;
25581           lodash.eachRight = forEachRight;
25582           lodash.first = head;
25583           mixin(lodash, function() {
25584             var source = {};
25585             baseForOwn(lodash, function(func, methodName) {
25586               if (!hasOwnProperty13.call(lodash.prototype, methodName)) {
25587                 source[methodName] = func;
25588               }
25589             });
25590             return source;
25591           }(), { "chain": false });
25592           lodash.VERSION = VERSION;
25593           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
25594             lodash[methodName].placeholder = lodash;
25595           });
25596           arrayEach(["drop", "take"], function(methodName, index) {
25597             LazyWrapper.prototype[methodName] = function(n3) {
25598               n3 = n3 === undefined2 ? 1 : nativeMax3(toInteger(n3), 0);
25599               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
25600               if (result2.__filtered__) {
25601                 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
25602               } else {
25603                 result2.__views__.push({
25604                   "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
25605                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
25606                 });
25607               }
25608               return result2;
25609             };
25610             LazyWrapper.prototype[methodName + "Right"] = function(n3) {
25611               return this.reverse()[methodName](n3).reverse();
25612             };
25613           });
25614           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
25615             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
25616             LazyWrapper.prototype[methodName] = function(iteratee2) {
25617               var result2 = this.clone();
25618               result2.__iteratees__.push({
25619                 "iteratee": getIteratee(iteratee2, 3),
25620                 "type": type2
25621               });
25622               result2.__filtered__ = result2.__filtered__ || isFilter;
25623               return result2;
25624             };
25625           });
25626           arrayEach(["head", "last"], function(methodName, index) {
25627             var takeName = "take" + (index ? "Right" : "");
25628             LazyWrapper.prototype[methodName] = function() {
25629               return this[takeName](1).value()[0];
25630             };
25631           });
25632           arrayEach(["initial", "tail"], function(methodName, index) {
25633             var dropName = "drop" + (index ? "" : "Right");
25634             LazyWrapper.prototype[methodName] = function() {
25635               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
25636             };
25637           });
25638           LazyWrapper.prototype.compact = function() {
25639             return this.filter(identity5);
25640           };
25641           LazyWrapper.prototype.find = function(predicate) {
25642             return this.filter(predicate).head();
25643           };
25644           LazyWrapper.prototype.findLast = function(predicate) {
25645             return this.reverse().find(predicate);
25646           };
25647           LazyWrapper.prototype.invokeMap = baseRest2(function(path, args) {
25648             if (typeof path == "function") {
25649               return new LazyWrapper(this);
25650             }
25651             return this.map(function(value) {
25652               return baseInvoke(value, path, args);
25653             });
25654           });
25655           LazyWrapper.prototype.reject = function(predicate) {
25656             return this.filter(negate(getIteratee(predicate)));
25657           };
25658           LazyWrapper.prototype.slice = function(start2, end) {
25659             start2 = toInteger(start2);
25660             var result2 = this;
25661             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
25662               return new LazyWrapper(result2);
25663             }
25664             if (start2 < 0) {
25665               result2 = result2.takeRight(-start2);
25666             } else if (start2) {
25667               result2 = result2.drop(start2);
25668             }
25669             if (end !== undefined2) {
25670               end = toInteger(end);
25671               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
25672             }
25673             return result2;
25674           };
25675           LazyWrapper.prototype.takeRightWhile = function(predicate) {
25676             return this.reverse().takeWhile(predicate).reverse();
25677           };
25678           LazyWrapper.prototype.toArray = function() {
25679             return this.take(MAX_ARRAY_LENGTH);
25680           };
25681           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
25682             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);
25683             if (!lodashFunc) {
25684               return;
25685             }
25686             lodash.prototype[methodName] = function() {
25687               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
25688               var interceptor = function(value2) {
25689                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
25690                 return isTaker && chainAll ? result3[0] : result3;
25691               };
25692               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
25693                 isLazy = useLazy = false;
25694               }
25695               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
25696               if (!retUnwrapped && useLazy) {
25697                 value = onlyLazy ? value : new LazyWrapper(this);
25698                 var result2 = func.apply(value, args);
25699                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
25700                 return new LodashWrapper(result2, chainAll);
25701               }
25702               if (isUnwrapped && onlyLazy) {
25703                 return func.apply(this, args);
25704               }
25705               result2 = this.thru(interceptor);
25706               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
25707             };
25708           });
25709           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
25710             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
25711             lodash.prototype[methodName] = function() {
25712               var args = arguments;
25713               if (retUnwrapped && !this.__chain__) {
25714                 var value = this.value();
25715                 return func.apply(isArray2(value) ? value : [], args);
25716               }
25717               return this[chainName](function(value2) {
25718                 return func.apply(isArray2(value2) ? value2 : [], args);
25719               });
25720             };
25721           });
25722           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
25723             var lodashFunc = lodash[methodName];
25724             if (lodashFunc) {
25725               var key = lodashFunc.name + "";
25726               if (!hasOwnProperty13.call(realNames, key)) {
25727                 realNames[key] = [];
25728               }
25729               realNames[key].push({ "name": methodName, "func": lodashFunc });
25730             }
25731           });
25732           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
25733             "name": "wrapper",
25734             "func": undefined2
25735           }];
25736           LazyWrapper.prototype.clone = lazyClone;
25737           LazyWrapper.prototype.reverse = lazyReverse;
25738           LazyWrapper.prototype.value = lazyValue;
25739           lodash.prototype.at = wrapperAt;
25740           lodash.prototype.chain = wrapperChain;
25741           lodash.prototype.commit = wrapperCommit;
25742           lodash.prototype.next = wrapperNext;
25743           lodash.prototype.plant = wrapperPlant;
25744           lodash.prototype.reverse = wrapperReverse;
25745           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
25746           lodash.prototype.first = lodash.prototype.head;
25747           if (symIterator) {
25748             lodash.prototype[symIterator] = wrapperToIterator;
25749           }
25750           return lodash;
25751         };
25752         var _2 = runInContext();
25753         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
25754           root3._ = _2;
25755           define(function() {
25756             return _2;
25757           });
25758         } else if (freeModule4) {
25759           (freeModule4.exports = _2)._ = _2;
25760           freeExports4._ = _2;
25761         } else {
25762           root3._ = _2;
25763         }
25764       }).call(exports2);
25765     }
25766   });
25767
25768   // modules/actions/merge_remote_changes.js
25769   var merge_remote_changes_exports = {};
25770   __export(merge_remote_changes_exports, {
25771     actionMergeRemoteChanges: () => actionMergeRemoteChanges
25772   });
25773   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
25774     discardTags = discardTags || {};
25775     var _option = "safe";
25776     var _conflicts = [];
25777     function user(d2) {
25778       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash.escape)(d2);
25779     }
25780     function mergeLocation(remote, target) {
25781       function pointEqual(a2, b2) {
25782         var epsilon3 = 1e-6;
25783         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
25784       }
25785       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
25786         return target;
25787       }
25788       if (_option === "force_remote") {
25789         return target.update({ loc: remote.loc });
25790       }
25791       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
25792       return target;
25793     }
25794     function mergeNodes(base, remote, target) {
25795       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
25796         return target;
25797       }
25798       if (_option === "force_remote") {
25799         return target.update({ nodes: remote.nodes });
25800       }
25801       var ccount = _conflicts.length;
25802       var o2 = base.nodes || [];
25803       var a2 = target.nodes || [];
25804       var b2 = remote.nodes || [];
25805       var nodes = [];
25806       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
25807       for (var i3 = 0; i3 < hunks.length; i3++) {
25808         var hunk = hunks[i3];
25809         if (hunk.ok) {
25810           nodes.push.apply(nodes, hunk.ok);
25811         } else {
25812           var c2 = hunk.conflict;
25813           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
25814             nodes.push.apply(nodes, c2.b);
25815           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
25816             nodes.push.apply(nodes, c2.a);
25817           } else {
25818             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
25819             break;
25820           }
25821         }
25822       }
25823       return _conflicts.length === ccount ? target.update({ nodes }) : target;
25824     }
25825     function mergeChildren(targetWay, children2, updates, graph) {
25826       function isUsed(node2, targetWay2) {
25827         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
25828           return way.id !== targetWay2.id;
25829         });
25830         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
25831       }
25832       var ccount = _conflicts.length;
25833       for (var i3 = 0; i3 < children2.length; i3++) {
25834         var id3 = children2[i3];
25835         var node = graph.hasEntity(id3);
25836         if (targetWay.nodes.indexOf(id3) === -1) {
25837           if (node && !isUsed(node, targetWay)) {
25838             updates.removeIds.push(id3);
25839           }
25840           continue;
25841         }
25842         var local = localGraph.hasEntity(id3);
25843         var remote = remoteGraph.hasEntity(id3);
25844         var target;
25845         if (_option === "force_remote" && remote && remote.visible) {
25846           updates.replacements.push(remote);
25847         } else if (_option === "force_local" && local) {
25848           target = osmEntity(local);
25849           if (remote) {
25850             target = target.update({ version: remote.version });
25851           }
25852           updates.replacements.push(target);
25853         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
25854           target = osmEntity(local, { version: remote.version });
25855           if (remote.visible) {
25856             target = mergeLocation(remote, target);
25857           } else {
25858             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
25859           }
25860           if (_conflicts.length !== ccount) break;
25861           updates.replacements.push(target);
25862         }
25863       }
25864       return targetWay;
25865     }
25866     function updateChildren(updates, graph) {
25867       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
25868         graph = graph.replace(updates.replacements[i3]);
25869       }
25870       if (updates.removeIds.length) {
25871         graph = actionDeleteMultiple(updates.removeIds)(graph);
25872       }
25873       return graph;
25874     }
25875     function mergeMembers(remote, target) {
25876       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
25877         return target;
25878       }
25879       if (_option === "force_remote") {
25880         return target.update({ members: remote.members });
25881       }
25882       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
25883       return target;
25884     }
25885     function mergeTags(base, remote, target) {
25886       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
25887         return target;
25888       }
25889       if (_option === "force_remote") {
25890         return target.update({ tags: remote.tags });
25891       }
25892       var ccount = _conflicts.length;
25893       var o2 = base.tags || {};
25894       var a2 = target.tags || {};
25895       var b2 = remote.tags || {};
25896       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
25897         return !discardTags[k3];
25898       });
25899       var tags = Object.assign({}, a2);
25900       var changed = false;
25901       for (var i3 = 0; i3 < keys2.length; i3++) {
25902         var k2 = keys2[i3];
25903         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
25904           if (o2[k2] !== a2[k2]) {
25905             _conflicts.push(_t.html(
25906               "merge_remote_changes.conflict.tags",
25907               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
25908             ));
25909           } else {
25910             if (b2.hasOwnProperty(k2)) {
25911               tags[k2] = b2[k2];
25912             } else {
25913               delete tags[k2];
25914             }
25915             changed = true;
25916           }
25917         }
25918       }
25919       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
25920     }
25921     var action = function(graph) {
25922       var updates = { replacements: [], removeIds: [] };
25923       var base = graph.base().entities[id2];
25924       var local = localGraph.entity(id2);
25925       var remote = remoteGraph.entity(id2);
25926       var target = osmEntity(local, { version: remote.version });
25927       if (!remote.visible) {
25928         if (_option === "force_remote") {
25929           return actionDeleteMultiple([id2])(graph);
25930         } else if (_option === "force_local") {
25931           if (target.type === "way") {
25932             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
25933             graph = updateChildren(updates, graph);
25934           }
25935           return graph.replace(target);
25936         } else {
25937           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
25938           return graph;
25939         }
25940       }
25941       if (target.type === "node") {
25942         target = mergeLocation(remote, target);
25943       } else if (target.type === "way") {
25944         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
25945         target = mergeNodes(base, remote, target);
25946         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
25947       } else if (target.type === "relation") {
25948         target = mergeMembers(remote, target);
25949       }
25950       target = mergeTags(base, remote, target);
25951       if (!_conflicts.length) {
25952         graph = updateChildren(updates, graph).replace(target);
25953       }
25954       return graph;
25955     };
25956     action.withOption = function(opt) {
25957       _option = opt;
25958       return action;
25959     };
25960     action.conflicts = function() {
25961       return _conflicts;
25962     };
25963     return action;
25964   }
25965   var import_fast_deep_equal, import_lodash;
25966   var init_merge_remote_changes = __esm({
25967     "modules/actions/merge_remote_changes.js"() {
25968       "use strict";
25969       import_fast_deep_equal = __toESM(require_fast_deep_equal());
25970       init_node_diff3();
25971       import_lodash = __toESM(require_lodash());
25972       init_localizer();
25973       init_delete_multiple();
25974       init_osm();
25975       init_util();
25976     }
25977   });
25978
25979   // modules/actions/move.js
25980   var move_exports = {};
25981   __export(move_exports, {
25982     actionMove: () => actionMove
25983   });
25984   function actionMove(moveIDs, tryDelta, projection2, cache) {
25985     var _delta = tryDelta;
25986     function setupCache(graph) {
25987       function canMove(nodeID) {
25988         if (moveIDs.indexOf(nodeID) !== -1) return true;
25989         var parents = graph.parentWays(graph.entity(nodeID));
25990         if (parents.length < 3) return true;
25991         var parentsMoving = parents.every(function(way) {
25992           return cache.moving[way.id];
25993         });
25994         if (!parentsMoving) delete cache.moving[nodeID];
25995         return parentsMoving;
25996       }
25997       function cacheEntities(ids) {
25998         for (var i3 = 0; i3 < ids.length; i3++) {
25999           var id2 = ids[i3];
26000           if (cache.moving[id2]) continue;
26001           cache.moving[id2] = true;
26002           var entity = graph.hasEntity(id2);
26003           if (!entity) continue;
26004           if (entity.type === "node") {
26005             cache.nodes.push(id2);
26006             cache.startLoc[id2] = entity.loc;
26007           } else if (entity.type === "way") {
26008             cache.ways.push(id2);
26009             cacheEntities(entity.nodes);
26010           } else {
26011             cacheEntities(entity.members.map(function(member) {
26012               return member.id;
26013             }));
26014           }
26015         }
26016       }
26017       function cacheIntersections(ids) {
26018         function isEndpoint(way2, id3) {
26019           return !way2.isClosed() && !!way2.affix(id3);
26020         }
26021         for (var i3 = 0; i3 < ids.length; i3++) {
26022           var id2 = ids[i3];
26023           var childNodes = graph.childNodes(graph.entity(id2));
26024           for (var j2 = 0; j2 < childNodes.length; j2++) {
26025             var node = childNodes[j2];
26026             var parents = graph.parentWays(node);
26027             if (parents.length !== 2) continue;
26028             var moved = graph.entity(id2);
26029             var unmoved = null;
26030             for (var k2 = 0; k2 < parents.length; k2++) {
26031               var way = parents[k2];
26032               if (!cache.moving[way.id]) {
26033                 unmoved = way;
26034                 break;
26035               }
26036             }
26037             if (!unmoved) continue;
26038             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
26039             if (moved.isArea() || unmoved.isArea()) continue;
26040             cache.intersections.push({
26041               nodeId: node.id,
26042               movedId: moved.id,
26043               unmovedId: unmoved.id,
26044               movedIsEP: isEndpoint(moved, node.id),
26045               unmovedIsEP: isEndpoint(unmoved, node.id)
26046             });
26047           }
26048         }
26049       }
26050       if (!cache) {
26051         cache = {};
26052       }
26053       if (!cache.ok) {
26054         cache.moving = {};
26055         cache.intersections = [];
26056         cache.replacedVertex = {};
26057         cache.startLoc = {};
26058         cache.nodes = [];
26059         cache.ways = [];
26060         cacheEntities(moveIDs);
26061         cacheIntersections(cache.ways);
26062         cache.nodes = cache.nodes.filter(canMove);
26063         cache.ok = true;
26064       }
26065     }
26066     function replaceMovedVertex(nodeId, wayId, graph, delta) {
26067       var way = graph.entity(wayId);
26068       var moved = graph.entity(nodeId);
26069       var movedIndex = way.nodes.indexOf(nodeId);
26070       var len, prevIndex, nextIndex;
26071       if (way.isClosed()) {
26072         len = way.nodes.length - 1;
26073         prevIndex = (movedIndex + len - 1) % len;
26074         nextIndex = (movedIndex + len + 1) % len;
26075       } else {
26076         len = way.nodes.length;
26077         prevIndex = movedIndex - 1;
26078         nextIndex = movedIndex + 1;
26079       }
26080       var prev = graph.hasEntity(way.nodes[prevIndex]);
26081       var next = graph.hasEntity(way.nodes[nextIndex]);
26082       if (!prev || !next) return graph;
26083       var key = wayId + "_" + nodeId;
26084       var orig = cache.replacedVertex[key];
26085       if (!orig) {
26086         orig = osmNode();
26087         cache.replacedVertex[key] = orig;
26088         cache.startLoc[orig.id] = cache.startLoc[nodeId];
26089       }
26090       var start2, end;
26091       if (delta) {
26092         start2 = projection2(cache.startLoc[nodeId]);
26093         end = projection2.invert(geoVecAdd(start2, delta));
26094       } else {
26095         end = cache.startLoc[nodeId];
26096       }
26097       orig = orig.move(end);
26098       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
26099       if (angle2 > 175 && angle2 < 185) return graph;
26100       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
26101       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
26102       var d1 = geoPathLength(p1);
26103       var d2 = geoPathLength(p2);
26104       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
26105       if (way.isClosed() && insertAt === 0) insertAt = len;
26106       way = way.addNode(orig.id, insertAt);
26107       return graph.replace(orig).replace(way);
26108     }
26109     function removeDuplicateVertices(wayId, graph) {
26110       var way = graph.entity(wayId);
26111       var epsilon3 = 1e-6;
26112       var prev, curr;
26113       function isInteresting(node, graph2) {
26114         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
26115       }
26116       for (var i3 = 0; i3 < way.nodes.length; i3++) {
26117         curr = graph.entity(way.nodes[i3]);
26118         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
26119           if (!isInteresting(prev, graph)) {
26120             way = way.removeNode(prev.id);
26121             graph = graph.replace(way).remove(prev);
26122           } else if (!isInteresting(curr, graph)) {
26123             way = way.removeNode(curr.id);
26124             graph = graph.replace(way).remove(curr);
26125           }
26126         }
26127         prev = curr;
26128       }
26129       return graph;
26130     }
26131     function unZorroIntersection(intersection2, graph) {
26132       var vertex = graph.entity(intersection2.nodeId);
26133       var way1 = graph.entity(intersection2.movedId);
26134       var way2 = graph.entity(intersection2.unmovedId);
26135       var isEP1 = intersection2.movedIsEP;
26136       var isEP2 = intersection2.unmovedIsEP;
26137       if (isEP1 && isEP2) return graph;
26138       var nodes1 = graph.childNodes(way1).filter(function(n3) {
26139         return n3 !== vertex;
26140       });
26141       var nodes2 = graph.childNodes(way2).filter(function(n3) {
26142         return n3 !== vertex;
26143       });
26144       if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
26145       if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
26146       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
26147       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
26148       var loc;
26149       if (!isEP1 && !isEP2) {
26150         var epsilon3 = 1e-6, maxIter = 10;
26151         for (var i3 = 0; i3 < maxIter; i3++) {
26152           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
26153           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
26154           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
26155           if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
26156         }
26157       } else if (!isEP1) {
26158         loc = edge1.loc;
26159       } else {
26160         loc = edge2.loc;
26161       }
26162       graph = graph.replace(vertex.move(loc));
26163       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
26164         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
26165         graph = graph.replace(way1);
26166       }
26167       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
26168         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
26169         graph = graph.replace(way2);
26170       }
26171       return graph;
26172     }
26173     function cleanupIntersections(graph) {
26174       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
26175         var obj = cache.intersections[i3];
26176         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
26177         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
26178         graph = unZorroIntersection(obj, graph);
26179         graph = removeDuplicateVertices(obj.movedId, graph);
26180         graph = removeDuplicateVertices(obj.unmovedId, graph);
26181       }
26182       return graph;
26183     }
26184     function limitDelta(graph) {
26185       function moveNode(loc) {
26186         return geoVecAdd(projection2(loc), _delta);
26187       }
26188       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
26189         var obj = cache.intersections[i3];
26190         if (obj.movedIsEP && obj.unmovedIsEP) continue;
26191         if (!obj.movedIsEP) continue;
26192         var node = graph.entity(obj.nodeId);
26193         var start2 = projection2(node.loc);
26194         var end = geoVecAdd(start2, _delta);
26195         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
26196         var movedPath = movedNodes.map(function(n3) {
26197           return moveNode(n3.loc);
26198         });
26199         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
26200         var unmovedPath = unmovedNodes.map(function(n3) {
26201           return projection2(n3.loc);
26202         });
26203         var hits = geoPathIntersections(movedPath, unmovedPath);
26204         for (var j2 = 0; i3 < hits.length; i3++) {
26205           if (geoVecEqual(hits[j2], end)) continue;
26206           var edge = geoChooseEdge(unmovedNodes, end, projection2);
26207           _delta = geoVecSubtract(projection2(edge.loc), start2);
26208         }
26209       }
26210     }
26211     var action = function(graph) {
26212       if (_delta[0] === 0 && _delta[1] === 0) return graph;
26213       setupCache(graph);
26214       if (cache.intersections.length) {
26215         limitDelta(graph);
26216       }
26217       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
26218         var node = graph.entity(cache.nodes[i3]);
26219         var start2 = projection2(node.loc);
26220         var end = geoVecAdd(start2, _delta);
26221         graph = graph.replace(node.move(projection2.invert(end)));
26222       }
26223       if (cache.intersections.length) {
26224         graph = cleanupIntersections(graph);
26225       }
26226       return graph;
26227     };
26228     action.delta = function() {
26229       return _delta;
26230     };
26231     return action;
26232   }
26233   var init_move = __esm({
26234     "modules/actions/move.js"() {
26235       "use strict";
26236       init_geo2();
26237       init_node2();
26238       init_util();
26239     }
26240   });
26241
26242   // modules/actions/move_member.js
26243   var move_member_exports = {};
26244   __export(move_member_exports, {
26245     actionMoveMember: () => actionMoveMember
26246   });
26247   function actionMoveMember(relationId, fromIndex, toIndex) {
26248     return function(graph) {
26249       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
26250     };
26251   }
26252   var init_move_member = __esm({
26253     "modules/actions/move_member.js"() {
26254       "use strict";
26255     }
26256   });
26257
26258   // modules/actions/move_node.js
26259   var move_node_exports = {};
26260   __export(move_node_exports, {
26261     actionMoveNode: () => actionMoveNode
26262   });
26263   function actionMoveNode(nodeID, toLoc) {
26264     var action = function(graph, t2) {
26265       if (t2 === null || !isFinite(t2)) t2 = 1;
26266       t2 = Math.min(Math.max(+t2, 0), 1);
26267       var node = graph.entity(nodeID);
26268       return graph.replace(
26269         node.move(geoVecInterp(node.loc, toLoc, t2))
26270       );
26271     };
26272     action.transitionable = true;
26273     return action;
26274   }
26275   var init_move_node = __esm({
26276     "modules/actions/move_node.js"() {
26277       "use strict";
26278       init_geo2();
26279     }
26280   });
26281
26282   // modules/actions/noop.js
26283   var noop_exports = {};
26284   __export(noop_exports, {
26285     actionNoop: () => actionNoop
26286   });
26287   function actionNoop() {
26288     return function(graph) {
26289       return graph;
26290     };
26291   }
26292   var init_noop2 = __esm({
26293     "modules/actions/noop.js"() {
26294       "use strict";
26295     }
26296   });
26297
26298   // modules/actions/orthogonalize.js
26299   var orthogonalize_exports = {};
26300   __export(orthogonalize_exports, {
26301     actionOrthogonalize: () => actionOrthogonalize
26302   });
26303   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
26304     var epsilon3 = ep || 1e-4;
26305     var threshold = degThresh || 13;
26306     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
26307     var upperThreshold = Math.cos(threshold * Math.PI / 180);
26308     var action = function(graph, t2) {
26309       if (t2 === null || !isFinite(t2)) t2 = 1;
26310       t2 = Math.min(Math.max(+t2, 0), 1);
26311       var way = graph.entity(wayID);
26312       way = way.removeNode("");
26313       if (way.tags.nonsquare) {
26314         var tags = Object.assign({}, way.tags);
26315         delete tags.nonsquare;
26316         way = way.update({ tags });
26317       }
26318       graph = graph.replace(way);
26319       var isClosed = way.isClosed();
26320       var nodes = graph.childNodes(way).slice();
26321       if (isClosed) nodes.pop();
26322       if (vertexID !== void 0) {
26323         nodes = nodeSubset(nodes, vertexID, isClosed);
26324         if (nodes.length !== 3) return graph;
26325       }
26326       var nodeCount = {};
26327       var points = [];
26328       var corner = { i: 0, dotp: 1 };
26329       var node, point, loc, score, motions, i3, j2;
26330       for (i3 = 0; i3 < nodes.length; i3++) {
26331         node = nodes[i3];
26332         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
26333         points.push({ id: node.id, coord: projection2(node.loc) });
26334       }
26335       if (points.length === 3) {
26336         for (i3 = 0; i3 < 1e3; i3++) {
26337           const motion = calcMotion(points[1], 1, points);
26338           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motion);
26339           score = corner.dotp;
26340           if (score < epsilon3) {
26341             break;
26342           }
26343         }
26344         node = graph.entity(nodes[corner.i].id);
26345         loc = projection2.invert(points[corner.i].coord);
26346         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26347       } else {
26348         var straights = [];
26349         var simplified = [];
26350         for (i3 = 0; i3 < points.length; i3++) {
26351           point = points[i3];
26352           var dotp = 0;
26353           if (isClosed || i3 > 0 && i3 < points.length - 1) {
26354             var a2 = points[(i3 - 1 + points.length) % points.length];
26355             var b2 = points[(i3 + 1) % points.length];
26356             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point.coord));
26357           }
26358           if (dotp > upperThreshold) {
26359             straights.push(point);
26360           } else {
26361             simplified.push(point);
26362           }
26363         }
26364         var bestPoints = clonePoints(simplified);
26365         var originalPoints = clonePoints(simplified);
26366         score = Infinity;
26367         for (i3 = 0; i3 < 1e3; i3++) {
26368           motions = simplified.map(calcMotion);
26369           for (j2 = 0; j2 < motions.length; j2++) {
26370             simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
26371           }
26372           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
26373           if (newScore < score) {
26374             bestPoints = clonePoints(simplified);
26375             score = newScore;
26376           }
26377           if (score < epsilon3) {
26378             break;
26379           }
26380         }
26381         var bestCoords = bestPoints.map(function(p2) {
26382           return p2.coord;
26383         });
26384         if (isClosed) bestCoords.push(bestCoords[0]);
26385         for (i3 = 0; i3 < bestPoints.length; i3++) {
26386           point = bestPoints[i3];
26387           if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
26388             node = graph.entity(point.id);
26389             loc = projection2.invert(point.coord);
26390             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26391           }
26392         }
26393         for (i3 = 0; i3 < straights.length; i3++) {
26394           point = straights[i3];
26395           if (nodeCount[point.id] > 1) continue;
26396           node = graph.entity(point.id);
26397           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
26398             graph = actionDeleteNode(node.id)(graph);
26399           } else {
26400             var choice = geoVecProject(point.coord, bestCoords);
26401             if (choice) {
26402               loc = projection2.invert(choice.target);
26403               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
26404             }
26405           }
26406         }
26407       }
26408       return graph;
26409       function clonePoints(array2) {
26410         return array2.map(function(p2) {
26411           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
26412         });
26413       }
26414       function calcMotion(point2, i4, array2) {
26415         if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
26416         if (nodeCount[array2[i4].id] > 1) return [0, 0];
26417         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
26418         var origin = point2.coord;
26419         var b3 = array2[(i4 + 1) % array2.length].coord;
26420         var p2 = geoVecSubtract(a3, origin);
26421         var q2 = geoVecSubtract(b3, origin);
26422         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
26423         p2 = geoVecNormalize(p2);
26424         q2 = geoVecNormalize(q2);
26425         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
26426         var val = Math.abs(dotp2);
26427         if (val < lowerThreshold) {
26428           corner.i = i4;
26429           corner.dotp = val;
26430           var vec = geoVecNormalize(geoVecAdd(p2, q2));
26431           return geoVecScale(vec, 0.1 * dotp2 * scale);
26432         }
26433         return [0, 0];
26434       }
26435     };
26436     function nodeSubset(nodes, vertexID2, isClosed) {
26437       var first = isClosed ? 0 : 1;
26438       var last = isClosed ? nodes.length : nodes.length - 1;
26439       for (var i3 = first; i3 < last; i3++) {
26440         if (nodes[i3].id === vertexID2) {
26441           return [
26442             nodes[(i3 - 1 + nodes.length) % nodes.length],
26443             nodes[i3],
26444             nodes[(i3 + 1) % nodes.length]
26445           ];
26446         }
26447       }
26448       return [];
26449     }
26450     action.disabled = function(graph) {
26451       var way = graph.entity(wayID);
26452       way = way.removeNode("");
26453       graph = graph.replace(way);
26454       const isClosed = way.isClosed() && vertexID === void 0;
26455       var nodes = graph.childNodes(way).slice();
26456       if (isClosed) nodes.pop();
26457       var allowStraightAngles = false;
26458       if (vertexID !== void 0) {
26459         allowStraightAngles = true;
26460         nodes = nodeSubset(nodes, vertexID, isClosed);
26461         if (nodes.length !== 3) return "end_vertex";
26462       }
26463       var coords = nodes.map(function(n3) {
26464         return projection2(n3.loc);
26465       });
26466       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
26467       if (score === null) {
26468         return "not_squarish";
26469       } else if (score === 0) {
26470         return "square_enough";
26471       } else {
26472         return false;
26473       }
26474     };
26475     action.transitionable = true;
26476     return action;
26477   }
26478   var init_orthogonalize = __esm({
26479     "modules/actions/orthogonalize.js"() {
26480       "use strict";
26481       init_delete_node();
26482       init_geo2();
26483     }
26484   });
26485
26486   // modules/actions/reflect.js
26487   var reflect_exports = {};
26488   __export(reflect_exports, {
26489     actionReflect: () => actionReflect
26490   });
26491   function actionReflect(reflectIds, projection2) {
26492     var _useLongAxis = true;
26493     var action = function(graph, t2) {
26494       if (t2 === null || !isFinite(t2)) t2 = 1;
26495       t2 = Math.min(Math.max(+t2, 0), 1);
26496       var nodes = utilGetAllNodes(reflectIds, graph);
26497       var points = nodes.map(function(n3) {
26498         return projection2(n3.loc);
26499       });
26500       var ssr = geoGetSmallestSurroundingRectangle(points);
26501       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
26502       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
26503       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
26504       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
26505       var p3, q3;
26506       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
26507       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
26508         p3 = p1;
26509         q3 = q1;
26510       } else {
26511         p3 = p2;
26512         q3 = q2;
26513       }
26514       var dx = q3[0] - p3[0];
26515       var dy = q3[1] - p3[1];
26516       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
26517       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
26518       for (var i3 = 0; i3 < nodes.length; i3++) {
26519         var node = nodes[i3];
26520         var c2 = projection2(node.loc);
26521         var c22 = [
26522           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
26523           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
26524         ];
26525         var loc2 = projection2.invert(c22);
26526         node = node.move(geoVecInterp(node.loc, loc2, t2));
26527         graph = graph.replace(node);
26528       }
26529       return graph;
26530     };
26531     action.useLongAxis = function(val) {
26532       if (!arguments.length) return _useLongAxis;
26533       _useLongAxis = val;
26534       return action;
26535     };
26536     action.transitionable = true;
26537     return action;
26538   }
26539   var init_reflect = __esm({
26540     "modules/actions/reflect.js"() {
26541       "use strict";
26542       init_geo2();
26543       init_util();
26544     }
26545   });
26546
26547   // modules/actions/restrict_turn.js
26548   var restrict_turn_exports = {};
26549   __export(restrict_turn_exports, {
26550     actionRestrictTurn: () => actionRestrictTurn
26551   });
26552   function actionRestrictTurn(turn, restrictionType, restrictionID) {
26553     return function(graph) {
26554       var fromWay = graph.entity(turn.from.way);
26555       var toWay = graph.entity(turn.to.way);
26556       var viaNode = turn.via.node && graph.entity(turn.via.node);
26557       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
26558         return graph.entity(id2);
26559       });
26560       var members = [];
26561       members.push({ id: fromWay.id, type: "way", role: "from" });
26562       if (viaNode) {
26563         members.push({ id: viaNode.id, type: "node", role: "via" });
26564       } else if (viaWays) {
26565         viaWays.forEach(function(viaWay) {
26566           members.push({ id: viaWay.id, type: "way", role: "via" });
26567         });
26568       }
26569       members.push({ id: toWay.id, type: "way", role: "to" });
26570       return graph.replace(osmRelation({
26571         id: restrictionID,
26572         tags: {
26573           type: "restriction",
26574           restriction: restrictionType
26575         },
26576         members
26577       }));
26578     };
26579   }
26580   var init_restrict_turn = __esm({
26581     "modules/actions/restrict_turn.js"() {
26582       "use strict";
26583       init_relation();
26584     }
26585   });
26586
26587   // modules/actions/revert.js
26588   var revert_exports = {};
26589   __export(revert_exports, {
26590     actionRevert: () => actionRevert
26591   });
26592   function actionRevert(id2) {
26593     var action = function(graph) {
26594       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
26595       if (entity && !base) {
26596         if (entity.type === "node") {
26597           graph.parentWays(entity).forEach(function(parent) {
26598             parent = parent.removeNode(id2);
26599             graph = graph.replace(parent);
26600             if (parent.isDegenerate()) {
26601               graph = actionDeleteWay(parent.id)(graph);
26602             }
26603           });
26604         }
26605         graph.parentRelations(entity).forEach(function(parent) {
26606           parent = parent.removeMembersWithID(id2);
26607           graph = graph.replace(parent);
26608           if (parent.isDegenerate()) {
26609             graph = actionDeleteRelation(parent.id)(graph);
26610           }
26611         });
26612       }
26613       return graph.revert(id2);
26614     };
26615     return action;
26616   }
26617   var init_revert = __esm({
26618     "modules/actions/revert.js"() {
26619       "use strict";
26620       init_delete_relation();
26621       init_delete_way();
26622     }
26623   });
26624
26625   // modules/actions/rotate.js
26626   var rotate_exports = {};
26627   __export(rotate_exports, {
26628     actionRotate: () => actionRotate
26629   });
26630   function actionRotate(rotateIds, pivot, angle2, projection2) {
26631     var action = function(graph) {
26632       return graph.update(function(graph2) {
26633         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
26634           var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
26635           graph2 = graph2.replace(node.move(projection2.invert(point)));
26636         });
26637       });
26638     };
26639     return action;
26640   }
26641   var init_rotate = __esm({
26642     "modules/actions/rotate.js"() {
26643       "use strict";
26644       init_geo2();
26645       init_util();
26646     }
26647   });
26648
26649   // modules/actions/scale.js
26650   var scale_exports = {};
26651   __export(scale_exports, {
26652     actionScale: () => actionScale
26653   });
26654   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
26655     return function(graph) {
26656       return graph.update(function(graph2) {
26657         let point, radial;
26658         utilGetAllNodes(ids, graph2).forEach(function(node) {
26659           point = projection2(node.loc);
26660           radial = [
26661             point[0] - pivotLoc[0],
26662             point[1] - pivotLoc[1]
26663           ];
26664           point = [
26665             pivotLoc[0] + scaleFactor * radial[0],
26666             pivotLoc[1] + scaleFactor * radial[1]
26667           ];
26668           graph2 = graph2.replace(node.move(projection2.invert(point)));
26669         });
26670       });
26671     };
26672   }
26673   var init_scale = __esm({
26674     "modules/actions/scale.js"() {
26675       "use strict";
26676       init_util();
26677     }
26678   });
26679
26680   // modules/actions/straighten_nodes.js
26681   var straighten_nodes_exports = {};
26682   __export(straighten_nodes_exports, {
26683     actionStraightenNodes: () => actionStraightenNodes
26684   });
26685   function actionStraightenNodes(nodeIDs, projection2) {
26686     function positionAlongWay(a2, o2, b2) {
26687       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
26688     }
26689     function getEndpoints(points) {
26690       var ssr = geoGetSmallestSurroundingRectangle(points);
26691       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
26692       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
26693       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
26694       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
26695       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
26696       if (isLong) {
26697         return [p1, q1];
26698       }
26699       return [p2, q2];
26700     }
26701     var action = function(graph, t2) {
26702       if (t2 === null || !isFinite(t2)) t2 = 1;
26703       t2 = Math.min(Math.max(+t2, 0), 1);
26704       var nodes = nodeIDs.map(function(id2) {
26705         return graph.entity(id2);
26706       });
26707       var points = nodes.map(function(n3) {
26708         return projection2(n3.loc);
26709       });
26710       var endpoints = getEndpoints(points);
26711       var startPoint = endpoints[0];
26712       var endPoint = endpoints[1];
26713       for (var i3 = 0; i3 < points.length; i3++) {
26714         var node = nodes[i3];
26715         var point = points[i3];
26716         var u2 = positionAlongWay(point, startPoint, endPoint);
26717         var point2 = geoVecInterp(startPoint, endPoint, u2);
26718         var loc2 = projection2.invert(point2);
26719         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
26720       }
26721       return graph;
26722     };
26723     action.disabled = function(graph) {
26724       var nodes = nodeIDs.map(function(id2) {
26725         return graph.entity(id2);
26726       });
26727       var points = nodes.map(function(n3) {
26728         return projection2(n3.loc);
26729       });
26730       var endpoints = getEndpoints(points);
26731       var startPoint = endpoints[0];
26732       var endPoint = endpoints[1];
26733       var maxDistance = 0;
26734       for (var i3 = 0; i3 < points.length; i3++) {
26735         var point = points[i3];
26736         var u2 = positionAlongWay(point, startPoint, endPoint);
26737         var p2 = geoVecInterp(startPoint, endPoint, u2);
26738         var dist = geoVecLength(p2, point);
26739         if (!isNaN(dist) && dist > maxDistance) {
26740           maxDistance = dist;
26741         }
26742       }
26743       if (maxDistance < 1e-4) {
26744         return "straight_enough";
26745       }
26746     };
26747     action.transitionable = true;
26748     return action;
26749   }
26750   var init_straighten_nodes = __esm({
26751     "modules/actions/straighten_nodes.js"() {
26752       "use strict";
26753       init_geo2();
26754     }
26755   });
26756
26757   // modules/actions/straighten_way.js
26758   var straighten_way_exports = {};
26759   __export(straighten_way_exports, {
26760     actionStraightenWay: () => actionStraightenWay
26761   });
26762   function actionStraightenWay(selectedIDs, projection2) {
26763     function positionAlongWay(a2, o2, b2) {
26764       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
26765     }
26766     function allNodes(graph) {
26767       var nodes = [];
26768       var startNodes = [];
26769       var endNodes = [];
26770       var remainingWays = [];
26771       var selectedWays = selectedIDs.filter(function(w2) {
26772         return graph.entity(w2).type === "way";
26773       });
26774       var selectedNodes = selectedIDs.filter(function(n3) {
26775         return graph.entity(n3).type === "node";
26776       });
26777       for (var i3 = 0; i3 < selectedWays.length; i3++) {
26778         var way = graph.entity(selectedWays[i3]);
26779         nodes = way.nodes.slice(0);
26780         remainingWays.push(nodes);
26781         startNodes.push(nodes[0]);
26782         endNodes.push(nodes[nodes.length - 1]);
26783       }
26784       startNodes = startNodes.filter(function(n3) {
26785         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
26786       });
26787       endNodes = endNodes.filter(function(n3) {
26788         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
26789       });
26790       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
26791       var nextWay = [];
26792       nodes = [];
26793       var getNextWay = function(currNode2, remainingWays2) {
26794         return remainingWays2.filter(function(way2) {
26795           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
26796         })[0];
26797       };
26798       while (remainingWays.length) {
26799         nextWay = getNextWay(currNode, remainingWays);
26800         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
26801         if (nextWay[0] !== currNode) {
26802           nextWay.reverse();
26803         }
26804         nodes = nodes.concat(nextWay);
26805         currNode = nodes[nodes.length - 1];
26806       }
26807       if (selectedNodes.length === 2) {
26808         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
26809         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
26810         var sortedStartEnd = [startNodeIdx, endNodeIdx];
26811         sortedStartEnd.sort(function(a2, b2) {
26812           return a2 - b2;
26813         });
26814         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
26815       }
26816       return nodes.map(function(n3) {
26817         return graph.entity(n3);
26818       });
26819     }
26820     function shouldKeepNode(node, graph) {
26821       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
26822     }
26823     var action = function(graph, t2) {
26824       if (t2 === null || !isFinite(t2)) t2 = 1;
26825       t2 = Math.min(Math.max(+t2, 0), 1);
26826       var nodes = allNodes(graph);
26827       var points = nodes.map(function(n3) {
26828         return projection2(n3.loc);
26829       });
26830       var startPoint = points[0];
26831       var endPoint = points[points.length - 1];
26832       var toDelete = [];
26833       var i3;
26834       for (i3 = 1; i3 < points.length - 1; i3++) {
26835         var node = nodes[i3];
26836         var point = points[i3];
26837         if (t2 < 1 || shouldKeepNode(node, graph)) {
26838           var u2 = positionAlongWay(point, startPoint, endPoint);
26839           var p2 = geoVecInterp(startPoint, endPoint, u2);
26840           var loc2 = projection2.invert(p2);
26841           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
26842         } else {
26843           if (toDelete.indexOf(node) === -1) {
26844             toDelete.push(node);
26845           }
26846         }
26847       }
26848       for (i3 = 0; i3 < toDelete.length; i3++) {
26849         graph = actionDeleteNode(toDelete[i3].id)(graph);
26850       }
26851       return graph;
26852     };
26853     action.disabled = function(graph) {
26854       var nodes = allNodes(graph);
26855       var points = nodes.map(function(n3) {
26856         return projection2(n3.loc);
26857       });
26858       var startPoint = points[0];
26859       var endPoint = points[points.length - 1];
26860       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
26861       var i3;
26862       if (threshold === 0) {
26863         return "too_bendy";
26864       }
26865       var maxDistance = 0;
26866       for (i3 = 1; i3 < points.length - 1; i3++) {
26867         var point = points[i3];
26868         var u2 = positionAlongWay(point, startPoint, endPoint);
26869         var p2 = geoVecInterp(startPoint, endPoint, u2);
26870         var dist = geoVecLength(p2, point);
26871         if (isNaN(dist) || dist > threshold) {
26872           return "too_bendy";
26873         } else if (dist > maxDistance) {
26874           maxDistance = dist;
26875         }
26876       }
26877       var keepingAllNodes = nodes.every(function(node, i4) {
26878         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
26879       });
26880       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
26881       keepingAllNodes) {
26882         return "straight_enough";
26883       }
26884     };
26885     action.transitionable = true;
26886     return action;
26887   }
26888   var init_straighten_way = __esm({
26889     "modules/actions/straighten_way.js"() {
26890       "use strict";
26891       init_delete_node();
26892       init_geo2();
26893       init_util();
26894     }
26895   });
26896
26897   // modules/actions/unrestrict_turn.js
26898   var unrestrict_turn_exports = {};
26899   __export(unrestrict_turn_exports, {
26900     actionUnrestrictTurn: () => actionUnrestrictTurn
26901   });
26902   function actionUnrestrictTurn(turn) {
26903     return function(graph) {
26904       return actionDeleteRelation(turn.restrictionID)(graph);
26905     };
26906   }
26907   var init_unrestrict_turn = __esm({
26908     "modules/actions/unrestrict_turn.js"() {
26909       "use strict";
26910       init_delete_relation();
26911     }
26912   });
26913
26914   // modules/actions/upgrade_tags.js
26915   var upgrade_tags_exports = {};
26916   __export(upgrade_tags_exports, {
26917     actionUpgradeTags: () => actionUpgradeTags
26918   });
26919   function actionUpgradeTags(entityId, oldTags, replaceTags) {
26920     return function(graph) {
26921       var entity = graph.entity(entityId);
26922       var tags = Object.assign({}, entity.tags);
26923       var transferValue;
26924       var semiIndex;
26925       for (var oldTagKey in oldTags) {
26926         if (!(oldTagKey in tags)) continue;
26927         if (oldTags[oldTagKey] === "*") {
26928           transferValue = tags[oldTagKey];
26929           delete tags[oldTagKey];
26930         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
26931           delete tags[oldTagKey];
26932         } else {
26933           var vals = tags[oldTagKey].split(";").filter(Boolean);
26934           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
26935           if (vals.length === 1 || oldIndex === -1) {
26936             delete tags[oldTagKey];
26937           } else {
26938             if (replaceTags && replaceTags[oldTagKey]) {
26939               semiIndex = oldIndex;
26940             }
26941             vals.splice(oldIndex, 1);
26942             tags[oldTagKey] = vals.join(";");
26943           }
26944         }
26945       }
26946       if (replaceTags) {
26947         for (var replaceKey in replaceTags) {
26948           var replaceValue = replaceTags[replaceKey];
26949           if (replaceValue === "*") {
26950             if (tags[replaceKey] && tags[replaceKey] !== "no") {
26951               continue;
26952             } else {
26953               tags[replaceKey] = "yes";
26954             }
26955           } else if (replaceValue === "$1") {
26956             tags[replaceKey] = transferValue;
26957           } else {
26958             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
26959               var existingVals = tags[replaceKey].split(";").filter(Boolean);
26960               if (existingVals.indexOf(replaceValue) === -1) {
26961                 existingVals.splice(semiIndex, 0, replaceValue);
26962                 tags[replaceKey] = existingVals.join(";");
26963               }
26964             } else {
26965               tags[replaceKey] = replaceValue;
26966             }
26967           }
26968         }
26969       }
26970       return graph.replace(entity.update({ tags }));
26971     };
26972   }
26973   var init_upgrade_tags = __esm({
26974     "modules/actions/upgrade_tags.js"() {
26975       "use strict";
26976     }
26977   });
26978
26979   // modules/core/preferences.js
26980   var preferences_exports = {};
26981   __export(preferences_exports, {
26982     prefs: () => corePreferences
26983   });
26984   function corePreferences(k2, v2) {
26985     try {
26986       if (v2 === void 0) return _storage.getItem(k2);
26987       else if (v2 === null) _storage.removeItem(k2);
26988       else _storage.setItem(k2, v2);
26989       if (_listeners[k2]) {
26990         _listeners[k2].forEach((handler) => handler(v2));
26991       }
26992       return true;
26993     } catch {
26994       if (typeof console !== "undefined") {
26995         console.error("localStorage quota exceeded");
26996       }
26997       return false;
26998     }
26999   }
27000   var _storage, _listeners;
27001   var init_preferences = __esm({
27002     "modules/core/preferences.js"() {
27003       "use strict";
27004       try {
27005         _storage = localStorage;
27006       } catch {
27007       }
27008       _storage = _storage || /* @__PURE__ */ (() => {
27009         let s2 = {};
27010         return {
27011           getItem: (k2) => s2[k2],
27012           setItem: (k2, v2) => s2[k2] = v2,
27013           removeItem: (k2) => delete s2[k2]
27014         };
27015       })();
27016       _listeners = {};
27017       corePreferences.onChange = function(k2, handler) {
27018         _listeners[k2] = _listeners[k2] || [];
27019         _listeners[k2].push(handler);
27020       };
27021     }
27022   });
27023
27024   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
27025   var require_quickselect = __commonJS({
27026     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
27027       (function(global2, factory) {
27028         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
27029       })(exports2, function() {
27030         "use strict";
27031         function quickselect3(arr, k2, left, right, compare2) {
27032           quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
27033         }
27034         function quickselectStep(arr, k2, left, right, compare2) {
27035           while (right > left) {
27036             if (right - left > 600) {
27037               var n3 = right - left + 1;
27038               var m2 = k2 - left + 1;
27039               var z2 = Math.log(n3);
27040               var s2 = 0.5 * Math.exp(2 * z2 / 3);
27041               var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
27042               var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
27043               var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
27044               quickselectStep(arr, k2, newLeft, newRight, compare2);
27045             }
27046             var t2 = arr[k2];
27047             var i3 = left;
27048             var j2 = right;
27049             swap3(arr, left, k2);
27050             if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
27051             while (i3 < j2) {
27052               swap3(arr, i3, j2);
27053               i3++;
27054               j2--;
27055               while (compare2(arr[i3], t2) < 0) i3++;
27056               while (compare2(arr[j2], t2) > 0) j2--;
27057             }
27058             if (compare2(arr[left], t2) === 0) swap3(arr, left, j2);
27059             else {
27060               j2++;
27061               swap3(arr, j2, right);
27062             }
27063             if (j2 <= k2) left = j2 + 1;
27064             if (k2 <= j2) right = j2 - 1;
27065           }
27066         }
27067         function swap3(arr, i3, j2) {
27068           var tmp = arr[i3];
27069           arr[i3] = arr[j2];
27070           arr[j2] = tmp;
27071         }
27072         function defaultCompare2(a2, b2) {
27073           return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
27074         }
27075         return quickselect3;
27076       });
27077     }
27078   });
27079
27080   // node_modules/which-polygon/node_modules/rbush/index.js
27081   var require_rbush = __commonJS({
27082     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
27083       "use strict";
27084       module2.exports = rbush;
27085       module2.exports.default = rbush;
27086       var quickselect3 = require_quickselect();
27087       function rbush(maxEntries, format2) {
27088         if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
27089         this._maxEntries = Math.max(4, maxEntries || 9);
27090         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
27091         if (format2) {
27092           this._initFormat(format2);
27093         }
27094         this.clear();
27095       }
27096       rbush.prototype = {
27097         all: function() {
27098           return this._all(this.data, []);
27099         },
27100         search: function(bbox2) {
27101           var node = this.data, result = [], toBBox = this.toBBox;
27102           if (!intersects2(bbox2, node)) return result;
27103           var nodesToSearch = [], i3, len, child, childBBox;
27104           while (node) {
27105             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27106               child = node.children[i3];
27107               childBBox = node.leaf ? toBBox(child) : child;
27108               if (intersects2(bbox2, childBBox)) {
27109                 if (node.leaf) result.push(child);
27110                 else if (contains2(bbox2, childBBox)) this._all(child, result);
27111                 else nodesToSearch.push(child);
27112               }
27113             }
27114             node = nodesToSearch.pop();
27115           }
27116           return result;
27117         },
27118         collides: function(bbox2) {
27119           var node = this.data, toBBox = this.toBBox;
27120           if (!intersects2(bbox2, node)) return false;
27121           var nodesToSearch = [], i3, len, child, childBBox;
27122           while (node) {
27123             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27124               child = node.children[i3];
27125               childBBox = node.leaf ? toBBox(child) : child;
27126               if (intersects2(bbox2, childBBox)) {
27127                 if (node.leaf || contains2(bbox2, childBBox)) return true;
27128                 nodesToSearch.push(child);
27129               }
27130             }
27131             node = nodesToSearch.pop();
27132           }
27133           return false;
27134         },
27135         load: function(data) {
27136           if (!(data && data.length)) return this;
27137           if (data.length < this._minEntries) {
27138             for (var i3 = 0, len = data.length; i3 < len; i3++) {
27139               this.insert(data[i3]);
27140             }
27141             return this;
27142           }
27143           var node = this._build(data.slice(), 0, data.length - 1, 0);
27144           if (!this.data.children.length) {
27145             this.data = node;
27146           } else if (this.data.height === node.height) {
27147             this._splitRoot(this.data, node);
27148           } else {
27149             if (this.data.height < node.height) {
27150               var tmpNode = this.data;
27151               this.data = node;
27152               node = tmpNode;
27153             }
27154             this._insert(node, this.data.height - node.height - 1, true);
27155           }
27156           return this;
27157         },
27158         insert: function(item) {
27159           if (item) this._insert(item, this.data.height - 1);
27160           return this;
27161         },
27162         clear: function() {
27163           this.data = createNode2([]);
27164           return this;
27165         },
27166         remove: function(item, equalsFn) {
27167           if (!item) return this;
27168           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
27169           while (node || path.length) {
27170             if (!node) {
27171               node = path.pop();
27172               parent = path[path.length - 1];
27173               i3 = indexes.pop();
27174               goingUp = true;
27175             }
27176             if (node.leaf) {
27177               index = findItem2(item, node.children, equalsFn);
27178               if (index !== -1) {
27179                 node.children.splice(index, 1);
27180                 path.push(node);
27181                 this._condense(path);
27182                 return this;
27183               }
27184             }
27185             if (!goingUp && !node.leaf && contains2(node, bbox2)) {
27186               path.push(node);
27187               indexes.push(i3);
27188               i3 = 0;
27189               parent = node;
27190               node = node.children[0];
27191             } else if (parent) {
27192               i3++;
27193               node = parent.children[i3];
27194               goingUp = false;
27195             } else node = null;
27196           }
27197           return this;
27198         },
27199         toBBox: function(item) {
27200           return item;
27201         },
27202         compareMinX: compareNodeMinX2,
27203         compareMinY: compareNodeMinY2,
27204         toJSON: function() {
27205           return this.data;
27206         },
27207         fromJSON: function(data) {
27208           this.data = data;
27209           return this;
27210         },
27211         _all: function(node, result) {
27212           var nodesToSearch = [];
27213           while (node) {
27214             if (node.leaf) result.push.apply(result, node.children);
27215             else nodesToSearch.push.apply(nodesToSearch, node.children);
27216             node = nodesToSearch.pop();
27217           }
27218           return result;
27219         },
27220         _build: function(items, left, right, height) {
27221           var N2 = right - left + 1, M2 = this._maxEntries, node;
27222           if (N2 <= M2) {
27223             node = createNode2(items.slice(left, right + 1));
27224             calcBBox2(node, this.toBBox);
27225             return node;
27226           }
27227           if (!height) {
27228             height = Math.ceil(Math.log(N2) / Math.log(M2));
27229             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
27230           }
27231           node = createNode2([]);
27232           node.leaf = false;
27233           node.height = height;
27234           var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j2, right2, right3;
27235           multiSelect2(items, left, right, N1, this.compareMinX);
27236           for (i3 = left; i3 <= right; i3 += N1) {
27237             right2 = Math.min(i3 + N1 - 1, right);
27238             multiSelect2(items, i3, right2, N22, this.compareMinY);
27239             for (j2 = i3; j2 <= right2; j2 += N22) {
27240               right3 = Math.min(j2 + N22 - 1, right2);
27241               node.children.push(this._build(items, j2, right3, height - 1));
27242             }
27243           }
27244           calcBBox2(node, this.toBBox);
27245           return node;
27246         },
27247         _chooseSubtree: function(bbox2, node, level, path) {
27248           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
27249           while (true) {
27250             path.push(node);
27251             if (node.leaf || path.length - 1 === level) break;
27252             minArea = minEnlargement = Infinity;
27253             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
27254               child = node.children[i3];
27255               area = bboxArea2(child);
27256               enlargement = enlargedArea2(bbox2, child) - area;
27257               if (enlargement < minEnlargement) {
27258                 minEnlargement = enlargement;
27259                 minArea = area < minArea ? area : minArea;
27260                 targetNode = child;
27261               } else if (enlargement === minEnlargement) {
27262                 if (area < minArea) {
27263                   minArea = area;
27264                   targetNode = child;
27265                 }
27266               }
27267             }
27268             node = targetNode || node.children[0];
27269           }
27270           return node;
27271         },
27272         _insert: function(item, level, isNode) {
27273           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
27274           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
27275           node.children.push(item);
27276           extend3(node, bbox2);
27277           while (level >= 0) {
27278             if (insertPath[level].children.length > this._maxEntries) {
27279               this._split(insertPath, level);
27280               level--;
27281             } else break;
27282           }
27283           this._adjustParentBBoxes(bbox2, insertPath, level);
27284         },
27285         // split overflowed node into two
27286         _split: function(insertPath, level) {
27287           var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
27288           this._chooseSplitAxis(node, m2, M2);
27289           var splitIndex = this._chooseSplitIndex(node, m2, M2);
27290           var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
27291           newNode.height = node.height;
27292           newNode.leaf = node.leaf;
27293           calcBBox2(node, this.toBBox);
27294           calcBBox2(newNode, this.toBBox);
27295           if (level) insertPath[level - 1].children.push(newNode);
27296           else this._splitRoot(node, newNode);
27297         },
27298         _splitRoot: function(node, newNode) {
27299           this.data = createNode2([node, newNode]);
27300           this.data.height = node.height + 1;
27301           this.data.leaf = false;
27302           calcBBox2(this.data, this.toBBox);
27303         },
27304         _chooseSplitIndex: function(node, m2, M2) {
27305           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
27306           minOverlap = minArea = Infinity;
27307           for (i3 = m2; i3 <= M2 - m2; i3++) {
27308             bbox1 = distBBox2(node, 0, i3, this.toBBox);
27309             bbox2 = distBBox2(node, i3, M2, this.toBBox);
27310             overlap = intersectionArea2(bbox1, bbox2);
27311             area = bboxArea2(bbox1) + bboxArea2(bbox2);
27312             if (overlap < minOverlap) {
27313               minOverlap = overlap;
27314               index = i3;
27315               minArea = area < minArea ? area : minArea;
27316             } else if (overlap === minOverlap) {
27317               if (area < minArea) {
27318                 minArea = area;
27319                 index = i3;
27320               }
27321             }
27322           }
27323           return index;
27324         },
27325         // sorts node children by the best axis for split
27326         _chooseSplitAxis: function(node, m2, M2) {
27327           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
27328           if (xMargin < yMargin) node.children.sort(compareMinX);
27329         },
27330         // total margin of all possible split distributions where each node is at least m full
27331         _allDistMargin: function(node, m2, M2, compare2) {
27332           node.children.sort(compare2);
27333           var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m2, toBBox), rightBBox = distBBox2(node, M2 - m2, M2, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
27334           for (i3 = m2; i3 < M2 - m2; i3++) {
27335             child = node.children[i3];
27336             extend3(leftBBox, node.leaf ? toBBox(child) : child);
27337             margin += bboxMargin2(leftBBox);
27338           }
27339           for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
27340             child = node.children[i3];
27341             extend3(rightBBox, node.leaf ? toBBox(child) : child);
27342             margin += bboxMargin2(rightBBox);
27343           }
27344           return margin;
27345         },
27346         _adjustParentBBoxes: function(bbox2, path, level) {
27347           for (var i3 = level; i3 >= 0; i3--) {
27348             extend3(path[i3], bbox2);
27349           }
27350         },
27351         _condense: function(path) {
27352           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
27353             if (path[i3].children.length === 0) {
27354               if (i3 > 0) {
27355                 siblings = path[i3 - 1].children;
27356                 siblings.splice(siblings.indexOf(path[i3]), 1);
27357               } else this.clear();
27358             } else calcBBox2(path[i3], this.toBBox);
27359           }
27360         },
27361         _initFormat: function(format2) {
27362           var compareArr = ["return a", " - b", ";"];
27363           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
27364           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
27365           this.toBBox = new Function(
27366             "a",
27367             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
27368           );
27369         }
27370       };
27371       function findItem2(item, items, equalsFn) {
27372         if (!equalsFn) return items.indexOf(item);
27373         for (var i3 = 0; i3 < items.length; i3++) {
27374           if (equalsFn(item, items[i3])) return i3;
27375         }
27376         return -1;
27377       }
27378       function calcBBox2(node, toBBox) {
27379         distBBox2(node, 0, node.children.length, toBBox, node);
27380       }
27381       function distBBox2(node, k2, p2, toBBox, destNode) {
27382         if (!destNode) destNode = createNode2(null);
27383         destNode.minX = Infinity;
27384         destNode.minY = Infinity;
27385         destNode.maxX = -Infinity;
27386         destNode.maxY = -Infinity;
27387         for (var i3 = k2, child; i3 < p2; i3++) {
27388           child = node.children[i3];
27389           extend3(destNode, node.leaf ? toBBox(child) : child);
27390         }
27391         return destNode;
27392       }
27393       function extend3(a2, b2) {
27394         a2.minX = Math.min(a2.minX, b2.minX);
27395         a2.minY = Math.min(a2.minY, b2.minY);
27396         a2.maxX = Math.max(a2.maxX, b2.maxX);
27397         a2.maxY = Math.max(a2.maxY, b2.maxY);
27398         return a2;
27399       }
27400       function compareNodeMinX2(a2, b2) {
27401         return a2.minX - b2.minX;
27402       }
27403       function compareNodeMinY2(a2, b2) {
27404         return a2.minY - b2.minY;
27405       }
27406       function bboxArea2(a2) {
27407         return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
27408       }
27409       function bboxMargin2(a2) {
27410         return a2.maxX - a2.minX + (a2.maxY - a2.minY);
27411       }
27412       function enlargedArea2(a2, b2) {
27413         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));
27414       }
27415       function intersectionArea2(a2, b2) {
27416         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);
27417         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
27418       }
27419       function contains2(a2, b2) {
27420         return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
27421       }
27422       function intersects2(a2, b2) {
27423         return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
27424       }
27425       function createNode2(children2) {
27426         return {
27427           children: children2,
27428           height: 1,
27429           leaf: true,
27430           minX: Infinity,
27431           minY: Infinity,
27432           maxX: -Infinity,
27433           maxY: -Infinity
27434         };
27435       }
27436       function multiSelect2(arr, left, right, n3, compare2) {
27437         var stack = [left, right], mid;
27438         while (stack.length) {
27439           right = stack.pop();
27440           left = stack.pop();
27441           if (right - left <= n3) continue;
27442           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
27443           quickselect3(arr, mid, left, right, compare2);
27444           stack.push(left, mid, mid, right);
27445         }
27446       }
27447     }
27448   });
27449
27450   // node_modules/lineclip/index.js
27451   var require_lineclip = __commonJS({
27452     "node_modules/lineclip/index.js"(exports2, module2) {
27453       "use strict";
27454       module2.exports = lineclip2;
27455       lineclip2.polyline = lineclip2;
27456       lineclip2.polygon = polygonclip2;
27457       function lineclip2(points, bbox2, result) {
27458         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
27459         if (!result) result = [];
27460         for (i3 = 1; i3 < len; i3++) {
27461           a2 = points[i3 - 1];
27462           b2 = points[i3];
27463           codeB = lastCode = bitCode2(b2, bbox2);
27464           while (true) {
27465             if (!(codeA | codeB)) {
27466               part.push(a2);
27467               if (codeB !== lastCode) {
27468                 part.push(b2);
27469                 if (i3 < len - 1) {
27470                   result.push(part);
27471                   part = [];
27472                 }
27473               } else if (i3 === len - 1) {
27474                 part.push(b2);
27475               }
27476               break;
27477             } else if (codeA & codeB) {
27478               break;
27479             } else if (codeA) {
27480               a2 = intersect2(a2, b2, codeA, bbox2);
27481               codeA = bitCode2(a2, bbox2);
27482             } else {
27483               b2 = intersect2(a2, b2, codeB, bbox2);
27484               codeB = bitCode2(b2, bbox2);
27485             }
27486           }
27487           codeA = lastCode;
27488         }
27489         if (part.length) result.push(part);
27490         return result;
27491       }
27492       function polygonclip2(points, bbox2) {
27493         var result, edge, prev, prevInside, i3, p2, inside;
27494         for (edge = 1; edge <= 8; edge *= 2) {
27495           result = [];
27496           prev = points[points.length - 1];
27497           prevInside = !(bitCode2(prev, bbox2) & edge);
27498           for (i3 = 0; i3 < points.length; i3++) {
27499             p2 = points[i3];
27500             inside = !(bitCode2(p2, bbox2) & edge);
27501             if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
27502             if (inside) result.push(p2);
27503             prev = p2;
27504             prevInside = inside;
27505           }
27506           points = result;
27507           if (!points.length) break;
27508         }
27509         return result;
27510       }
27511       function intersect2(a2, b2, edge, bbox2) {
27512         return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
27513           // top
27514           edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
27515             // bottom
27516             edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
27517               // right
27518               edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
27519                 // left
27520                 null
27521               )
27522             )
27523           )
27524         );
27525       }
27526       function bitCode2(p2, bbox2) {
27527         var code = 0;
27528         if (p2[0] < bbox2[0]) code |= 1;
27529         else if (p2[0] > bbox2[2]) code |= 2;
27530         if (p2[1] < bbox2[1]) code |= 4;
27531         else if (p2[1] > bbox2[3]) code |= 8;
27532         return code;
27533       }
27534     }
27535   });
27536
27537   // node_modules/which-polygon/index.js
27538   var require_which_polygon = __commonJS({
27539     "node_modules/which-polygon/index.js"(exports2, module2) {
27540       "use strict";
27541       var rbush = require_rbush();
27542       var lineclip2 = require_lineclip();
27543       module2.exports = whichPolygon5;
27544       function whichPolygon5(data) {
27545         var bboxes = [];
27546         for (var i3 = 0; i3 < data.features.length; i3++) {
27547           var feature3 = data.features[i3];
27548           if (!feature3.geometry) continue;
27549           var coords = feature3.geometry.coordinates;
27550           if (feature3.geometry.type === "Polygon") {
27551             bboxes.push(treeItem(coords, feature3.properties));
27552           } else if (feature3.geometry.type === "MultiPolygon") {
27553             for (var j2 = 0; j2 < coords.length; j2++) {
27554               bboxes.push(treeItem(coords[j2], feature3.properties));
27555             }
27556           }
27557         }
27558         var tree = rbush().load(bboxes);
27559         function query(p2, multi) {
27560           var output = [], result = tree.search({
27561             minX: p2[0],
27562             minY: p2[1],
27563             maxX: p2[0],
27564             maxY: p2[1]
27565           });
27566           for (var i4 = 0; i4 < result.length; i4++) {
27567             if (insidePolygon(result[i4].coords, p2)) {
27568               if (multi)
27569                 output.push(result[i4].props);
27570               else
27571                 return result[i4].props;
27572             }
27573           }
27574           return multi && output.length ? output : null;
27575         }
27576         query.tree = tree;
27577         query.bbox = function queryBBox(bbox2) {
27578           var output = [];
27579           var result = tree.search({
27580             minX: bbox2[0],
27581             minY: bbox2[1],
27582             maxX: bbox2[2],
27583             maxY: bbox2[3]
27584           });
27585           for (var i4 = 0; i4 < result.length; i4++) {
27586             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
27587               output.push(result[i4].props);
27588             }
27589           }
27590           return output;
27591         };
27592         return query;
27593       }
27594       function polygonIntersectsBBox(polygon2, bbox2) {
27595         var bboxCenter = [
27596           (bbox2[0] + bbox2[2]) / 2,
27597           (bbox2[1] + bbox2[3]) / 2
27598         ];
27599         if (insidePolygon(polygon2, bboxCenter)) return true;
27600         for (var i3 = 0; i3 < polygon2.length; i3++) {
27601           if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
27602         }
27603         return false;
27604       }
27605       function insidePolygon(rings, p2) {
27606         var inside = false;
27607         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
27608           var ring = rings[i3];
27609           for (var j2 = 0, len2 = ring.length, k2 = len2 - 1; j2 < len2; k2 = j2++) {
27610             if (rayIntersect(p2, ring[j2], ring[k2])) inside = !inside;
27611           }
27612         }
27613         return inside;
27614       }
27615       function rayIntersect(p2, p1, p22) {
27616         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];
27617       }
27618       function treeItem(coords, props) {
27619         var item = {
27620           minX: Infinity,
27621           minY: Infinity,
27622           maxX: -Infinity,
27623           maxY: -Infinity,
27624           coords,
27625           props
27626         };
27627         for (var i3 = 0; i3 < coords[0].length; i3++) {
27628           var p2 = coords[0][i3];
27629           item.minX = Math.min(item.minX, p2[0]);
27630           item.minY = Math.min(item.minY, p2[1]);
27631           item.maxX = Math.max(item.maxX, p2[0]);
27632           item.maxY = Math.max(item.maxY, p2[1]);
27633         }
27634         return item;
27635       }
27636     }
27637   });
27638
27639   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
27640   function canonicalID(id2) {
27641     const s2 = id2 || "";
27642     if (s2.charAt(0) === ".") {
27643       return s2.toUpperCase();
27644     } else {
27645       return s2.replace(idFilterRegex, "").toUpperCase();
27646     }
27647   }
27648   function loadDerivedDataAndCaches(borders2) {
27649     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
27650     let geometryFeatures = [];
27651     for (const feature22 of borders2.features) {
27652       const props = feature22.properties;
27653       props.id = props.iso1A2 || props.m49 || props.wikidata;
27654       loadM49(feature22);
27655       loadTLD(feature22);
27656       loadIsoStatus(feature22);
27657       loadLevel(feature22);
27658       loadGroups(feature22);
27659       loadFlag(feature22);
27660       cacheFeatureByIDs(feature22);
27661       if (feature22.geometry) {
27662         geometryFeatures.push(feature22);
27663       }
27664     }
27665     for (const feature22 of borders2.features) {
27666       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
27667         return _featuresByCode[groupID].properties.id;
27668       });
27669       loadMembersForGroupsOf(feature22);
27670     }
27671     for (const feature22 of borders2.features) {
27672       loadRoadSpeedUnit(feature22);
27673       loadRoadHeightUnit(feature22);
27674       loadDriveSide(feature22);
27675       loadCallingCodes(feature22);
27676       loadGroupGroups(feature22);
27677     }
27678     for (const feature22 of borders2.features) {
27679       feature22.properties.groups.sort((groupID1, groupID2) => {
27680         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
27681       });
27682       if (feature22.properties.members) {
27683         feature22.properties.members.sort((id1, id2) => {
27684           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
27685           if (diff === 0) {
27686             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
27687           }
27688           return diff;
27689         });
27690       }
27691     }
27692     const geometryOnlyCollection = {
27693       type: "FeatureCollection",
27694       features: geometryFeatures
27695     };
27696     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
27697     function loadGroups(feature22) {
27698       const props = feature22.properties;
27699       if (!props.groups) {
27700         props.groups = [];
27701       }
27702       if (feature22.geometry && props.country) {
27703         props.groups.push(props.country);
27704       }
27705       if (props.m49 !== "001") {
27706         props.groups.push("001");
27707       }
27708     }
27709     function loadM49(feature22) {
27710       const props = feature22.properties;
27711       if (!props.m49 && props.iso1N3) {
27712         props.m49 = props.iso1N3;
27713       }
27714     }
27715     function loadTLD(feature22) {
27716       const props = feature22.properties;
27717       if (props.level === "unitedNations") return;
27718       if (props.ccTLD === null) return;
27719       if (!props.ccTLD && props.iso1A2) {
27720         props.ccTLD = "." + props.iso1A2.toLowerCase();
27721       }
27722     }
27723     function loadIsoStatus(feature22) {
27724       const props = feature22.properties;
27725       if (!props.isoStatus && props.iso1A2) {
27726         props.isoStatus = "official";
27727       }
27728     }
27729     function loadLevel(feature22) {
27730       const props = feature22.properties;
27731       if (props.level) return;
27732       if (!props.country) {
27733         props.level = "country";
27734       } else if (!props.iso1A2 || props.isoStatus === "official") {
27735         props.level = "territory";
27736       } else {
27737         props.level = "subterritory";
27738       }
27739     }
27740     function loadGroupGroups(feature22) {
27741       const props = feature22.properties;
27742       if (feature22.geometry || !props.members) return;
27743       const featureLevelIndex = levels.indexOf(props.level);
27744       let sharedGroups = [];
27745       props.members.forEach((memberID, index) => {
27746         const member = _featuresByCode[memberID];
27747         const memberGroups = member.properties.groups.filter((groupID) => {
27748           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
27749         });
27750         if (index === 0) {
27751           sharedGroups = memberGroups;
27752         } else {
27753           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
27754         }
27755       });
27756       props.groups = props.groups.concat(
27757         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
27758       );
27759       for (const groupID of sharedGroups) {
27760         const groupFeature = _featuresByCode[groupID];
27761         if (groupFeature.properties.members.indexOf(props.id) === -1) {
27762           groupFeature.properties.members.push(props.id);
27763         }
27764       }
27765     }
27766     function loadRoadSpeedUnit(feature22) {
27767       const props = feature22.properties;
27768       if (feature22.geometry) {
27769         if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
27770       } else if (props.members) {
27771         const vals = Array.from(
27772           new Set(
27773             props.members.map((id2) => {
27774               const member = _featuresByCode[id2];
27775               if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
27776             }).filter(Boolean)
27777           )
27778         );
27779         if (vals.length === 1) props.roadSpeedUnit = vals[0];
27780       }
27781     }
27782     function loadRoadHeightUnit(feature22) {
27783       const props = feature22.properties;
27784       if (feature22.geometry) {
27785         if (!props.roadHeightUnit) props.roadHeightUnit = "m";
27786       } else if (props.members) {
27787         const vals = Array.from(
27788           new Set(
27789             props.members.map((id2) => {
27790               const member = _featuresByCode[id2];
27791               if (member.geometry) return member.properties.roadHeightUnit || "m";
27792             }).filter(Boolean)
27793           )
27794         );
27795         if (vals.length === 1) props.roadHeightUnit = vals[0];
27796       }
27797     }
27798     function loadDriveSide(feature22) {
27799       const props = feature22.properties;
27800       if (feature22.geometry) {
27801         if (!props.driveSide) props.driveSide = "right";
27802       } else if (props.members) {
27803         const vals = Array.from(
27804           new Set(
27805             props.members.map((id2) => {
27806               const member = _featuresByCode[id2];
27807               if (member.geometry) return member.properties.driveSide || "right";
27808             }).filter(Boolean)
27809           )
27810         );
27811         if (vals.length === 1) props.driveSide = vals[0];
27812       }
27813     }
27814     function loadCallingCodes(feature22) {
27815       const props = feature22.properties;
27816       if (!feature22.geometry && props.members) {
27817         props.callingCodes = Array.from(
27818           new Set(
27819             props.members.reduce((array2, id2) => {
27820               const member = _featuresByCode[id2];
27821               if (member.geometry && member.properties.callingCodes) {
27822                 return array2.concat(member.properties.callingCodes);
27823               }
27824               return array2;
27825             }, [])
27826           )
27827         );
27828       }
27829     }
27830     function loadFlag(feature22) {
27831       if (!feature22.properties.iso1A2) return;
27832       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
27833         return String.fromCodePoint(char.charCodeAt(0) + 127397);
27834       });
27835       feature22.properties.emojiFlag = flag;
27836     }
27837     function loadMembersForGroupsOf(feature22) {
27838       for (const groupID of feature22.properties.groups) {
27839         const groupFeature = _featuresByCode[groupID];
27840         if (!groupFeature.properties.members) {
27841           groupFeature.properties.members = [];
27842         }
27843         groupFeature.properties.members.push(feature22.properties.id);
27844       }
27845     }
27846     function cacheFeatureByIDs(feature22) {
27847       let ids = [];
27848       for (const prop of identifierProps) {
27849         const id2 = feature22.properties[prop];
27850         if (id2) {
27851           ids.push(id2);
27852         }
27853       }
27854       for (const alias of feature22.properties.aliases || []) {
27855         ids.push(alias);
27856       }
27857       for (const id2 of ids) {
27858         const cid = canonicalID(id2);
27859         _featuresByCode[cid] = feature22;
27860       }
27861     }
27862   }
27863   function locArray(loc) {
27864     if (Array.isArray(loc)) {
27865       return loc;
27866     } else if (loc.coordinates) {
27867       return loc.coordinates;
27868     }
27869     return loc.geometry.coordinates;
27870   }
27871   function smallestFeature(loc) {
27872     const query = locArray(loc);
27873     const featureProperties = _whichPolygon(query);
27874     if (!featureProperties) return null;
27875     return _featuresByCode[featureProperties.id];
27876   }
27877   function countryFeature(loc) {
27878     const feature22 = smallestFeature(loc);
27879     if (!feature22) return null;
27880     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
27881     return _featuresByCode[countryCode] || null;
27882   }
27883   function featureForLoc(loc, opts) {
27884     const targetLevel = opts.level || "country";
27885     const maxLevel = opts.maxLevel || "world";
27886     const withProp = opts.withProp;
27887     const targetLevelIndex = levels.indexOf(targetLevel);
27888     if (targetLevelIndex === -1) return null;
27889     const maxLevelIndex = levels.indexOf(maxLevel);
27890     if (maxLevelIndex === -1) return null;
27891     if (maxLevelIndex < targetLevelIndex) return null;
27892     if (targetLevel === "country") {
27893       const fastFeature = countryFeature(loc);
27894       if (fastFeature) {
27895         if (!withProp || fastFeature.properties[withProp]) {
27896           return fastFeature;
27897         }
27898       }
27899     }
27900     const features = featuresContaining(loc);
27901     const match = features.find((feature22) => {
27902       let levelIndex = levels.indexOf(feature22.properties.level);
27903       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
27904       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
27905         if (!withProp || feature22.properties[withProp]) {
27906           return feature22;
27907         }
27908       }
27909       return false;
27910     });
27911     return match || null;
27912   }
27913   function featureForID(id2) {
27914     let stringID;
27915     if (typeof id2 === "number") {
27916       stringID = id2.toString();
27917       if (stringID.length === 1) {
27918         stringID = "00" + stringID;
27919       } else if (stringID.length === 2) {
27920         stringID = "0" + stringID;
27921       }
27922     } else {
27923       stringID = canonicalID(id2);
27924     }
27925     return _featuresByCode[stringID] || null;
27926   }
27927   function smallestFeaturesForBbox(bbox2) {
27928     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
27929   }
27930   function smallestOrMatchingFeature(query) {
27931     if (typeof query === "object") {
27932       return smallestFeature(query);
27933     }
27934     return featureForID(query);
27935   }
27936   function feature(query, opts = defaultOpts) {
27937     if (typeof query === "object") {
27938       return featureForLoc(query, opts);
27939     }
27940     return featureForID(query);
27941   }
27942   function iso1A2Code(query, opts = defaultOpts) {
27943     opts.withProp = "iso1A2";
27944     const match = feature(query, opts);
27945     if (!match) return null;
27946     return match.properties.iso1A2 || null;
27947   }
27948   function propertiesForQuery(query, property) {
27949     const features = featuresContaining(query, false);
27950     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
27951   }
27952   function iso1A2Codes(query) {
27953     return propertiesForQuery(query, "iso1A2");
27954   }
27955   function featuresContaining(query, strict) {
27956     let matchingFeatures;
27957     if (Array.isArray(query) && query.length === 4) {
27958       matchingFeatures = smallestFeaturesForBbox(query);
27959     } else {
27960       const smallestOrMatching = smallestOrMatchingFeature(query);
27961       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
27962     }
27963     if (!matchingFeatures.length) return [];
27964     let returnFeatures;
27965     if (!strict || typeof query === "object") {
27966       returnFeatures = matchingFeatures.slice();
27967     } else {
27968       returnFeatures = [];
27969     }
27970     for (const feature22 of matchingFeatures) {
27971       const properties = feature22.properties;
27972       for (const groupID of properties.groups) {
27973         const groupFeature = _featuresByCode[groupID];
27974         if (returnFeatures.indexOf(groupFeature) === -1) {
27975           returnFeatures.push(groupFeature);
27976         }
27977       }
27978     }
27979     return returnFeatures;
27980   }
27981   function featuresIn(id2, strict) {
27982     const feature22 = featureForID(id2);
27983     if (!feature22) return [];
27984     let features = [];
27985     if (!strict) {
27986       features.push(feature22);
27987     }
27988     const properties = feature22.properties;
27989     for (const memberID of properties.members || []) {
27990       features.push(_featuresByCode[memberID]);
27991     }
27992     return features;
27993   }
27994   function aggregateFeature(id2) {
27995     var _a3;
27996     const features = featuresIn(id2, false);
27997     if (features.length === 0) return null;
27998     let aggregateCoordinates = [];
27999     for (const feature22 of features) {
28000       if (((_a3 = feature22.geometry) == null ? void 0 : _a3.type) === "MultiPolygon" && feature22.geometry.coordinates) {
28001         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
28002       }
28003     }
28004     return {
28005       type: "Feature",
28006       properties: features[0].properties,
28007       geometry: {
28008         type: "MultiPolygon",
28009         coordinates: aggregateCoordinates
28010       }
28011     };
28012   }
28013   function roadSpeedUnit(query) {
28014     const feature22 = smallestOrMatchingFeature(query);
28015     return feature22 && feature22.properties.roadSpeedUnit || null;
28016   }
28017   function roadHeightUnit(query) {
28018     const feature22 = smallestOrMatchingFeature(query);
28019     return feature22 && feature22.properties.roadHeightUnit || null;
28020   }
28021   var import_which_polygon, borders_default, borders, _whichPolygon, _featuresByCode, idFilterRegex, levels, defaultOpts;
28022   var init_country_coder = __esm({
28023     "node_modules/@rapideditor/country-coder/dist/country-coder.mjs"() {
28024       import_which_polygon = __toESM(require_which_polygon(), 1);
28025       borders_default = { type: "FeatureCollection", features: [
28026         { 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]]]] } },
28027         { 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]]]] } },
28028         { 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]]]] } },
28029         { 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]]]] } },
28030         { 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]]]] } },
28031         { 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]]]] } },
28032         { 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]]]] } },
28033         { 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]]]] } },
28034         { 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]]]] } },
28035         { 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]]]] } },
28036         { 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]]]] } },
28037         { 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]]]] } },
28038         { 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]]]] } },
28039         { 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]]]] } },
28040         { 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]]]] } },
28041         { 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]]]] } },
28042         { 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]]]] } },
28043         { 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]]]] } },
28044         { 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]]]] } },
28045         { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
28046         { 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]]]] } },
28047         { 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]]]] } },
28048         { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
28049         { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
28050         { 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.90247, 35.07686], [33.92495, 35.06789], [33.94869, 35.07277], [33.99999, 35.07016], [34.23164, 35.1777], [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]]]] } },
28051         { 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]]]] } },
28052         { 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]]]] } },
28053         { 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]]]] } },
28054         { 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]]]] } },
28055         { 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]]]] } },
28056         { 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]]]] } },
28057         { 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]]]] } },
28058         { 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]]]] } },
28059         { 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]]]] } },
28060         { 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]]]] } },
28061         { 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]]]] } },
28062         { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
28063         { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
28064         { 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]]]] } },
28065         { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
28066         { 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]]]] } },
28067         { 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]]]] } },
28068         { 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]]]] } },
28069         { 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]]]] } },
28070         { 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]]]] } },
28071         { 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]]]] } },
28072         { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
28073         { 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]]]] } },
28074         { 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]]]] } },
28075         { 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]]]] } },
28076         { 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]]]] } },
28077         { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
28078         { 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]]]] } },
28079         { 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]]]] } },
28080         { 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]]]] } },
28081         { 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]]]] } },
28082         { 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]]]] } },
28083         { 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]]]] } },
28084         { 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]]]] } },
28085         { 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]]]] } },
28086         { 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]]]] } },
28087         { 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]]]] } },
28088         { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
28089         { 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]]]] } },
28090         { 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]]]] } },
28091         { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
28092         { 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]]]] } },
28093         { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
28094         { 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]]]] } },
28095         { 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]]]] } },
28096         { 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], [-71.75113, 45.0114], [-72.09934, 45.00571], [-72.17312, 45.00587], [-72.71867, 45.01551], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.47782, 44.99747], [-74.7163, 45.00017], [-74.73876, 44.98856], [-74.76044, 44.99491], [-74.76308, 45.00624], [-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]]]] } },
28097         { 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]]]] } },
28098         { 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]]]] } },
28099         { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
28100         { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
28101         { 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]]]] } },
28102         { 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]]]] } },
28103         { 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]]]] } },
28104         { 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]]]] } },
28105         { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
28106         { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
28107         { 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]]]] } },
28108         { 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]]]] } },
28109         { 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]]]] } },
28110         { 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], [118.99941, 4.76678], [119.52945, 5.35672], [118.33378, 5.99991], [117.96674, 6.28383], [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]]]] } },
28111         { 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]]]] } },
28112         { 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]]]] } },
28113         { 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]]]] } },
28114         { 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]]]] } },
28115         { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
28116         { 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]]]] } },
28117         { 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]]]] } },
28118         { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
28119         { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
28120         { 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]]]] } },
28121         { 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.96312, 34.63236], [32.95516, 34.63541], [32.95323, 34.64075], [32.95471, 34.64528], [32.95277, 34.65104], [32.96154, 34.65587], [32.9639, 34.65866], [32.969, 34.6549], [32.98046, 34.65336], [32.99014, 34.65518], [32.98668, 34.67268], [32.98967, 34.67981], [32.95567, 34.6839], [32.94127, 34.67426], [32.93989, 34.67034], [32.93756, 34.67072], [32.93535, 34.66317], [32.92824, 34.66821], [32.93043, 34.67091], [32.91398, 34.67343], [32.9068, 34.66102], [32.86167, 34.68734], [32.86014, 34.70585]]]] } },
28122         { 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.90146, 34.96458], [33.86018, 34.97381], [33.84741, 34.97167], [33.84028, 34.97179], [33.83459, 34.97448], [33.84616, 34.98511], [33.85488, 34.98462], [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.87438, 35.08118], [33.89322, 35.06789], [33.90247, 35.07686], [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]]]] } },
28123         { 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]]]] } },
28124         { 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]]]] } },
28125         { 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]]]] } },
28126         { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
28127         { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
28128         { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
28129         { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
28130         { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
28131         { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
28132         { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
28133         { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
28134         { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
28135         { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
28136         { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
28137         { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
28138         { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
28139         { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
28140         { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
28141         { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
28142         { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
28143         { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
28144         { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
28145         { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
28146         { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
28147         { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
28148         { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
28149         { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
28150         { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
28151         { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
28152         { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
28153         { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
28154         { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
28155         { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
28156         { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
28157         { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
28158         { 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]]]] } },
28159         { 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]]]] } },
28160         { 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]]]] } },
28161         { 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]]]] } },
28162         { 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]]]] } },
28163         { 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]]]] } },
28164         { 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]]]] } },
28165         { 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]]]] } },
28166         { 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]]]] } },
28167         { 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]]]] } },
28168         { 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]]]] } },
28169         { 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]]]] } },
28170         { 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.82208, 48.6151], [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.40656, 48.3719], [13.31419, 48.31643], [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.77435, 47.66102], [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.44018, 47.6952], [12.40137, 47.69215], [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.45444, 47.5558], [10.48202, 47.58434], [10.43892, 47.58408], [10.42973, 47.57752], [10.45145, 47.55472], [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.97837, 47.51314], [9.97173, 47.51551], [9.96229, 47.53612], [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.77612, 47.59359], [9.75798, 47.57982], [9.73528, 47.54527], [9.73683, 47.53564], [9.72564, 47.53282], [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.42715, 46.97495], [10.42211, 46.96019], [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]]]] } },
28171         { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
28172         { 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]]]] } },
28173         { 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]]]] } },
28174         { 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]]]] } },
28175         { 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]]]] } },
28176         { 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]]]] } },
28177         { 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]]]] } },
28178         { 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]]]] } },
28179         { 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]]]] } },
28180         { 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]]]] } },
28181         { 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]]]] } },
28182         { 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]]]] } },
28183         { 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]]]] } },
28184         { 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]]]] } },
28185         { 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]]]] } },
28186         { 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]]]] } },
28187         { 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.40519, -12.45065], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.28979, -10.21932], [-65.32696, -10.06449], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-66.61289, -9.93233], [-67.12883, -10.31634], [-67.18847, -10.33951], [-67.1917, -10.32944], [-67.21325, -10.3208], [-67.67724, -10.60263], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-68.75452, -11.00821], [-68.76092, -11.01726], [-68.7638, -11.01693], [-68.76291, -11.00728], [-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.70971, -19.03489], [-57.70818, -19.02772], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71901, -18.89907], [-57.76603, -18.89904], [-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.32208, -16.26597], [-58.39179, -16.27715], [-58.43081, -16.32233], [-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]]]] } },
28188         { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
28189         { 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.18183, 1.72948], [-69.39079, 1.72934], [-69.55722, 1.77158], [-69.84289, 1.69122], [-69.84259, 1.07881], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-69.82577, 0.59225], [-70.04708, 0.56194], [-70.04294, -0.19043], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.93323, -4.21971], [-69.93571, -4.2195], [-69.94924, -4.23116], [-69.95836, -4.32881], [-69.99218, -4.32041], [-70.03272, -4.35441], [-70.02689, -4.37095], [-70.04593, -4.37554], [-70.0533, -4.2907], [-70.14422, -4.2714], [-70.19582, -4.3607], [-70.30567, -4.24361], [-70.27991, -4.23226], [-70.33236, -4.15214], [-70.73715, -4.17416], [-70.74728, -4.16112], [-70.78125, -4.16295], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-72.87086, -5.26346], [-73.24116, -6.07187], [-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.49706, -9.425], [-70.59272, -9.62142], [-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.76291, -11.00728], [-68.7638, -11.01693], [-68.76092, -11.01726], [-68.75452, -11.00821], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.67724, -10.60263], [-67.21325, -10.3208], [-67.1917, -10.32944], [-67.18847, -10.33951], [-67.12883, -10.31634], [-66.61289, -9.93233], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.32696, -10.06449], [-65.28979, -10.21932], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.40519, -12.45065], [-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.43081, -16.32233], [-58.39179, -16.27715], [-58.32208, -16.26597], [-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.76603, -18.89904], [-57.71901, -18.89907], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.70818, -19.02772], [-57.70971, -19.03489], [-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.74691, -22.46966], [-55.75257, -22.47633], [-55.75128, -22.48165], [-55.74718, -22.48376], [-55.74715, -22.50567], [-55.74069, -22.51564], [-55.74032, -22.51928], [-55.73792, -22.52632], [-55.72399, -22.55131], [-55.71193, -22.55809], [-55.69863, -22.56307], [-55.69103, -22.57959], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.53614, -23.24524], [-55.5222, -23.26048], [-55.55496, -23.28366], [-55.47567, -23.67566], [-55.4471, -23.7602], [-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.34579, -24.13058], [-54.31115, -24.26625], [-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.50823, -30.9145], [-54.45458, -31.65285], [-54.15721, -31.87458], [-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.80525, 3.35466], [-59.8041, 3.37027], [-59.81107, 3.38023], [-59.81484, 3.41955], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
28190         { 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]]]] } },
28191         { 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]]]] } },
28192         { 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]]]] } },
28193         { 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]]]] } },
28194         { 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]]]] } },
28195         { 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]]]] } },
28196         { 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.76308, 45.00624], [-74.76044, 44.99491], [-74.73876, 44.98856], [-74.7163, 45.00017], [-74.47782, 44.99747], [-74.32699, 44.99029], [-73.35025, 45.00942], [-72.71867, 45.01551], [-72.17312, 45.00587], [-72.09934, 45.00571], [-71.75113, 45.0114], [-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]]]] } },
28197         { 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]]]] } },
28198         { 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]]]] } },
28199         { 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]]]] } },
28200         { 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]]]] } },
28201         { type: "Feature", properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.60469, 47.67239], [8.60695, 47.66622], [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.57449, 47.61148], [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.2973, 47.60647], [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.06689, 47.56398], [8.06017, 47.56351], [8.04692, 47.55561], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95494, 47.55764], [7.94828, 47.54408], [7.91554, 47.54765], [7.90773, 47.55738], [7.91159, 47.57185], [7.88664, 47.58854], [7.84412, 47.5841], [7.82174, 47.58757], [7.79716, 47.5575], [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.63432, 47.56171], [7.63604, 47.56387], [7.64859, 47.55996], [7.68229, 47.56754], [7.68904, 47.57133], [7.672, 47.58527], [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.50813, 47.51601], [7.50898, 47.49819], [7.49025, 47.48355], [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.41906, 47.44626], [7.40308, 47.43638], [7.38216, 47.433], [7.38122, 47.43208], [7.37349, 47.43399], [7.3527, 47.43426], [7.34123, 47.43873], [7.33818, 47.44256], [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.05198, 47.35634], [7.05302, 47.33131], [7.01, 47.32451], [7.00827, 47.3014], [6.94316, 47.28747], [6.95108, 47.26428], [6.95087, 47.24121], [6.86359, 47.18015], [6.85069, 47.15744], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.69579, 47.0371], [6.68456, 47.03714], [6.65915, 47.02734], [6.64008, 47.00251], [6.61239, 46.99083], [6.50315, 46.96736], [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.42211, 46.96019], [10.42715, 46.97495], [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.85148, 47.69769], [8.87474, 47.69425], [8.86881, 47.70524], [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.67538, 47.68629], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.68571, 47.70954], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] } },
28202         { 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]]]] } },
28203         { 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]]]] } },
28204         { 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]]]] } },
28205         { 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]]]] } },
28206         { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
28207         { 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], [-70.28573, -3.82549], [-69.96843, -4.19678], [-69.94924, -4.23116], [-69.93571, -4.2195], [-69.93323, -4.21971], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.04294, -0.19043], [-70.04708, 0.56194], [-69.82577, 0.59225], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.84259, 1.07881], [-69.84289, 1.69122], [-69.55722, 1.77158], [-69.39079, 1.72934], [-68.18183, 1.72948], [-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]]]] } },
28208         { 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]]]] } },
28209         { type: "Feature", properties: { iso1A2: "CQ", iso1A3: "CRQ", iso1N3: "680", m49: "680", wikidata: "Q3405693", ccTLD: null, nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
28210         { 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]]]] } },
28211         { 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]]]] } },
28212         { 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]]]] } },
28213         { 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]]]] } },
28214         { 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]]]] } },
28215         { 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.60361, 35.16647], [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.92824, 34.66821], [32.93535, 34.66317], [32.93756, 34.67072], [32.93989, 34.67034], [32.94127, 34.67426], [32.95567, 34.6839], [32.98967, 34.67981], [32.98668, 34.67268], [32.99014, 34.65518], [32.98046, 34.65336], [32.969, 34.6549], [32.9639, 34.65866], [32.96154, 34.65587], [32.95277, 34.65104], [32.95471, 34.64528], [32.95323, 34.64075], [32.95516, 34.63541], [32.96312, 34.63236], [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]]], [[[33.7343, 35.01178], [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.77553, 34.99518], [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.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.85488, 34.98462], [33.84616, 34.98511], [33.83459, 34.97448], [33.84028, 34.97179], [33.84741, 34.97167], [33.86018, 34.97381], [33.90146, 34.96458], [33.98684, 34.76642], [35.48515, 34.70851], [35.51152, 36.10954], [34.23164, 35.1777], [33.99999, 35.07016], [33.94869, 35.07277], [33.92495, 35.06789], [33.90247, 35.07686], [33.89322, 35.06789], [33.87438, 35.08118], [33.85261, 35.0574], [33.8355, 35.05777], [33.82051, 35.0667]]]] } },
28216         { 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]]]] } },
28217         { 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.68571, 47.70954], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.67538, 47.68629], [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.86881, 47.70524], [8.87474, 47.69425], [8.85148, 47.69769], [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.72564, 47.53282], [9.73683, 47.53564], [9.73528, 47.54527], [9.75798, 47.57982], [9.77612, 47.59359], [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.96229, 47.53612], [9.97173, 47.51551], [9.97837, 47.51314], [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.45145, 47.55472], [10.42973, 47.57752], [10.43892, 47.58408], [10.48202, 47.58434], [10.45444, 47.5558], [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.40137, 47.69215], [12.44018, 47.6952], [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.77435, 47.66102], [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.31419, 48.31643], [13.40656, 48.3719], [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.82208, 48.6151], [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.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.55975, 47.83953], [7.52764, 47.78161], [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.672, 47.58527], [7.68904, 47.57133], [7.68229, 47.56754], [7.64859, 47.55996], [7.63604, 47.56387], [7.63432, 47.56171], [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.79716, 47.5575], [7.82174, 47.58757], [7.84412, 47.5841], [7.88664, 47.58854], [7.91159, 47.57185], [7.90773, 47.55738], [7.91554, 47.54765], [7.94828, 47.54408], [7.95494, 47.55764], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04692, 47.55561], [8.06017, 47.56351], [8.06689, 47.56398], [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.2973, 47.60647], [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.57449, 47.61148], [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.60695, 47.66622], [8.60469, 47.67239], [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]]]] } },
28218         { 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]]]] } },
28219         { 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]]]] } },
28220         { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
28221         { 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]]]] } },
28222         { 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]]]] } },
28223         { 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]]]] } },
28224         { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
28225         { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
28226         { 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]]]] } },
28227         { 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]]]] } },
28228         { 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]]]] } },
28229         { 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]]]] } },
28230         { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
28231         { 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]]]] } },
28232         { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
28233         { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
28234         { 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]]]] } },
28235         { 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]]]] } },
28236         { 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]]]] } },
28237         { 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]]]] } },
28238         { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
28239         { 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.50315, 46.96736], [6.61239, 46.99083], [6.64008, 47.00251], [6.65915, 47.02734], [6.68456, 47.03714], [6.69579, 47.0371], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.85069, 47.15744], [6.86359, 47.18015], [6.95087, 47.24121], [6.95108, 47.26428], [6.94316, 47.28747], [7.00827, 47.3014], [7.01, 47.32451], [7.05302, 47.33131], [7.05198, 47.35634], [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.33818, 47.44256], [7.34123, 47.43873], [7.3527, 47.43426], [7.37349, 47.43399], [7.38122, 47.43208], [7.38216, 47.433], [7.40308, 47.43638], [7.41906, 47.44626], [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.49025, 47.48355], [7.50898, 47.49819], [7.50813, 47.51601], [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.52764, 47.78161], [7.55975, 47.83953], [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.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]]]] } },
28240         { 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]]]] } },
28241         { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
28242         { 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]]]] } },
28243         { 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]]]] } },
28244         { 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]]]] } },
28245         { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
28246         { 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]]]] } },
28247         { 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]]]] } },
28248         { 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]]]] } },
28249         { 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]]]] } },
28250         { 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]]]] } },
28251         { 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]]]] } },
28252         { 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]]]] } },
28253         { 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]]]] } },
28254         { 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]]]] } },
28255         { 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]]]] } },
28256         { 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]]]] } },
28257         { 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]]]] } },
28258         { 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.81484, 3.41955], [-59.81107, 3.38023], [-59.8041, 3.37027], [-59.80525, 3.35466], [-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]]]] } },
28259         { 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]]]] } },
28260         { 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]]]] } },
28261         { 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]]]] } },
28262         { 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]]]] } },
28263         { 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]]]] } },
28264         { 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.72154, 47.78683], [18.65644, 47.7568], [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]]]] } },
28265         { 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]]]] } },
28266         { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
28267         { type: "Feature", properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] } },
28268         { 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]]]] } },
28269         { 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]]]] } },
28270         { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
28271         { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
28272         { 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]]]] } },
28273         { 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]]]] } },
28274         { 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]]]] } },
28275         { 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.40899, 46.21509], [13.41193, 46.22767], [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]]]] } },
28276         { 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]]]] } },
28277         { 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]]]] } },
28278         { 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]]]] } },
28279         { 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]]]] } },
28280         { 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]]]] } },
28281         { 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]]]] } },
28282         { 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]]]] } },
28283         { 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]]]] } },
28284         { 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]]]] } },
28285         { 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]]]] } },
28286         { 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]]]] } },
28287         { 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]]]] } },
28288         { 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]]]] } },
28289         { 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]]]] } },
28290         { 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]]]] } },
28291         { 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]]]] } },
28292         { 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]]]] } },
28293         { 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]]]] } },
28294         { 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]]]] } },
28295         { 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]]]] } },
28296         { 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]]]] } },
28297         { 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]]]] } },
28298         { 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]]]] } },
28299         { 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]]]] } },
28300         { 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]]]] } },
28301         { 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]]]] } },
28302         { 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]]]] } },
28303         { 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]]]] } },
28304         { 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]]]] } },
28305         { 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]]]] } },
28306         { 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]]]] } },
28307         { 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]]]] } },
28308         { 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]]]] } },
28309         { 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]]]] } },
28310         { 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]]]] } },
28311         { 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]]]] } },
28312         { 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]]]] } },
28313         { 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]]]] } },
28314         { 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]]]] } },
28315         { 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]]]] } },
28316         { 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]]]] } },
28317         { 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]]]] } },
28318         { 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]]]] } },
28319         { 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]]]] } },
28320         { 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]]]] } },
28321         { 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]]]] } },
28322         { 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]]]] } },
28323         { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
28324         { 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]]]] } },
28325         { 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]]]] } },
28326         { 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]]]] } },
28327         { 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]]]] } },
28328         { 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]]]] } },
28329         { 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]]]] } },
28330         { 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]]]] } },
28331         { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
28332         { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
28333         { 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]]]] } },
28334         { 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]]]] } },
28335         { 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]]]] } },
28336         { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
28337         { 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]]]] } },
28338         { 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]]]] } },
28339         { 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.59272, -9.62142], [-70.49706, -9.425], [-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.24116, -6.07187], [-72.87086, -5.26346], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.78125, -4.16295], [-70.74728, -4.16112], [-70.73715, -4.17416], [-70.33236, -4.15214], [-70.27991, -4.23226], [-70.30567, -4.24361], [-70.19582, -4.3607], [-70.14422, -4.2714], [-70.0533, -4.2907], [-70.04593, -4.37554], [-70.02689, -4.37095], [-70.03272, -4.35441], [-69.99218, -4.32041], [-69.95836, -4.32881], [-69.94924, -4.23116], [-69.96843, -4.19678], [-70.28573, -3.82549], [-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]]]] } },
28340         { 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]]]] } },
28341         { 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]]]] } },
28342         { 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.96674, 6.28383], [118.33378, 5.99991], [119.52945, 5.35672], [118.99941, 4.76678], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
28343         { 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]]]] } },
28344         { 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]]]] } },
28345         { 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]]]] } },
28346         { 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]]]] } },
28347         { 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]]]] } },
28348         { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
28349         { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
28350         { 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]]]] } },
28351         { 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.31115, -24.26625], [-54.34579, -24.13058], [-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.4471, -23.7602], [-55.47567, -23.67566], [-55.55496, -23.28366], [-55.5222, -23.26048], [-55.53614, -23.24524], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.69103, -22.57959], [-55.69863, -22.56307], [-55.71193, -22.55809], [-55.72399, -22.55131], [-55.73792, -22.52632], [-55.74032, -22.51928], [-55.74069, -22.51564], [-55.74715, -22.50567], [-55.74718, -22.48376], [-55.75128, -22.48165], [-55.75257, -22.47633], [-55.74691, -22.46966], [-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]]]] } },
28352         { 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]]]] } },
28353         { 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]]]] } },
28354         { 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]]]] } },
28355         { 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]]]] } },
28356         { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
28357         { 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]]]] } },
28358         { 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]]]] } },
28359         { 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]]]] } },
28360         { 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]]]] } },
28361         { 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]]]] } },
28362         { 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]]]] } },
28363         { 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]]]] } },
28364         { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
28365         { 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.41193, 46.22767], [13.40899, 46.21509], [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]]]] } },
28366         { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
28367         { 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.65644, 47.7568], [18.72154, 47.78683], [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]]]] } },
28368         { 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]]]] } },
28369         { 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]]]] } },
28370         { 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]]]] } },
28371         { 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]]]] } },
28372         { 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]]]] } },
28373         { 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]]]] } },
28374         { 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]]]] } },
28375         { 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]]]] } },
28376         { 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]]]] } },
28377         { 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]]]] } },
28378         { 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]]]] } },
28379         { 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]]]] } },
28380         { 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]]]] } },
28381         { 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]]]] } },
28382         { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
28383         { 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]]]] } },
28384         { 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]]]] } },
28385         { 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]]]] } },
28386         { 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]]]] } },
28387         { 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]]]] } },
28388         { 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]]]] } },
28389         { 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]]]] } },
28390         { 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]]]] } },
28391         { 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]]]] } },
28392         { 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]]]] } },
28393         { 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]]]] } },
28394         { 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]]]] } },
28395         { 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]]]] } },
28396         { 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]]]] } },
28397         { 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]]]] } },
28398         { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
28399         { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
28400         { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
28401         { 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.15721, -31.87458], [-54.45458, -31.65285], [-55.50823, -30.9145], [-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]]]] } },
28402         { 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]]]] } },
28403         { 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]]]] } },
28404         { 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]]]] } },
28405         { 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]]]] } },
28406         { 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]]]] } },
28407         { 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]]]] } },
28408         { 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]]]] } },
28409         { 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]]]] } },
28410         { 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]]]] } },
28411         { 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]]]] } },
28412         { 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]]]] } },
28413         { 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]]]] } },
28414         { 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]]]] } },
28415         { 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]]]] } },
28416         { 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]]]] } },
28417         { 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]]]] } }
28418       ] };
28419       borders = borders_default;
28420       _whichPolygon = {};
28421       _featuresByCode = {};
28422       idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
28423       levels = [
28424         "subterritory",
28425         "territory",
28426         "subcountryGroup",
28427         "country",
28428         "sharedLandform",
28429         "intermediateRegion",
28430         "subregion",
28431         "region",
28432         "subunion",
28433         "union",
28434         "unitedNations",
28435         "world"
28436       ];
28437       loadDerivedDataAndCaches(borders);
28438       defaultOpts = {
28439         level: void 0,
28440         maxLevel: void 0,
28441         withProp: void 0
28442       };
28443     }
28444   });
28445
28446   // node_modules/bignumber.js/bignumber.mjs
28447   function clone(configObject) {
28448     var div, convertBase, parseNumeric2, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
28449       prefix: "",
28450       groupSize: 3,
28451       secondaryGroupSize: 0,
28452       groupSeparator: ",",
28453       decimalSeparator: ".",
28454       fractionGroupSize: 0,
28455       fractionGroupSeparator: "\xA0",
28456       // non-breaking space
28457       suffix: ""
28458     }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
28459     function BigNumber2(v2, b2) {
28460       var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
28461       if (!(x2 instanceof BigNumber2)) return new BigNumber2(v2, b2);
28462       if (b2 == null) {
28463         if (v2 && v2._isBigNumber === true) {
28464           x2.s = v2.s;
28465           if (!v2.c || v2.e > MAX_EXP) {
28466             x2.c = x2.e = null;
28467           } else if (v2.e < MIN_EXP) {
28468             x2.c = [x2.e = 0];
28469           } else {
28470             x2.e = v2.e;
28471             x2.c = v2.c.slice();
28472           }
28473           return;
28474         }
28475         if ((isNum = typeof v2 == "number") && v2 * 0 == 0) {
28476           x2.s = 1 / v2 < 0 ? (v2 = -v2, -1) : 1;
28477           if (v2 === ~~v2) {
28478             for (e3 = 0, i3 = v2; i3 >= 10; i3 /= 10, e3++) ;
28479             if (e3 > MAX_EXP) {
28480               x2.c = x2.e = null;
28481             } else {
28482               x2.e = e3;
28483               x2.c = [v2];
28484             }
28485             return;
28486           }
28487           str = String(v2);
28488         } else {
28489           if (!isNumeric.test(str = String(v2))) return parseNumeric2(x2, str, isNum);
28490           x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
28491         }
28492         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
28493         if ((i3 = str.search(/e/i)) > 0) {
28494           if (e3 < 0) e3 = i3;
28495           e3 += +str.slice(i3 + 1);
28496           str = str.substring(0, i3);
28497         } else if (e3 < 0) {
28498           e3 = str.length;
28499         }
28500       } else {
28501         intCheck(b2, 2, ALPHABET.length, "Base");
28502         if (b2 == 10 && alphabetHasNormalDecimalDigits) {
28503           x2 = new BigNumber2(v2);
28504           return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
28505         }
28506         str = String(v2);
28507         if (isNum = typeof v2 == "number") {
28508           if (v2 * 0 != 0) return parseNumeric2(x2, str, isNum, b2);
28509           x2.s = 1 / v2 < 0 ? (str = str.slice(1), -1) : 1;
28510           if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
28511             throw Error(tooManyDigits + v2);
28512           }
28513         } else {
28514           x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
28515         }
28516         alphabet = ALPHABET.slice(0, b2);
28517         e3 = i3 = 0;
28518         for (len = str.length; i3 < len; i3++) {
28519           if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
28520             if (c2 == ".") {
28521               if (i3 > e3) {
28522                 e3 = len;
28523                 continue;
28524               }
28525             } else if (!caseChanged) {
28526               if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
28527                 caseChanged = true;
28528                 i3 = -1;
28529                 e3 = 0;
28530                 continue;
28531               }
28532             }
28533             return parseNumeric2(x2, String(v2), isNum, b2);
28534           }
28535         }
28536         isNum = false;
28537         str = convertBase(str, b2, 10, x2.s);
28538         if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
28539         else e3 = str.length;
28540       }
28541       for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
28542       for (len = str.length; str.charCodeAt(--len) === 48; ) ;
28543       if (str = str.slice(i3, ++len)) {
28544         len -= i3;
28545         if (isNum && BigNumber2.DEBUG && len > 15 && (v2 > MAX_SAFE_INTEGER3 || v2 !== mathfloor(v2))) {
28546           throw Error(tooManyDigits + x2.s * v2);
28547         }
28548         if ((e3 = e3 - i3 - 1) > MAX_EXP) {
28549           x2.c = x2.e = null;
28550         } else if (e3 < MIN_EXP) {
28551           x2.c = [x2.e = 0];
28552         } else {
28553           x2.e = e3;
28554           x2.c = [];
28555           i3 = (e3 + 1) % LOG_BASE;
28556           if (e3 < 0) i3 += LOG_BASE;
28557           if (i3 < len) {
28558             if (i3) x2.c.push(+str.slice(0, i3));
28559             for (len -= LOG_BASE; i3 < len; ) {
28560               x2.c.push(+str.slice(i3, i3 += LOG_BASE));
28561             }
28562             i3 = LOG_BASE - (str = str.slice(i3)).length;
28563           } else {
28564             i3 -= len;
28565           }
28566           for (; i3--; str += "0") ;
28567           x2.c.push(+str);
28568         }
28569       } else {
28570         x2.c = [x2.e = 0];
28571       }
28572     }
28573     BigNumber2.clone = clone;
28574     BigNumber2.ROUND_UP = 0;
28575     BigNumber2.ROUND_DOWN = 1;
28576     BigNumber2.ROUND_CEIL = 2;
28577     BigNumber2.ROUND_FLOOR = 3;
28578     BigNumber2.ROUND_HALF_UP = 4;
28579     BigNumber2.ROUND_HALF_DOWN = 5;
28580     BigNumber2.ROUND_HALF_EVEN = 6;
28581     BigNumber2.ROUND_HALF_CEIL = 7;
28582     BigNumber2.ROUND_HALF_FLOOR = 8;
28583     BigNumber2.EUCLID = 9;
28584     BigNumber2.config = BigNumber2.set = function(obj) {
28585       var p2, v2;
28586       if (obj != null) {
28587         if (typeof obj == "object") {
28588           if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
28589             v2 = obj[p2];
28590             intCheck(v2, 0, MAX, p2);
28591             DECIMAL_PLACES = v2;
28592           }
28593           if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
28594             v2 = obj[p2];
28595             intCheck(v2, 0, 8, p2);
28596             ROUNDING_MODE = v2;
28597           }
28598           if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
28599             v2 = obj[p2];
28600             if (v2 && v2.pop) {
28601               intCheck(v2[0], -MAX, 0, p2);
28602               intCheck(v2[1], 0, MAX, p2);
28603               TO_EXP_NEG = v2[0];
28604               TO_EXP_POS = v2[1];
28605             } else {
28606               intCheck(v2, -MAX, MAX, p2);
28607               TO_EXP_NEG = -(TO_EXP_POS = v2 < 0 ? -v2 : v2);
28608             }
28609           }
28610           if (obj.hasOwnProperty(p2 = "RANGE")) {
28611             v2 = obj[p2];
28612             if (v2 && v2.pop) {
28613               intCheck(v2[0], -MAX, -1, p2);
28614               intCheck(v2[1], 1, MAX, p2);
28615               MIN_EXP = v2[0];
28616               MAX_EXP = v2[1];
28617             } else {
28618               intCheck(v2, -MAX, MAX, p2);
28619               if (v2) {
28620                 MIN_EXP = -(MAX_EXP = v2 < 0 ? -v2 : v2);
28621               } else {
28622                 throw Error(bignumberError + p2 + " cannot be zero: " + v2);
28623               }
28624             }
28625           }
28626           if (obj.hasOwnProperty(p2 = "CRYPTO")) {
28627             v2 = obj[p2];
28628             if (v2 === !!v2) {
28629               if (v2) {
28630                 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
28631                   CRYPTO = v2;
28632                 } else {
28633                   CRYPTO = !v2;
28634                   throw Error(bignumberError + "crypto unavailable");
28635                 }
28636               } else {
28637                 CRYPTO = v2;
28638               }
28639             } else {
28640               throw Error(bignumberError + p2 + " not true or false: " + v2);
28641             }
28642           }
28643           if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
28644             v2 = obj[p2];
28645             intCheck(v2, 0, 9, p2);
28646             MODULO_MODE = v2;
28647           }
28648           if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
28649             v2 = obj[p2];
28650             intCheck(v2, 0, MAX, p2);
28651             POW_PRECISION = v2;
28652           }
28653           if (obj.hasOwnProperty(p2 = "FORMAT")) {
28654             v2 = obj[p2];
28655             if (typeof v2 == "object") FORMAT = v2;
28656             else throw Error(bignumberError + p2 + " not an object: " + v2);
28657           }
28658           if (obj.hasOwnProperty(p2 = "ALPHABET")) {
28659             v2 = obj[p2];
28660             if (typeof v2 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v2)) {
28661               alphabetHasNormalDecimalDigits = v2.slice(0, 10) == "0123456789";
28662               ALPHABET = v2;
28663             } else {
28664               throw Error(bignumberError + p2 + " invalid: " + v2);
28665             }
28666           }
28667         } else {
28668           throw Error(bignumberError + "Object expected: " + obj);
28669         }
28670       }
28671       return {
28672         DECIMAL_PLACES,
28673         ROUNDING_MODE,
28674         EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
28675         RANGE: [MIN_EXP, MAX_EXP],
28676         CRYPTO,
28677         MODULO_MODE,
28678         POW_PRECISION,
28679         FORMAT,
28680         ALPHABET
28681       };
28682     };
28683     BigNumber2.isBigNumber = function(v2) {
28684       if (!v2 || v2._isBigNumber !== true) return false;
28685       if (!BigNumber2.DEBUG) return true;
28686       var i3, n3, c2 = v2.c, e3 = v2.e, s2 = v2.s;
28687       out: if ({}.toString.call(c2) == "[object Array]") {
28688         if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
28689           if (c2[0] === 0) {
28690             if (e3 === 0 && c2.length === 1) return true;
28691             break out;
28692           }
28693           i3 = (e3 + 1) % LOG_BASE;
28694           if (i3 < 1) i3 += LOG_BASE;
28695           if (String(c2[0]).length == i3) {
28696             for (i3 = 0; i3 < c2.length; i3++) {
28697               n3 = c2[i3];
28698               if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
28699             }
28700             if (n3 !== 0) return true;
28701           }
28702         }
28703       } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
28704         return true;
28705       }
28706       throw Error(bignumberError + "Invalid BigNumber: " + v2);
28707     };
28708     BigNumber2.maximum = BigNumber2.max = function() {
28709       return maxOrMin(arguments, -1);
28710     };
28711     BigNumber2.minimum = BigNumber2.min = function() {
28712       return maxOrMin(arguments, 1);
28713     };
28714     BigNumber2.random = function() {
28715       var pow2_53 = 9007199254740992;
28716       var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
28717         return mathfloor(Math.random() * pow2_53);
28718       } : function() {
28719         return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
28720       };
28721       return function(dp) {
28722         var a2, b2, e3, k2, v2, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
28723         if (dp == null) dp = DECIMAL_PLACES;
28724         else intCheck(dp, 0, MAX);
28725         k2 = mathceil(dp / LOG_BASE);
28726         if (CRYPTO) {
28727           if (crypto.getRandomValues) {
28728             a2 = crypto.getRandomValues(new Uint32Array(k2 *= 2));
28729             for (; i3 < k2; ) {
28730               v2 = a2[i3] * 131072 + (a2[i3 + 1] >>> 11);
28731               if (v2 >= 9e15) {
28732                 b2 = crypto.getRandomValues(new Uint32Array(2));
28733                 a2[i3] = b2[0];
28734                 a2[i3 + 1] = b2[1];
28735               } else {
28736                 c2.push(v2 % 1e14);
28737                 i3 += 2;
28738               }
28739             }
28740             i3 = k2 / 2;
28741           } else if (crypto.randomBytes) {
28742             a2 = crypto.randomBytes(k2 *= 7);
28743             for (; i3 < k2; ) {
28744               v2 = (a2[i3] & 31) * 281474976710656 + a2[i3 + 1] * 1099511627776 + a2[i3 + 2] * 4294967296 + a2[i3 + 3] * 16777216 + (a2[i3 + 4] << 16) + (a2[i3 + 5] << 8) + a2[i3 + 6];
28745               if (v2 >= 9e15) {
28746                 crypto.randomBytes(7).copy(a2, i3);
28747               } else {
28748                 c2.push(v2 % 1e14);
28749                 i3 += 7;
28750               }
28751             }
28752             i3 = k2 / 7;
28753           } else {
28754             CRYPTO = false;
28755             throw Error(bignumberError + "crypto unavailable");
28756           }
28757         }
28758         if (!CRYPTO) {
28759           for (; i3 < k2; ) {
28760             v2 = random53bitInt();
28761             if (v2 < 9e15) c2[i3++] = v2 % 1e14;
28762           }
28763         }
28764         k2 = c2[--i3];
28765         dp %= LOG_BASE;
28766         if (k2 && dp) {
28767           v2 = POWS_TEN[LOG_BASE - dp];
28768           c2[i3] = mathfloor(k2 / v2) * v2;
28769         }
28770         for (; c2[i3] === 0; c2.pop(), i3--) ;
28771         if (i3 < 0) {
28772           c2 = [e3 = 0];
28773         } else {
28774           for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
28775           for (i3 = 1, v2 = c2[0]; v2 >= 10; v2 /= 10, i3++) ;
28776           if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
28777         }
28778         rand.e = e3;
28779         rand.c = c2;
28780         return rand;
28781       };
28782     }();
28783     BigNumber2.sum = function() {
28784       var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
28785       for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
28786       return sum;
28787     };
28788     convertBase = /* @__PURE__ */ function() {
28789       var decimal = "0123456789";
28790       function toBaseOut(str, baseIn, baseOut, alphabet) {
28791         var j2, arr = [0], arrL, i3 = 0, len = str.length;
28792         for (; i3 < len; ) {
28793           for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
28794           arr[0] += alphabet.indexOf(str.charAt(i3++));
28795           for (j2 = 0; j2 < arr.length; j2++) {
28796             if (arr[j2] > baseOut - 1) {
28797               if (arr[j2 + 1] == null) arr[j2 + 1] = 0;
28798               arr[j2 + 1] += arr[j2] / baseOut | 0;
28799               arr[j2] %= baseOut;
28800             }
28801           }
28802         }
28803         return arr.reverse();
28804       }
28805       return function(str, baseIn, baseOut, sign2, callerIsToString) {
28806         var alphabet, d2, e3, k2, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
28807         if (i3 >= 0) {
28808           k2 = POW_PRECISION;
28809           POW_PRECISION = 0;
28810           str = str.replace(".", "");
28811           y2 = new BigNumber2(baseIn);
28812           x2 = y2.pow(str.length - i3);
28813           POW_PRECISION = k2;
28814           y2.c = toBaseOut(
28815             toFixedPoint(coeffToString(x2.c), x2.e, "0"),
28816             10,
28817             baseOut,
28818             decimal
28819           );
28820           y2.e = y2.c.length;
28821         }
28822         xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
28823         e3 = k2 = xc.length;
28824         for (; xc[--k2] == 0; xc.pop()) ;
28825         if (!xc[0]) return alphabet.charAt(0);
28826         if (i3 < 0) {
28827           --e3;
28828         } else {
28829           x2.c = xc;
28830           x2.e = e3;
28831           x2.s = sign2;
28832           x2 = div(x2, y2, dp, rm, baseOut);
28833           xc = x2.c;
28834           r2 = x2.r;
28835           e3 = x2.e;
28836         }
28837         d2 = e3 + dp + 1;
28838         i3 = xc[d2];
28839         k2 = baseOut / 2;
28840         r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
28841         r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k2 || i3 == k2 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
28842         if (d2 < 1 || !xc[0]) {
28843           str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
28844         } else {
28845           xc.length = d2;
28846           if (r2) {
28847             for (--baseOut; ++xc[--d2] > baseOut; ) {
28848               xc[d2] = 0;
28849               if (!d2) {
28850                 ++e3;
28851                 xc = [1].concat(xc);
28852               }
28853             }
28854           }
28855           for (k2 = xc.length; !xc[--k2]; ) ;
28856           for (i3 = 0, str = ""; i3 <= k2; str += alphabet.charAt(xc[i3++])) ;
28857           str = toFixedPoint(str, e3, alphabet.charAt(0));
28858         }
28859         return str;
28860       };
28861     }();
28862     div = /* @__PURE__ */ function() {
28863       function multiply(x2, k2, base) {
28864         var m2, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k2 % SQRT_BASE, khi = k2 / SQRT_BASE | 0;
28865         for (x2 = x2.slice(); i3--; ) {
28866           xlo = x2[i3] % SQRT_BASE;
28867           xhi = x2[i3] / SQRT_BASE | 0;
28868           m2 = khi * xlo + xhi * klo;
28869           temp = klo * xlo + m2 % SQRT_BASE * SQRT_BASE + carry;
28870           carry = (temp / base | 0) + (m2 / SQRT_BASE | 0) + khi * xhi;
28871           x2[i3] = temp % base;
28872         }
28873         if (carry) x2 = [carry].concat(x2);
28874         return x2;
28875       }
28876       function compare2(a2, b2, aL, bL) {
28877         var i3, cmp;
28878         if (aL != bL) {
28879           cmp = aL > bL ? 1 : -1;
28880         } else {
28881           for (i3 = cmp = 0; i3 < aL; i3++) {
28882             if (a2[i3] != b2[i3]) {
28883               cmp = a2[i3] > b2[i3] ? 1 : -1;
28884               break;
28885             }
28886           }
28887         }
28888         return cmp;
28889       }
28890       function subtract(a2, b2, aL, base) {
28891         var i3 = 0;
28892         for (; aL--; ) {
28893           a2[aL] -= i3;
28894           i3 = a2[aL] < b2[aL] ? 1 : 0;
28895           a2[aL] = i3 * base + a2[aL] - b2[aL];
28896         }
28897         for (; !a2[0] && a2.length > 1; a2.splice(0, 1)) ;
28898       }
28899       return function(x2, y2, dp, rm, base) {
28900         var cmp, e3, i3, more, n3, prod, prodL, q2, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
28901         if (!xc || !xc[0] || !yc || !yc[0]) {
28902           return new BigNumber2(
28903             // Return NaN if either NaN, or both Infinity or 0.
28904             !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
28905               // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
28906               xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
28907             )
28908           );
28909         }
28910         q2 = new BigNumber2(s2);
28911         qc = q2.c = [];
28912         e3 = x2.e - y2.e;
28913         s2 = dp + e3 + 1;
28914         if (!base) {
28915           base = BASE;
28916           e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
28917           s2 = s2 / LOG_BASE | 0;
28918         }
28919         for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
28920         if (yc[i3] > (xc[i3] || 0)) e3--;
28921         if (s2 < 0) {
28922           qc.push(1);
28923           more = true;
28924         } else {
28925           xL = xc.length;
28926           yL = yc.length;
28927           i3 = 0;
28928           s2 += 2;
28929           n3 = mathfloor(base / (yc[0] + 1));
28930           if (n3 > 1) {
28931             yc = multiply(yc, n3, base);
28932             xc = multiply(xc, n3, base);
28933             yL = yc.length;
28934             xL = xc.length;
28935           }
28936           xi = yL;
28937           rem = xc.slice(0, yL);
28938           remL = rem.length;
28939           for (; remL < yL; rem[remL++] = 0) ;
28940           yz = yc.slice();
28941           yz = [0].concat(yz);
28942           yc0 = yc[0];
28943           if (yc[1] >= base / 2) yc0++;
28944           do {
28945             n3 = 0;
28946             cmp = compare2(yc, rem, yL, remL);
28947             if (cmp < 0) {
28948               rem0 = rem[0];
28949               if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
28950               n3 = mathfloor(rem0 / yc0);
28951               if (n3 > 1) {
28952                 if (n3 >= base) n3 = base - 1;
28953                 prod = multiply(yc, n3, base);
28954                 prodL = prod.length;
28955                 remL = rem.length;
28956                 while (compare2(prod, rem, prodL, remL) == 1) {
28957                   n3--;
28958                   subtract(prod, yL < prodL ? yz : yc, prodL, base);
28959                   prodL = prod.length;
28960                   cmp = 1;
28961                 }
28962               } else {
28963                 if (n3 == 0) {
28964                   cmp = n3 = 1;
28965                 }
28966                 prod = yc.slice();
28967                 prodL = prod.length;
28968               }
28969               if (prodL < remL) prod = [0].concat(prod);
28970               subtract(rem, prod, remL, base);
28971               remL = rem.length;
28972               if (cmp == -1) {
28973                 while (compare2(yc, rem, yL, remL) < 1) {
28974                   n3++;
28975                   subtract(rem, yL < remL ? yz : yc, remL, base);
28976                   remL = rem.length;
28977                 }
28978               }
28979             } else if (cmp === 0) {
28980               n3++;
28981               rem = [0];
28982             }
28983             qc[i3++] = n3;
28984             if (rem[0]) {
28985               rem[remL++] = xc[xi] || 0;
28986             } else {
28987               rem = [xc[xi]];
28988               remL = 1;
28989             }
28990           } while ((xi++ < xL || rem[0] != null) && s2--);
28991           more = rem[0] != null;
28992           if (!qc[0]) qc.splice(0, 1);
28993         }
28994         if (base == BASE) {
28995           for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
28996           round(q2, dp + (q2.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
28997         } else {
28998           q2.e = e3;
28999           q2.r = +more;
29000         }
29001         return q2;
29002       };
29003     }();
29004     function format2(n3, i3, rm, id2) {
29005       var c0, e3, ne2, len, str;
29006       if (rm == null) rm = ROUNDING_MODE;
29007       else intCheck(rm, 0, 8);
29008       if (!n3.c) return n3.toString();
29009       c0 = n3.c[0];
29010       ne2 = n3.e;
29011       if (i3 == null) {
29012         str = coeffToString(n3.c);
29013         str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
29014       } else {
29015         n3 = round(new BigNumber2(n3), i3, rm);
29016         e3 = n3.e;
29017         str = coeffToString(n3.c);
29018         len = str.length;
29019         if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
29020           for (; len < i3; str += "0", len++) ;
29021           str = toExponential(str, e3);
29022         } else {
29023           i3 -= ne2;
29024           str = toFixedPoint(str, e3, "0");
29025           if (e3 + 1 > len) {
29026             if (--i3 > 0) for (str += "."; i3--; str += "0") ;
29027           } else {
29028             i3 += e3 - len;
29029             if (i3 > 0) {
29030               if (e3 + 1 == len) str += ".";
29031               for (; i3--; str += "0") ;
29032             }
29033           }
29034         }
29035       }
29036       return n3.s < 0 && c0 ? "-" + str : str;
29037     }
29038     function maxOrMin(args, n3) {
29039       var k2, y2, i3 = 1, x2 = new BigNumber2(args[0]);
29040       for (; i3 < args.length; i3++) {
29041         y2 = new BigNumber2(args[i3]);
29042         if (!y2.s || (k2 = compare(x2, y2)) === n3 || k2 === 0 && x2.s === n3) {
29043           x2 = y2;
29044         }
29045       }
29046       return x2;
29047     }
29048     function normalise(n3, c2, e3) {
29049       var i3 = 1, j2 = c2.length;
29050       for (; !c2[--j2]; c2.pop()) ;
29051       for (j2 = c2[0]; j2 >= 10; j2 /= 10, i3++) ;
29052       if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
29053         n3.c = n3.e = null;
29054       } else if (e3 < MIN_EXP) {
29055         n3.c = [n3.e = 0];
29056       } else {
29057         n3.e = e3;
29058         n3.c = c2;
29059       }
29060       return n3;
29061     }
29062     parseNumeric2 = /* @__PURE__ */ function() {
29063       var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
29064       return function(x2, str, isNum, b2) {
29065         var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
29066         if (isInfinityOrNaN.test(s2)) {
29067           x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
29068         } else {
29069           if (!isNum) {
29070             s2 = s2.replace(basePrefix, function(m2, p1, p2) {
29071               base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
29072               return !b2 || b2 == base ? p1 : m2;
29073             });
29074             if (b2) {
29075               base = b2;
29076               s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
29077             }
29078             if (str != s2) return new BigNumber2(s2, base);
29079           }
29080           if (BigNumber2.DEBUG) {
29081             throw Error(bignumberError + "Not a" + (b2 ? " base " + b2 : "") + " number: " + str);
29082           }
29083           x2.s = null;
29084         }
29085         x2.c = x2.e = null;
29086       };
29087     }();
29088     function round(x2, sd, rm, r2) {
29089       var d2, i3, j2, k2, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
29090       if (xc) {
29091         out: {
29092           for (d2 = 1, k2 = xc[0]; k2 >= 10; k2 /= 10, d2++) ;
29093           i3 = sd - d2;
29094           if (i3 < 0) {
29095             i3 += LOG_BASE;
29096             j2 = sd;
29097             n3 = xc[ni = 0];
29098             rd = mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
29099           } else {
29100             ni = mathceil((i3 + 1) / LOG_BASE);
29101             if (ni >= xc.length) {
29102               if (r2) {
29103                 for (; xc.length <= ni; xc.push(0)) ;
29104                 n3 = rd = 0;
29105                 d2 = 1;
29106                 i3 %= LOG_BASE;
29107                 j2 = i3 - LOG_BASE + 1;
29108               } else {
29109                 break out;
29110               }
29111             } else {
29112               n3 = k2 = xc[ni];
29113               for (d2 = 1; k2 >= 10; k2 /= 10, d2++) ;
29114               i3 %= LOG_BASE;
29115               j2 = i3 - LOG_BASE + d2;
29116               rd = j2 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
29117             }
29118           }
29119           r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
29120           // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
29121           // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
29122           xc[ni + 1] != null || (j2 < 0 ? n3 : n3 % pows10[d2 - j2 - 1]);
29123           r2 = rm < 4 ? (rd || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r2 || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
29124           (i3 > 0 ? j2 > 0 ? n3 / pows10[d2 - j2] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
29125           if (sd < 1 || !xc[0]) {
29126             xc.length = 0;
29127             if (r2) {
29128               sd -= x2.e + 1;
29129               xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
29130               x2.e = -sd || 0;
29131             } else {
29132               xc[0] = x2.e = 0;
29133             }
29134             return x2;
29135           }
29136           if (i3 == 0) {
29137             xc.length = ni;
29138             k2 = 1;
29139             ni--;
29140           } else {
29141             xc.length = ni + 1;
29142             k2 = pows10[LOG_BASE - i3];
29143             xc[ni] = j2 > 0 ? mathfloor(n3 / pows10[d2 - j2] % pows10[j2]) * k2 : 0;
29144           }
29145           if (r2) {
29146             for (; ; ) {
29147               if (ni == 0) {
29148                 for (i3 = 1, j2 = xc[0]; j2 >= 10; j2 /= 10, i3++) ;
29149                 j2 = xc[0] += k2;
29150                 for (k2 = 1; j2 >= 10; j2 /= 10, k2++) ;
29151                 if (i3 != k2) {
29152                   x2.e++;
29153                   if (xc[0] == BASE) xc[0] = 1;
29154                 }
29155                 break;
29156               } else {
29157                 xc[ni] += k2;
29158                 if (xc[ni] != BASE) break;
29159                 xc[ni--] = 0;
29160                 k2 = 1;
29161               }
29162             }
29163           }
29164           for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
29165         }
29166         if (x2.e > MAX_EXP) {
29167           x2.c = x2.e = null;
29168         } else if (x2.e < MIN_EXP) {
29169           x2.c = [x2.e = 0];
29170         }
29171       }
29172       return x2;
29173     }
29174     function valueOf(n3) {
29175       var str, e3 = n3.e;
29176       if (e3 === null) return n3.toString();
29177       str = coeffToString(n3.c);
29178       str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
29179       return n3.s < 0 ? "-" + str : str;
29180     }
29181     P2.absoluteValue = P2.abs = function() {
29182       var x2 = new BigNumber2(this);
29183       if (x2.s < 0) x2.s = 1;
29184       return x2;
29185     };
29186     P2.comparedTo = function(y2, b2) {
29187       return compare(this, new BigNumber2(y2, b2));
29188     };
29189     P2.decimalPlaces = P2.dp = function(dp, rm) {
29190       var c2, n3, v2, x2 = this;
29191       if (dp != null) {
29192         intCheck(dp, 0, MAX);
29193         if (rm == null) rm = ROUNDING_MODE;
29194         else intCheck(rm, 0, 8);
29195         return round(new BigNumber2(x2), dp + x2.e + 1, rm);
29196       }
29197       if (!(c2 = x2.c)) return null;
29198       n3 = ((v2 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
29199       if (v2 = c2[v2]) for (; v2 % 10 == 0; v2 /= 10, n3--) ;
29200       if (n3 < 0) n3 = 0;
29201       return n3;
29202     };
29203     P2.dividedBy = P2.div = function(y2, b2) {
29204       return div(this, new BigNumber2(y2, b2), DECIMAL_PLACES, ROUNDING_MODE);
29205     };
29206     P2.dividedToIntegerBy = P2.idiv = function(y2, b2) {
29207       return div(this, new BigNumber2(y2, b2), 0, 1);
29208     };
29209     P2.exponentiatedBy = P2.pow = function(n3, m2) {
29210       var half, isModExp, i3, k2, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
29211       n3 = new BigNumber2(n3);
29212       if (n3.c && !n3.isInteger()) {
29213         throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
29214       }
29215       if (m2 != null) m2 = new BigNumber2(m2);
29216       nIsBig = n3.e > 14;
29217       if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
29218         y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
29219         return m2 ? y2.mod(m2) : y2;
29220       }
29221       nIsNeg = n3.s < 0;
29222       if (m2) {
29223         if (m2.c ? !m2.c[0] : !m2.s) return new BigNumber2(NaN);
29224         isModExp = !nIsNeg && x2.isInteger() && m2.isInteger();
29225         if (isModExp) x2 = x2.mod(m2);
29226       } else if (n3.e > 9 && (x2.e > 0 || x2.e < -1 || (x2.e == 0 ? x2.c[0] > 1 || nIsBig && x2.c[1] >= 24e7 : x2.c[0] < 8e13 || nIsBig && x2.c[0] <= 9999975e7))) {
29227         k2 = x2.s < 0 && isOdd(n3) ? -0 : 0;
29228         if (x2.e > -1) k2 = 1 / k2;
29229         return new BigNumber2(nIsNeg ? 1 / k2 : k2);
29230       } else if (POW_PRECISION) {
29231         k2 = mathceil(POW_PRECISION / LOG_BASE + 2);
29232       }
29233       if (nIsBig) {
29234         half = new BigNumber2(0.5);
29235         if (nIsNeg) n3.s = 1;
29236         nIsOdd = isOdd(n3);
29237       } else {
29238         i3 = Math.abs(+valueOf(n3));
29239         nIsOdd = i3 % 2;
29240       }
29241       y2 = new BigNumber2(ONE);
29242       for (; ; ) {
29243         if (nIsOdd) {
29244           y2 = y2.times(x2);
29245           if (!y2.c) break;
29246           if (k2) {
29247             if (y2.c.length > k2) y2.c.length = k2;
29248           } else if (isModExp) {
29249             y2 = y2.mod(m2);
29250           }
29251         }
29252         if (i3) {
29253           i3 = mathfloor(i3 / 2);
29254           if (i3 === 0) break;
29255           nIsOdd = i3 % 2;
29256         } else {
29257           n3 = n3.times(half);
29258           round(n3, n3.e + 1, 1);
29259           if (n3.e > 14) {
29260             nIsOdd = isOdd(n3);
29261           } else {
29262             i3 = +valueOf(n3);
29263             if (i3 === 0) break;
29264             nIsOdd = i3 % 2;
29265           }
29266         }
29267         x2 = x2.times(x2);
29268         if (k2) {
29269           if (x2.c && x2.c.length > k2) x2.c.length = k2;
29270         } else if (isModExp) {
29271           x2 = x2.mod(m2);
29272         }
29273       }
29274       if (isModExp) return y2;
29275       if (nIsNeg) y2 = ONE.div(y2);
29276       return m2 ? y2.mod(m2) : k2 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
29277     };
29278     P2.integerValue = function(rm) {
29279       var n3 = new BigNumber2(this);
29280       if (rm == null) rm = ROUNDING_MODE;
29281       else intCheck(rm, 0, 8);
29282       return round(n3, n3.e + 1, rm);
29283     };
29284     P2.isEqualTo = P2.eq = function(y2, b2) {
29285       return compare(this, new BigNumber2(y2, b2)) === 0;
29286     };
29287     P2.isFinite = function() {
29288       return !!this.c;
29289     };
29290     P2.isGreaterThan = P2.gt = function(y2, b2) {
29291       return compare(this, new BigNumber2(y2, b2)) > 0;
29292     };
29293     P2.isGreaterThanOrEqualTo = P2.gte = function(y2, b2) {
29294       return (b2 = compare(this, new BigNumber2(y2, b2))) === 1 || b2 === 0;
29295     };
29296     P2.isInteger = function() {
29297       return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
29298     };
29299     P2.isLessThan = P2.lt = function(y2, b2) {
29300       return compare(this, new BigNumber2(y2, b2)) < 0;
29301     };
29302     P2.isLessThanOrEqualTo = P2.lte = function(y2, b2) {
29303       return (b2 = compare(this, new BigNumber2(y2, b2))) === -1 || b2 === 0;
29304     };
29305     P2.isNaN = function() {
29306       return !this.s;
29307     };
29308     P2.isNegative = function() {
29309       return this.s < 0;
29310     };
29311     P2.isPositive = function() {
29312       return this.s > 0;
29313     };
29314     P2.isZero = function() {
29315       return !!this.c && this.c[0] == 0;
29316     };
29317     P2.minus = function(y2, b2) {
29318       var i3, j2, t2, xLTy, x2 = this, a2 = x2.s;
29319       y2 = new BigNumber2(y2, b2);
29320       b2 = y2.s;
29321       if (!a2 || !b2) return new BigNumber2(NaN);
29322       if (a2 != b2) {
29323         y2.s = -b2;
29324         return x2.plus(y2);
29325       }
29326       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
29327       if (!xe2 || !ye2) {
29328         if (!xc || !yc) return xc ? (y2.s = -b2, y2) : new BigNumber2(yc ? x2 : NaN);
29329         if (!xc[0] || !yc[0]) {
29330           return yc[0] ? (y2.s = -b2, y2) : new BigNumber2(xc[0] ? x2 : (
29331             // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
29332             ROUNDING_MODE == 3 ? -0 : 0
29333           ));
29334         }
29335       }
29336       xe2 = bitFloor(xe2);
29337       ye2 = bitFloor(ye2);
29338       xc = xc.slice();
29339       if (a2 = xe2 - ye2) {
29340         if (xLTy = a2 < 0) {
29341           a2 = -a2;
29342           t2 = xc;
29343         } else {
29344           ye2 = xe2;
29345           t2 = yc;
29346         }
29347         t2.reverse();
29348         for (b2 = a2; b2--; t2.push(0)) ;
29349         t2.reverse();
29350       } else {
29351         j2 = (xLTy = (a2 = xc.length) < (b2 = yc.length)) ? a2 : b2;
29352         for (a2 = b2 = 0; b2 < j2; b2++) {
29353           if (xc[b2] != yc[b2]) {
29354             xLTy = xc[b2] < yc[b2];
29355             break;
29356           }
29357         }
29358       }
29359       if (xLTy) {
29360         t2 = xc;
29361         xc = yc;
29362         yc = t2;
29363         y2.s = -y2.s;
29364       }
29365       b2 = (j2 = yc.length) - (i3 = xc.length);
29366       if (b2 > 0) for (; b2--; xc[i3++] = 0) ;
29367       b2 = BASE - 1;
29368       for (; j2 > a2; ) {
29369         if (xc[--j2] < yc[j2]) {
29370           for (i3 = j2; i3 && !xc[--i3]; xc[i3] = b2) ;
29371           --xc[i3];
29372           xc[j2] += BASE;
29373         }
29374         xc[j2] -= yc[j2];
29375       }
29376       for (; xc[0] == 0; xc.splice(0, 1), --ye2) ;
29377       if (!xc[0]) {
29378         y2.s = ROUNDING_MODE == 3 ? -1 : 1;
29379         y2.c = [y2.e = 0];
29380         return y2;
29381       }
29382       return normalise(y2, xc, ye2);
29383     };
29384     P2.modulo = P2.mod = function(y2, b2) {
29385       var q2, s2, x2 = this;
29386       y2 = new BigNumber2(y2, b2);
29387       if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
29388         return new BigNumber2(NaN);
29389       } else if (!y2.c || x2.c && !x2.c[0]) {
29390         return new BigNumber2(x2);
29391       }
29392       if (MODULO_MODE == 9) {
29393         s2 = y2.s;
29394         y2.s = 1;
29395         q2 = div(x2, y2, 0, 3);
29396         y2.s = s2;
29397         q2.s *= s2;
29398       } else {
29399         q2 = div(x2, y2, 0, MODULO_MODE);
29400       }
29401       y2 = x2.minus(q2.times(y2));
29402       if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
29403       return y2;
29404     };
29405     P2.multipliedBy = P2.times = function(y2, b2) {
29406       var c2, e3, i3, j2, k2, m2, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b2)).c;
29407       if (!xc || !yc || !xc[0] || !yc[0]) {
29408         if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
29409           y2.c = y2.e = y2.s = null;
29410         } else {
29411           y2.s *= x2.s;
29412           if (!xc || !yc) {
29413             y2.c = y2.e = null;
29414           } else {
29415             y2.c = [0];
29416             y2.e = 0;
29417           }
29418         }
29419         return y2;
29420       }
29421       e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
29422       y2.s *= x2.s;
29423       xcL = xc.length;
29424       ycL = yc.length;
29425       if (xcL < ycL) {
29426         zc = xc;
29427         xc = yc;
29428         yc = zc;
29429         i3 = xcL;
29430         xcL = ycL;
29431         ycL = i3;
29432       }
29433       for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
29434       base = BASE;
29435       sqrtBase = SQRT_BASE;
29436       for (i3 = ycL; --i3 >= 0; ) {
29437         c2 = 0;
29438         ylo = yc[i3] % sqrtBase;
29439         yhi = yc[i3] / sqrtBase | 0;
29440         for (k2 = xcL, j2 = i3 + k2; j2 > i3; ) {
29441           xlo = xc[--k2] % sqrtBase;
29442           xhi = xc[k2] / sqrtBase | 0;
29443           m2 = yhi * xlo + xhi * ylo;
29444           xlo = ylo * xlo + m2 % sqrtBase * sqrtBase + zc[j2] + c2;
29445           c2 = (xlo / base | 0) + (m2 / sqrtBase | 0) + yhi * xhi;
29446           zc[j2--] = xlo % base;
29447         }
29448         zc[j2] = c2;
29449       }
29450       if (c2) {
29451         ++e3;
29452       } else {
29453         zc.splice(0, 1);
29454       }
29455       return normalise(y2, zc, e3);
29456     };
29457     P2.negated = function() {
29458       var x2 = new BigNumber2(this);
29459       x2.s = -x2.s || null;
29460       return x2;
29461     };
29462     P2.plus = function(y2, b2) {
29463       var t2, x2 = this, a2 = x2.s;
29464       y2 = new BigNumber2(y2, b2);
29465       b2 = y2.s;
29466       if (!a2 || !b2) return new BigNumber2(NaN);
29467       if (a2 != b2) {
29468         y2.s = -b2;
29469         return x2.minus(y2);
29470       }
29471       var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
29472       if (!xe2 || !ye2) {
29473         if (!xc || !yc) return new BigNumber2(a2 / 0);
29474         if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a2 * 0);
29475       }
29476       xe2 = bitFloor(xe2);
29477       ye2 = bitFloor(ye2);
29478       xc = xc.slice();
29479       if (a2 = xe2 - ye2) {
29480         if (a2 > 0) {
29481           ye2 = xe2;
29482           t2 = yc;
29483         } else {
29484           a2 = -a2;
29485           t2 = xc;
29486         }
29487         t2.reverse();
29488         for (; a2--; t2.push(0)) ;
29489         t2.reverse();
29490       }
29491       a2 = xc.length;
29492       b2 = yc.length;
29493       if (a2 - b2 < 0) {
29494         t2 = yc;
29495         yc = xc;
29496         xc = t2;
29497         b2 = a2;
29498       }
29499       for (a2 = 0; b2; ) {
29500         a2 = (xc[--b2] = xc[b2] + yc[b2] + a2) / BASE | 0;
29501         xc[b2] = BASE === xc[b2] ? 0 : xc[b2] % BASE;
29502       }
29503       if (a2) {
29504         xc = [a2].concat(xc);
29505         ++ye2;
29506       }
29507       return normalise(y2, xc, ye2);
29508     };
29509     P2.precision = P2.sd = function(sd, rm) {
29510       var c2, n3, v2, x2 = this;
29511       if (sd != null && sd !== !!sd) {
29512         intCheck(sd, 1, MAX);
29513         if (rm == null) rm = ROUNDING_MODE;
29514         else intCheck(rm, 0, 8);
29515         return round(new BigNumber2(x2), sd, rm);
29516       }
29517       if (!(c2 = x2.c)) return null;
29518       v2 = c2.length - 1;
29519       n3 = v2 * LOG_BASE + 1;
29520       if (v2 = c2[v2]) {
29521         for (; v2 % 10 == 0; v2 /= 10, n3--) ;
29522         for (v2 = c2[0]; v2 >= 10; v2 /= 10, n3++) ;
29523       }
29524       if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
29525       return n3;
29526     };
29527     P2.shiftedBy = function(k2) {
29528       intCheck(k2, -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3);
29529       return this.times("1e" + k2);
29530     };
29531     P2.squareRoot = P2.sqrt = function() {
29532       var m2, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
29533       if (s2 !== 1 || !c2 || !c2[0]) {
29534         return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
29535       }
29536       s2 = Math.sqrt(+valueOf(x2));
29537       if (s2 == 0 || s2 == 1 / 0) {
29538         n3 = coeffToString(c2);
29539         if ((n3.length + e3) % 2 == 0) n3 += "0";
29540         s2 = Math.sqrt(+n3);
29541         e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
29542         if (s2 == 1 / 0) {
29543           n3 = "5e" + e3;
29544         } else {
29545           n3 = s2.toExponential();
29546           n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
29547         }
29548         r2 = new BigNumber2(n3);
29549       } else {
29550         r2 = new BigNumber2(s2 + "");
29551       }
29552       if (r2.c[0]) {
29553         e3 = r2.e;
29554         s2 = e3 + dp;
29555         if (s2 < 3) s2 = 0;
29556         for (; ; ) {
29557           t2 = r2;
29558           r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
29559           if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
29560             if (r2.e < e3) --s2;
29561             n3 = n3.slice(s2 - 3, s2 + 1);
29562             if (n3 == "9999" || !rep && n3 == "4999") {
29563               if (!rep) {
29564                 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
29565                 if (t2.times(t2).eq(x2)) {
29566                   r2 = t2;
29567                   break;
29568                 }
29569               }
29570               dp += 4;
29571               s2 += 4;
29572               rep = 1;
29573             } else {
29574               if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
29575                 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
29576                 m2 = !r2.times(r2).eq(x2);
29577               }
29578               break;
29579             }
29580           }
29581         }
29582       }
29583       return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m2);
29584     };
29585     P2.toExponential = function(dp, rm) {
29586       if (dp != null) {
29587         intCheck(dp, 0, MAX);
29588         dp++;
29589       }
29590       return format2(this, dp, rm, 1);
29591     };
29592     P2.toFixed = function(dp, rm) {
29593       if (dp != null) {
29594         intCheck(dp, 0, MAX);
29595         dp = dp + this.e + 1;
29596       }
29597       return format2(this, dp, rm);
29598     };
29599     P2.toFormat = function(dp, rm, format3) {
29600       var str, x2 = this;
29601       if (format3 == null) {
29602         if (dp != null && rm && typeof rm == "object") {
29603           format3 = rm;
29604           rm = null;
29605         } else if (dp && typeof dp == "object") {
29606           format3 = dp;
29607           dp = rm = null;
29608         } else {
29609           format3 = FORMAT;
29610         }
29611       } else if (typeof format3 != "object") {
29612         throw Error(bignumberError + "Argument not an object: " + format3);
29613       }
29614       str = x2.toFixed(dp, rm);
29615       if (x2.c) {
29616         var i3, arr = str.split("."), g1 = +format3.groupSize, g22 = +format3.secondaryGroupSize, groupSeparator = format3.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x2.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
29617         if (g22) {
29618           i3 = g1;
29619           g1 = g22;
29620           g22 = i3;
29621           len -= i3;
29622         }
29623         if (g1 > 0 && len > 0) {
29624           i3 = len % g1 || g1;
29625           intPart = intDigits.substr(0, i3);
29626           for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
29627           if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
29628           if (isNeg) intPart = "-" + intPart;
29629         }
29630         str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
29631           new RegExp("\\d{" + g22 + "}\\B", "g"),
29632           "$&" + (format3.fractionGroupSeparator || "")
29633         ) : fractionPart) : intPart;
29634       }
29635       return (format3.prefix || "") + str + (format3.suffix || "");
29636     };
29637     P2.toFraction = function(md) {
29638       var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q2, r2, s2, x2 = this, xc = x2.c;
29639       if (md != null) {
29640         n3 = new BigNumber2(md);
29641         if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
29642           throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
29643         }
29644       }
29645       if (!xc) return new BigNumber2(x2);
29646       d2 = new BigNumber2(ONE);
29647       n1 = d0 = new BigNumber2(ONE);
29648       d1 = n0 = new BigNumber2(ONE);
29649       s2 = coeffToString(xc);
29650       e3 = d2.e = s2.length - x2.e - 1;
29651       d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
29652       md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
29653       exp2 = MAX_EXP;
29654       MAX_EXP = 1 / 0;
29655       n3 = new BigNumber2(s2);
29656       n0.c[0] = 0;
29657       for (; ; ) {
29658         q2 = div(n3, d2, 0, 1);
29659         d22 = d0.plus(q2.times(d1));
29660         if (d22.comparedTo(md) == 1) break;
29661         d0 = d1;
29662         d1 = d22;
29663         n1 = n0.plus(q2.times(d22 = n1));
29664         n0 = d22;
29665         d2 = n3.minus(q2.times(d22 = d2));
29666         n3 = d22;
29667       }
29668       d22 = div(md.minus(d0), d1, 0, 1);
29669       n0 = n0.plus(d22.times(n1));
29670       d0 = d0.plus(d22.times(d1));
29671       n0.s = n1.s = x2.s;
29672       e3 = e3 * 2;
29673       r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
29674         div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
29675       ) < 1 ? [n1, d1] : [n0, d0];
29676       MAX_EXP = exp2;
29677       return r2;
29678     };
29679     P2.toNumber = function() {
29680       return +valueOf(this);
29681     };
29682     P2.toPrecision = function(sd, rm) {
29683       if (sd != null) intCheck(sd, 1, MAX);
29684       return format2(this, sd, rm, 2);
29685     };
29686     P2.toString = function(b2) {
29687       var str, n3 = this, s2 = n3.s, e3 = n3.e;
29688       if (e3 === null) {
29689         if (s2) {
29690           str = "Infinity";
29691           if (s2 < 0) str = "-" + str;
29692         } else {
29693           str = "NaN";
29694         }
29695       } else {
29696         if (b2 == null) {
29697           str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
29698         } else if (b2 === 10 && alphabetHasNormalDecimalDigits) {
29699           n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
29700           str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
29701         } else {
29702           intCheck(b2, 2, ALPHABET.length, "Base");
29703           str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b2, s2, true);
29704         }
29705         if (s2 < 0 && n3.c[0]) str = "-" + str;
29706       }
29707       return str;
29708     };
29709     P2.valueOf = P2.toJSON = function() {
29710       return valueOf(this);
29711     };
29712     P2._isBigNumber = true;
29713     P2[Symbol.toStringTag] = "BigNumber";
29714     P2[Symbol.for("nodejs.util.inspect.custom")] = P2.valueOf;
29715     if (configObject != null) BigNumber2.set(configObject);
29716     return BigNumber2;
29717   }
29718   function bitFloor(n3) {
29719     var i3 = n3 | 0;
29720     return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
29721   }
29722   function coeffToString(a2) {
29723     var s2, z2, i3 = 1, j2 = a2.length, r2 = a2[0] + "";
29724     for (; i3 < j2; ) {
29725       s2 = a2[i3++] + "";
29726       z2 = LOG_BASE - s2.length;
29727       for (; z2--; s2 = "0" + s2) ;
29728       r2 += s2;
29729     }
29730     for (j2 = r2.length; r2.charCodeAt(--j2) === 48; ) ;
29731     return r2.slice(0, j2 + 1 || 1);
29732   }
29733   function compare(x2, y2) {
29734     var a2, b2, xc = x2.c, yc = y2.c, i3 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
29735     if (!i3 || !j2) return null;
29736     a2 = xc && !xc[0];
29737     b2 = yc && !yc[0];
29738     if (a2 || b2) return a2 ? b2 ? 0 : -j2 : i3;
29739     if (i3 != j2) return i3;
29740     a2 = i3 < 0;
29741     b2 = k2 == l2;
29742     if (!xc || !yc) return b2 ? 0 : !xc ^ a2 ? 1 : -1;
29743     if (!b2) return k2 > l2 ^ a2 ? 1 : -1;
29744     j2 = (k2 = xc.length) < (l2 = yc.length) ? k2 : l2;
29745     for (i3 = 0; i3 < j2; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a2 ? 1 : -1;
29746     return k2 == l2 ? 0 : k2 > l2 ^ a2 ? 1 : -1;
29747   }
29748   function intCheck(n3, min3, max3, name) {
29749     if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
29750       throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
29751     }
29752   }
29753   function isOdd(n3) {
29754     var k2 = n3.c.length - 1;
29755     return bitFloor(n3.e / LOG_BASE) == k2 && n3.c[k2] % 2 != 0;
29756   }
29757   function toExponential(str, e3) {
29758     return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
29759   }
29760   function toFixedPoint(str, e3, z2) {
29761     var len, zs;
29762     if (e3 < 0) {
29763       for (zs = z2 + "."; ++e3; zs += z2) ;
29764       str = zs + str;
29765     } else {
29766       len = str.length;
29767       if (++e3 > len) {
29768         for (zs = z2, e3 -= len; --e3; zs += z2) ;
29769         str += zs;
29770       } else if (e3 < len) {
29771         str = str.slice(0, e3) + "." + str.slice(e3);
29772       }
29773     }
29774     return str;
29775   }
29776   var isNumeric, mathceil, mathfloor, bignumberError, tooManyDigits, BASE, LOG_BASE, MAX_SAFE_INTEGER3, POWS_TEN, SQRT_BASE, MAX, BigNumber, bignumber_default;
29777   var init_bignumber = __esm({
29778     "node_modules/bignumber.js/bignumber.mjs"() {
29779       isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
29780       mathceil = Math.ceil;
29781       mathfloor = Math.floor;
29782       bignumberError = "[BigNumber Error] ";
29783       tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
29784       BASE = 1e14;
29785       LOG_BASE = 14;
29786       MAX_SAFE_INTEGER3 = 9007199254740991;
29787       POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
29788       SQRT_BASE = 1e7;
29789       MAX = 1e9;
29790       BigNumber = clone();
29791       bignumber_default = BigNumber;
29792     }
29793   });
29794
29795   // node_modules/splaytree-ts/dist/esm/index.js
29796   var SplayTreeNode, SplayTreeSetNode, SplayTree, _a, _b, SplayTreeSet, SplayTreeIterableIterator, SplayTreeKeyIterableIterator, SplayTreeSetEntryIterableIterator;
29797   var init_esm = __esm({
29798     "node_modules/splaytree-ts/dist/esm/index.js"() {
29799       SplayTreeNode = class {
29800         constructor(key) {
29801           __publicField(this, "key");
29802           __publicField(this, "left", null);
29803           __publicField(this, "right", null);
29804           this.key = key;
29805         }
29806       };
29807       SplayTreeSetNode = class extends SplayTreeNode {
29808         constructor(key) {
29809           super(key);
29810         }
29811       };
29812       SplayTree = class {
29813         constructor() {
29814           __publicField(this, "size", 0);
29815           __publicField(this, "modificationCount", 0);
29816           __publicField(this, "splayCount", 0);
29817         }
29818         splay(key) {
29819           const root3 = this.root;
29820           if (root3 == null) {
29821             this.compare(key, key);
29822             return -1;
29823           }
29824           let right = null;
29825           let newTreeRight = null;
29826           let left = null;
29827           let newTreeLeft = null;
29828           let current = root3;
29829           const compare2 = this.compare;
29830           let comp;
29831           while (true) {
29832             comp = compare2(current.key, key);
29833             if (comp > 0) {
29834               let currentLeft = current.left;
29835               if (currentLeft == null) break;
29836               comp = compare2(currentLeft.key, key);
29837               if (comp > 0) {
29838                 current.left = currentLeft.right;
29839                 currentLeft.right = current;
29840                 current = currentLeft;
29841                 currentLeft = current.left;
29842                 if (currentLeft == null) break;
29843               }
29844               if (right == null) {
29845                 newTreeRight = current;
29846               } else {
29847                 right.left = current;
29848               }
29849               right = current;
29850               current = currentLeft;
29851             } else if (comp < 0) {
29852               let currentRight = current.right;
29853               if (currentRight == null) break;
29854               comp = compare2(currentRight.key, key);
29855               if (comp < 0) {
29856                 current.right = currentRight.left;
29857                 currentRight.left = current;
29858                 current = currentRight;
29859                 currentRight = current.right;
29860                 if (currentRight == null) break;
29861               }
29862               if (left == null) {
29863                 newTreeLeft = current;
29864               } else {
29865                 left.right = current;
29866               }
29867               left = current;
29868               current = currentRight;
29869             } else {
29870               break;
29871             }
29872           }
29873           if (left != null) {
29874             left.right = current.left;
29875             current.left = newTreeLeft;
29876           }
29877           if (right != null) {
29878             right.left = current.right;
29879             current.right = newTreeRight;
29880           }
29881           if (this.root !== current) {
29882             this.root = current;
29883             this.splayCount++;
29884           }
29885           return comp;
29886         }
29887         splayMin(node) {
29888           let current = node;
29889           let nextLeft = current.left;
29890           while (nextLeft != null) {
29891             const left = nextLeft;
29892             current.left = left.right;
29893             left.right = current;
29894             current = left;
29895             nextLeft = current.left;
29896           }
29897           return current;
29898         }
29899         splayMax(node) {
29900           let current = node;
29901           let nextRight = current.right;
29902           while (nextRight != null) {
29903             const right = nextRight;
29904             current.right = right.left;
29905             right.left = current;
29906             current = right;
29907             nextRight = current.right;
29908           }
29909           return current;
29910         }
29911         _delete(key) {
29912           if (this.root == null) return null;
29913           const comp = this.splay(key);
29914           if (comp != 0) return null;
29915           let root3 = this.root;
29916           const result = root3;
29917           const left = root3.left;
29918           this.size--;
29919           if (left == null) {
29920             this.root = root3.right;
29921           } else {
29922             const right = root3.right;
29923             root3 = this.splayMax(left);
29924             root3.right = right;
29925             this.root = root3;
29926           }
29927           this.modificationCount++;
29928           return result;
29929         }
29930         addNewRoot(node, comp) {
29931           this.size++;
29932           this.modificationCount++;
29933           const root3 = this.root;
29934           if (root3 == null) {
29935             this.root = node;
29936             return;
29937           }
29938           if (comp < 0) {
29939             node.left = root3;
29940             node.right = root3.right;
29941             root3.right = null;
29942           } else {
29943             node.right = root3;
29944             node.left = root3.left;
29945             root3.left = null;
29946           }
29947           this.root = node;
29948         }
29949         _first() {
29950           const root3 = this.root;
29951           if (root3 == null) return null;
29952           this.root = this.splayMin(root3);
29953           return this.root;
29954         }
29955         _last() {
29956           const root3 = this.root;
29957           if (root3 == null) return null;
29958           this.root = this.splayMax(root3);
29959           return this.root;
29960         }
29961         clear() {
29962           this.root = null;
29963           this.size = 0;
29964           this.modificationCount++;
29965         }
29966         has(key) {
29967           return this.validKey(key) && this.splay(key) == 0;
29968         }
29969         defaultCompare() {
29970           return (a2, b2) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
29971         }
29972         wrap() {
29973           return {
29974             getRoot: () => {
29975               return this.root;
29976             },
29977             setRoot: (root3) => {
29978               this.root = root3;
29979             },
29980             getSize: () => {
29981               return this.size;
29982             },
29983             getModificationCount: () => {
29984               return this.modificationCount;
29985             },
29986             getSplayCount: () => {
29987               return this.splayCount;
29988             },
29989             setSplayCount: (count) => {
29990               this.splayCount = count;
29991             },
29992             splay: (key) => {
29993               return this.splay(key);
29994             },
29995             has: (key) => {
29996               return this.has(key);
29997             }
29998           };
29999         }
30000       };
30001       SplayTreeSet = class _SplayTreeSet extends SplayTree {
30002         constructor(compare2, isValidKey) {
30003           super();
30004           __publicField(this, "root", null);
30005           __publicField(this, "compare");
30006           __publicField(this, "validKey");
30007           __publicField(this, _a, "[object Set]");
30008           this.compare = compare2 != null ? compare2 : this.defaultCompare();
30009           this.validKey = isValidKey != null ? isValidKey : (v2) => v2 != null && v2 != void 0;
30010         }
30011         delete(element) {
30012           if (!this.validKey(element)) return false;
30013           return this._delete(element) != null;
30014         }
30015         deleteAll(elements) {
30016           for (const element of elements) {
30017             this.delete(element);
30018           }
30019         }
30020         forEach(f2) {
30021           const nodes = this[Symbol.iterator]();
30022           let result;
30023           while (result = nodes.next(), !result.done) {
30024             f2(result.value, result.value, this);
30025           }
30026         }
30027         add(element) {
30028           const compare2 = this.splay(element);
30029           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
30030           return this;
30031         }
30032         addAndReturn(element) {
30033           const compare2 = this.splay(element);
30034           if (compare2 != 0) this.addNewRoot(new SplayTreeSetNode(element), compare2);
30035           return this.root.key;
30036         }
30037         addAll(elements) {
30038           for (const element of elements) {
30039             this.add(element);
30040           }
30041         }
30042         isEmpty() {
30043           return this.root == null;
30044         }
30045         isNotEmpty() {
30046           return this.root != null;
30047         }
30048         single() {
30049           if (this.size == 0) throw "Bad state: No element";
30050           if (this.size > 1) throw "Bad state: Too many element";
30051           return this.root.key;
30052         }
30053         first() {
30054           if (this.size == 0) throw "Bad state: No element";
30055           return this._first().key;
30056         }
30057         last() {
30058           if (this.size == 0) throw "Bad state: No element";
30059           return this._last().key;
30060         }
30061         lastBefore(element) {
30062           if (element == null) throw "Invalid arguments(s)";
30063           if (this.root == null) return null;
30064           const comp = this.splay(element);
30065           if (comp < 0) return this.root.key;
30066           let node = this.root.left;
30067           if (node == null) return null;
30068           let nodeRight = node.right;
30069           while (nodeRight != null) {
30070             node = nodeRight;
30071             nodeRight = node.right;
30072           }
30073           return node.key;
30074         }
30075         firstAfter(element) {
30076           if (element == null) throw "Invalid arguments(s)";
30077           if (this.root == null) return null;
30078           const comp = this.splay(element);
30079           if (comp > 0) return this.root.key;
30080           let node = this.root.right;
30081           if (node == null) return null;
30082           let nodeLeft = node.left;
30083           while (nodeLeft != null) {
30084             node = nodeLeft;
30085             nodeLeft = node.left;
30086           }
30087           return node.key;
30088         }
30089         retainAll(elements) {
30090           const retainSet = new _SplayTreeSet(this.compare, this.validKey);
30091           const modificationCount = this.modificationCount;
30092           for (const object of elements) {
30093             if (modificationCount != this.modificationCount) {
30094               throw "Concurrent modification during iteration.";
30095             }
30096             if (this.validKey(object) && this.splay(object) == 0) {
30097               retainSet.add(this.root.key);
30098             }
30099           }
30100           if (retainSet.size != this.size) {
30101             this.root = retainSet.root;
30102             this.size = retainSet.size;
30103             this.modificationCount++;
30104           }
30105         }
30106         lookup(object) {
30107           if (!this.validKey(object)) return null;
30108           const comp = this.splay(object);
30109           if (comp != 0) return null;
30110           return this.root.key;
30111         }
30112         intersection(other2) {
30113           const result = new _SplayTreeSet(this.compare, this.validKey);
30114           for (const element of this) {
30115             if (other2.has(element)) result.add(element);
30116           }
30117           return result;
30118         }
30119         difference(other2) {
30120           const result = new _SplayTreeSet(this.compare, this.validKey);
30121           for (const element of this) {
30122             if (!other2.has(element)) result.add(element);
30123           }
30124           return result;
30125         }
30126         union(other2) {
30127           const u2 = this.clone();
30128           u2.addAll(other2);
30129           return u2;
30130         }
30131         clone() {
30132           const set4 = new _SplayTreeSet(this.compare, this.validKey);
30133           set4.size = this.size;
30134           set4.root = this.copyNode(this.root);
30135           return set4;
30136         }
30137         copyNode(node) {
30138           if (node == null) return null;
30139           function copyChildren(node2, dest) {
30140             let left;
30141             let right;
30142             do {
30143               left = node2.left;
30144               right = node2.right;
30145               if (left != null) {
30146                 const newLeft = new SplayTreeSetNode(left.key);
30147                 dest.left = newLeft;
30148                 copyChildren(left, newLeft);
30149               }
30150               if (right != null) {
30151                 const newRight = new SplayTreeSetNode(right.key);
30152                 dest.right = newRight;
30153                 node2 = right;
30154                 dest = newRight;
30155               }
30156             } while (right != null);
30157           }
30158           const result = new SplayTreeSetNode(node.key);
30159           copyChildren(node, result);
30160           return result;
30161         }
30162         toSet() {
30163           return this.clone();
30164         }
30165         entries() {
30166           return new SplayTreeSetEntryIterableIterator(this.wrap());
30167         }
30168         keys() {
30169           return this[Symbol.iterator]();
30170         }
30171         values() {
30172           return this[Symbol.iterator]();
30173         }
30174         [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
30175           return new SplayTreeKeyIterableIterator(this.wrap());
30176         }
30177       };
30178       SplayTreeIterableIterator = class {
30179         constructor(tree) {
30180           __publicField(this, "tree");
30181           __publicField(this, "path", new Array());
30182           __publicField(this, "modificationCount", null);
30183           __publicField(this, "splayCount");
30184           this.tree = tree;
30185           this.splayCount = tree.getSplayCount();
30186         }
30187         [Symbol.iterator]() {
30188           return this;
30189         }
30190         next() {
30191           if (this.moveNext()) return { done: false, value: this.current() };
30192           return { done: true, value: null };
30193         }
30194         current() {
30195           if (!this.path.length) return null;
30196           const node = this.path[this.path.length - 1];
30197           return this.getValue(node);
30198         }
30199         rebuildPath(key) {
30200           this.path.splice(0, this.path.length);
30201           this.tree.splay(key);
30202           this.path.push(this.tree.getRoot());
30203           this.splayCount = this.tree.getSplayCount();
30204         }
30205         findLeftMostDescendent(node) {
30206           while (node != null) {
30207             this.path.push(node);
30208             node = node.left;
30209           }
30210         }
30211         moveNext() {
30212           if (this.modificationCount != this.tree.getModificationCount()) {
30213             if (this.modificationCount == null) {
30214               this.modificationCount = this.tree.getModificationCount();
30215               let node2 = this.tree.getRoot();
30216               while (node2 != null) {
30217                 this.path.push(node2);
30218                 node2 = node2.left;
30219               }
30220               return this.path.length > 0;
30221             }
30222             throw "Concurrent modification during iteration.";
30223           }
30224           if (!this.path.length) return false;
30225           if (this.splayCount != this.tree.getSplayCount()) {
30226             this.rebuildPath(this.path[this.path.length - 1].key);
30227           }
30228           let node = this.path[this.path.length - 1];
30229           let next = node.right;
30230           if (next != null) {
30231             while (next != null) {
30232               this.path.push(next);
30233               next = next.left;
30234             }
30235             return true;
30236           }
30237           this.path.pop();
30238           while (this.path.length && this.path[this.path.length - 1].right === node) {
30239             node = this.path.pop();
30240           }
30241           return this.path.length > 0;
30242         }
30243       };
30244       SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
30245         getValue(node) {
30246           return node.key;
30247         }
30248       };
30249       SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
30250         getValue(node) {
30251           return [node.key, node.key];
30252         }
30253       };
30254     }
30255   });
30256
30257   // node_modules/polyclip-ts/dist/esm/index.js
30258   function orient_default(eps) {
30259     const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(
30260       cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)
30261     ) : constant_default6(false);
30262     return (a2, b2, c2) => {
30263       const ax = a2.x, ay = a2.y, cx = c2.x, cy = c2.y;
30264       const area2 = ay.minus(cy).times(b2.x.minus(cx)).minus(ax.minus(cx).times(b2.y.minus(cy)));
30265       if (almostCollinear(area2, ax, ay, cx, cy)) return 0;
30266       return area2.comparedTo(0);
30267     };
30268   }
30269   var constant_default6, compare_default, identity_default4, snap_default, set3, precision, isInBbox, getBboxOverlap, crossProduct, dotProduct, length, sineOfAngle, cosineOfAngle, horizontalIntersection, verticalIntersection, intersection, SweepEvent, RingOut, PolyOut, MultiPolyOut, SweepLine, Operation, operation, operation_default, segmentId, Segment, RingIn, PolyIn, MultiPolyIn, union, difference, setPrecision;
30270   var init_esm2 = __esm({
30271     "node_modules/polyclip-ts/dist/esm/index.js"() {
30272       init_bignumber();
30273       init_bignumber();
30274       init_esm();
30275       init_esm();
30276       init_esm();
30277       constant_default6 = (x2) => {
30278         return () => {
30279           return x2;
30280         };
30281       };
30282       compare_default = (eps) => {
30283         const almostEqual = eps ? (a2, b2) => b2.minus(a2).abs().isLessThanOrEqualTo(eps) : constant_default6(false);
30284         return (a2, b2) => {
30285           if (almostEqual(a2, b2)) return 0;
30286           return a2.comparedTo(b2);
30287         };
30288       };
30289       identity_default4 = (x2) => {
30290         return x2;
30291       };
30292       snap_default = (eps) => {
30293         if (eps) {
30294           const xTree = new SplayTreeSet(compare_default(eps));
30295           const yTree = new SplayTreeSet(compare_default(eps));
30296           const snapCoord = (coord2, tree) => {
30297             return tree.addAndReturn(coord2);
30298           };
30299           const snap = (v2) => {
30300             return {
30301               x: snapCoord(v2.x, xTree),
30302               y: snapCoord(v2.y, yTree)
30303             };
30304           };
30305           snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
30306           return snap;
30307         }
30308         return identity_default4;
30309       };
30310       set3 = (eps) => {
30311         return {
30312           set: (eps2) => {
30313             precision = set3(eps2);
30314           },
30315           reset: () => set3(eps),
30316           compare: compare_default(eps),
30317           snap: snap_default(eps),
30318           orient: orient_default(eps)
30319         };
30320       };
30321       precision = set3();
30322       isInBbox = (bbox2, point) => {
30323         return bbox2.ll.x.isLessThanOrEqualTo(point.x) && point.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point.y) && point.y.isLessThanOrEqualTo(bbox2.ur.y);
30324       };
30325       getBboxOverlap = (b1, b2) => {
30326         if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
30327           return null;
30328         const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;
30329         const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;
30330         const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;
30331         const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;
30332         return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
30333       };
30334       crossProduct = (a2, b2) => a2.x.times(b2.y).minus(a2.y.times(b2.x));
30335       dotProduct = (a2, b2) => a2.x.times(b2.x).plus(a2.y.times(b2.y));
30336       length = (v2) => dotProduct(v2, v2).sqrt();
30337       sineOfAngle = (pShared, pBase, pAngle) => {
30338         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
30339         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
30340         return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
30341       };
30342       cosineOfAngle = (pShared, pBase, pAngle) => {
30343         const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
30344         const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
30345         return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
30346       };
30347       horizontalIntersection = (pt2, v2, y2) => {
30348         if (v2.y.isZero()) return null;
30349         return { x: pt2.x.plus(v2.x.div(v2.y).times(y2.minus(pt2.y))), y: y2 };
30350       };
30351       verticalIntersection = (pt2, v2, x2) => {
30352         if (v2.x.isZero()) return null;
30353         return { x: x2, y: pt2.y.plus(v2.y.div(v2.x).times(x2.minus(pt2.x))) };
30354       };
30355       intersection = (pt1, v1, pt2, v2) => {
30356         if (v1.x.isZero()) return verticalIntersection(pt2, v2, pt1.x);
30357         if (v2.x.isZero()) return verticalIntersection(pt1, v1, pt2.x);
30358         if (v1.y.isZero()) return horizontalIntersection(pt2, v2, pt1.y);
30359         if (v2.y.isZero()) return horizontalIntersection(pt1, v1, pt2.y);
30360         const kross = crossProduct(v1, v2);
30361         if (kross.isZero()) return null;
30362         const ve2 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
30363         const d1 = crossProduct(ve2, v1).div(kross);
30364         const d2 = crossProduct(ve2, v2).div(kross);
30365         const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));
30366         const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));
30367         const x3 = x12.plus(x2).div(2);
30368         const y3 = y12.plus(y2).div(2);
30369         return { x: x3, y: y3 };
30370       };
30371       SweepEvent = class _SweepEvent {
30372         // Warning: 'point' input will be modified and re-used (for performance)
30373         constructor(point, isLeft) {
30374           __publicField(this, "point");
30375           __publicField(this, "isLeft");
30376           __publicField(this, "segment");
30377           __publicField(this, "otherSE");
30378           __publicField(this, "consumedBy");
30379           if (point.events === void 0) point.events = [this];
30380           else point.events.push(this);
30381           this.point = point;
30382           this.isLeft = isLeft;
30383         }
30384         // for ordering sweep events in the sweep event queue
30385         static compare(a2, b2) {
30386           const ptCmp = _SweepEvent.comparePoints(a2.point, b2.point);
30387           if (ptCmp !== 0) return ptCmp;
30388           if (a2.point !== b2.point) a2.link(b2);
30389           if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
30390           return Segment.compare(a2.segment, b2.segment);
30391         }
30392         // for ordering points in sweep line order
30393         static comparePoints(aPt, bPt) {
30394           if (aPt.x.isLessThan(bPt.x)) return -1;
30395           if (aPt.x.isGreaterThan(bPt.x)) return 1;
30396           if (aPt.y.isLessThan(bPt.y)) return -1;
30397           if (aPt.y.isGreaterThan(bPt.y)) return 1;
30398           return 0;
30399         }
30400         link(other2) {
30401           if (other2.point === this.point) {
30402             throw new Error("Tried to link already linked events");
30403           }
30404           const otherEvents = other2.point.events;
30405           for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
30406             const evt = otherEvents[i3];
30407             this.point.events.push(evt);
30408             evt.point = this.point;
30409           }
30410           this.checkForConsuming();
30411         }
30412         /* Do a pass over our linked events and check to see if any pair
30413          * of segments match, and should be consumed. */
30414         checkForConsuming() {
30415           const numEvents = this.point.events.length;
30416           for (let i3 = 0; i3 < numEvents; i3++) {
30417             const evt1 = this.point.events[i3];
30418             if (evt1.segment.consumedBy !== void 0) continue;
30419             for (let j2 = i3 + 1; j2 < numEvents; j2++) {
30420               const evt2 = this.point.events[j2];
30421               if (evt2.consumedBy !== void 0) continue;
30422               if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
30423               evt1.segment.consume(evt2.segment);
30424             }
30425           }
30426         }
30427         getAvailableLinkedEvents() {
30428           const events = [];
30429           for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
30430             const evt = this.point.events[i3];
30431             if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
30432               events.push(evt);
30433             }
30434           }
30435           return events;
30436         }
30437         /**
30438          * Returns a comparator function for sorting linked events that will
30439          * favor the event that will give us the smallest left-side angle.
30440          * All ring construction starts as low as possible heading to the right,
30441          * so by always turning left as sharp as possible we'll get polygons
30442          * without uncessary loops & holes.
30443          *
30444          * The comparator function has a compute cache such that it avoids
30445          * re-computing already-computed values.
30446          */
30447         getLeftmostComparator(baseEvent) {
30448           const cache = /* @__PURE__ */ new Map();
30449           const fillCache = (linkedEvent) => {
30450             const nextEvent = linkedEvent.otherSE;
30451             cache.set(linkedEvent, {
30452               sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
30453               cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
30454             });
30455           };
30456           return (a2, b2) => {
30457             if (!cache.has(a2)) fillCache(a2);
30458             if (!cache.has(b2)) fillCache(b2);
30459             const { sine: asine, cosine: acosine } = cache.get(a2);
30460             const { sine: bsine, cosine: bcosine } = cache.get(b2);
30461             if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
30462               if (acosine.isLessThan(bcosine)) return 1;
30463               if (acosine.isGreaterThan(bcosine)) return -1;
30464               return 0;
30465             }
30466             if (asine.isLessThan(0) && bsine.isLessThan(0)) {
30467               if (acosine.isLessThan(bcosine)) return -1;
30468               if (acosine.isGreaterThan(bcosine)) return 1;
30469               return 0;
30470             }
30471             if (bsine.isLessThan(asine)) return -1;
30472             if (bsine.isGreaterThan(asine)) return 1;
30473             return 0;
30474           };
30475         }
30476       };
30477       RingOut = class _RingOut {
30478         constructor(events) {
30479           __publicField(this, "events");
30480           __publicField(this, "poly");
30481           __publicField(this, "_isExteriorRing");
30482           __publicField(this, "_enclosingRing");
30483           this.events = events;
30484           for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
30485             events[i3].segment.ringOut = this;
30486           }
30487           this.poly = null;
30488         }
30489         /* Given the segments from the sweep line pass, compute & return a series
30490          * of closed rings from all the segments marked to be part of the result */
30491         static factory(allSegments) {
30492           const ringsOut = [];
30493           for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
30494             const segment = allSegments[i3];
30495             if (!segment.isInResult() || segment.ringOut) continue;
30496             let prevEvent = null;
30497             let event = segment.leftSE;
30498             let nextEvent = segment.rightSE;
30499             const events = [event];
30500             const startingPoint = event.point;
30501             const intersectionLEs = [];
30502             while (true) {
30503               prevEvent = event;
30504               event = nextEvent;
30505               events.push(event);
30506               if (event.point === startingPoint) break;
30507               while (true) {
30508                 const availableLEs = event.getAvailableLinkedEvents();
30509                 if (availableLEs.length === 0) {
30510                   const firstPt = events[0].point;
30511                   const lastPt = events[events.length - 1].point;
30512                   throw new Error(
30513                     `Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`
30514                   );
30515                 }
30516                 if (availableLEs.length === 1) {
30517                   nextEvent = availableLEs[0].otherSE;
30518                   break;
30519                 }
30520                 let indexLE = null;
30521                 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
30522                   if (intersectionLEs[j2].point === event.point) {
30523                     indexLE = j2;
30524                     break;
30525                   }
30526                 }
30527                 if (indexLE !== null) {
30528                   const intersectionLE = intersectionLEs.splice(indexLE)[0];
30529                   const ringEvents = events.splice(intersectionLE.index);
30530                   ringEvents.unshift(ringEvents[0].otherSE);
30531                   ringsOut.push(new _RingOut(ringEvents.reverse()));
30532                   continue;
30533                 }
30534                 intersectionLEs.push({
30535                   index: events.length,
30536                   point: event.point
30537                 });
30538                 const comparator = event.getLeftmostComparator(prevEvent);
30539                 nextEvent = availableLEs.sort(comparator)[0].otherSE;
30540                 break;
30541               }
30542             }
30543             ringsOut.push(new _RingOut(events));
30544           }
30545           return ringsOut;
30546         }
30547         getGeom() {
30548           let prevPt = this.events[0].point;
30549           const points = [prevPt];
30550           for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
30551             const pt22 = this.events[i3].point;
30552             const nextPt2 = this.events[i3 + 1].point;
30553             if (precision.orient(pt22, prevPt, nextPt2) === 0) continue;
30554             points.push(pt22);
30555             prevPt = pt22;
30556           }
30557           if (points.length === 1) return null;
30558           const pt2 = points[0];
30559           const nextPt = points[1];
30560           if (precision.orient(pt2, prevPt, nextPt) === 0) points.shift();
30561           points.push(points[0]);
30562           const step = this.isExteriorRing() ? 1 : -1;
30563           const iStart = this.isExteriorRing() ? 0 : points.length - 1;
30564           const iEnd = this.isExteriorRing() ? points.length : -1;
30565           const orderedPoints = [];
30566           for (let i3 = iStart; i3 != iEnd; i3 += step)
30567             orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
30568           return orderedPoints;
30569         }
30570         isExteriorRing() {
30571           if (this._isExteriorRing === void 0) {
30572             const enclosing = this.enclosingRing();
30573             this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
30574           }
30575           return this._isExteriorRing;
30576         }
30577         enclosingRing() {
30578           if (this._enclosingRing === void 0) {
30579             this._enclosingRing = this._calcEnclosingRing();
30580           }
30581           return this._enclosingRing;
30582         }
30583         /* Returns the ring that encloses this one, if any */
30584         _calcEnclosingRing() {
30585           var _a3, _b2;
30586           let leftMostEvt = this.events[0];
30587           for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
30588             const evt = this.events[i3];
30589             if (SweepEvent.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
30590           }
30591           let prevSeg = leftMostEvt.segment.prevInResult();
30592           let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
30593           while (true) {
30594             if (!prevSeg) return null;
30595             if (!prevPrevSeg) return prevSeg.ringOut;
30596             if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
30597               if (((_a3 = prevPrevSeg.ringOut) == null ? void 0 : _a3.enclosingRing()) !== prevSeg.ringOut) {
30598                 return prevSeg.ringOut;
30599               } else return (_b2 = prevSeg.ringOut) == null ? void 0 : _b2.enclosingRing();
30600             }
30601             prevSeg = prevPrevSeg.prevInResult();
30602             prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
30603           }
30604         }
30605       };
30606       PolyOut = class {
30607         constructor(exteriorRing) {
30608           __publicField(this, "exteriorRing");
30609           __publicField(this, "interiorRings");
30610           this.exteriorRing = exteriorRing;
30611           exteriorRing.poly = this;
30612           this.interiorRings = [];
30613         }
30614         addInterior(ring) {
30615           this.interiorRings.push(ring);
30616           ring.poly = this;
30617         }
30618         getGeom() {
30619           const geom0 = this.exteriorRing.getGeom();
30620           if (geom0 === null) return null;
30621           const geom = [geom0];
30622           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
30623             const ringGeom = this.interiorRings[i3].getGeom();
30624             if (ringGeom === null) continue;
30625             geom.push(ringGeom);
30626           }
30627           return geom;
30628         }
30629       };
30630       MultiPolyOut = class {
30631         constructor(rings) {
30632           __publicField(this, "rings");
30633           __publicField(this, "polys");
30634           this.rings = rings;
30635           this.polys = this._composePolys(rings);
30636         }
30637         getGeom() {
30638           const geom = [];
30639           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
30640             const polyGeom = this.polys[i3].getGeom();
30641             if (polyGeom === null) continue;
30642             geom.push(polyGeom);
30643           }
30644           return geom;
30645         }
30646         _composePolys(rings) {
30647           var _a3;
30648           const polys = [];
30649           for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
30650             const ring = rings[i3];
30651             if (ring.poly) continue;
30652             if (ring.isExteriorRing()) polys.push(new PolyOut(ring));
30653             else {
30654               const enclosingRing = ring.enclosingRing();
30655               if (!(enclosingRing == null ? void 0 : enclosingRing.poly)) polys.push(new PolyOut(enclosingRing));
30656               (_a3 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a3.addInterior(ring);
30657             }
30658           }
30659           return polys;
30660         }
30661       };
30662       SweepLine = class {
30663         constructor(queue, comparator = Segment.compare) {
30664           __publicField(this, "queue");
30665           __publicField(this, "tree");
30666           __publicField(this, "segments");
30667           this.queue = queue;
30668           this.tree = new SplayTreeSet(comparator);
30669           this.segments = [];
30670         }
30671         process(event) {
30672           const segment = event.segment;
30673           const newEvents = [];
30674           if (event.consumedBy) {
30675             if (event.isLeft) this.queue.delete(event.otherSE);
30676             else this.tree.delete(segment);
30677             return newEvents;
30678           }
30679           if (event.isLeft) this.tree.add(segment);
30680           let prevSeg = segment;
30681           let nextSeg = segment;
30682           do {
30683             prevSeg = this.tree.lastBefore(prevSeg);
30684           } while (prevSeg != null && prevSeg.consumedBy != void 0);
30685           do {
30686             nextSeg = this.tree.firstAfter(nextSeg);
30687           } while (nextSeg != null && nextSeg.consumedBy != void 0);
30688           if (event.isLeft) {
30689             let prevMySplitter = null;
30690             if (prevSeg) {
30691               const prevInter = prevSeg.getIntersection(segment);
30692               if (prevInter !== null) {
30693                 if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
30694                 if (!prevSeg.isAnEndpoint(prevInter)) {
30695                   const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
30696                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30697                     newEvents.push(newEventsFromSplit[i3]);
30698                   }
30699                 }
30700               }
30701             }
30702             let nextMySplitter = null;
30703             if (nextSeg) {
30704               const nextInter = nextSeg.getIntersection(segment);
30705               if (nextInter !== null) {
30706                 if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
30707                 if (!nextSeg.isAnEndpoint(nextInter)) {
30708                   const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
30709                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30710                     newEvents.push(newEventsFromSplit[i3]);
30711                   }
30712                 }
30713               }
30714             }
30715             if (prevMySplitter !== null || nextMySplitter !== null) {
30716               let mySplitter = null;
30717               if (prevMySplitter === null) mySplitter = nextMySplitter;
30718               else if (nextMySplitter === null) mySplitter = prevMySplitter;
30719               else {
30720                 const cmpSplitters = SweepEvent.comparePoints(
30721                   prevMySplitter,
30722                   nextMySplitter
30723                 );
30724                 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
30725               }
30726               this.queue.delete(segment.rightSE);
30727               newEvents.push(segment.rightSE);
30728               const newEventsFromSplit = segment.split(mySplitter);
30729               for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30730                 newEvents.push(newEventsFromSplit[i3]);
30731               }
30732             }
30733             if (newEvents.length > 0) {
30734               this.tree.delete(segment);
30735               newEvents.push(event);
30736             } else {
30737               this.segments.push(segment);
30738               segment.prev = prevSeg;
30739             }
30740           } else {
30741             if (prevSeg && nextSeg) {
30742               const inter = prevSeg.getIntersection(nextSeg);
30743               if (inter !== null) {
30744                 if (!prevSeg.isAnEndpoint(inter)) {
30745                   const newEventsFromSplit = this._splitSafely(prevSeg, inter);
30746                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30747                     newEvents.push(newEventsFromSplit[i3]);
30748                   }
30749                 }
30750                 if (!nextSeg.isAnEndpoint(inter)) {
30751                   const newEventsFromSplit = this._splitSafely(nextSeg, inter);
30752                   for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
30753                     newEvents.push(newEventsFromSplit[i3]);
30754                   }
30755                 }
30756               }
30757             }
30758             this.tree.delete(segment);
30759           }
30760           return newEvents;
30761         }
30762         /* Safely split a segment that is currently in the datastructures
30763          * IE - a segment other than the one that is currently being processed. */
30764         _splitSafely(seg, pt2) {
30765           this.tree.delete(seg);
30766           const rightSE = seg.rightSE;
30767           this.queue.delete(rightSE);
30768           const newEvents = seg.split(pt2);
30769           newEvents.push(rightSE);
30770           if (seg.consumedBy === void 0) this.tree.add(seg);
30771           return newEvents;
30772         }
30773       };
30774       Operation = class {
30775         constructor() {
30776           __publicField(this, "type");
30777           __publicField(this, "numMultiPolys");
30778         }
30779         run(type2, geom, moreGeoms) {
30780           operation.type = type2;
30781           const multipolys = [new MultiPolyIn(geom, true)];
30782           for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
30783             multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
30784           }
30785           operation.numMultiPolys = multipolys.length;
30786           if (operation.type === "difference") {
30787             const subject = multipolys[0];
30788             let i3 = 1;
30789             while (i3 < multipolys.length) {
30790               if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null) i3++;
30791               else multipolys.splice(i3, 1);
30792             }
30793           }
30794           if (operation.type === "intersection") {
30795             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
30796               const mpA = multipolys[i3];
30797               for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
30798                 if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null) return [];
30799               }
30800             }
30801           }
30802           const queue = new SplayTreeSet(SweepEvent.compare);
30803           for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
30804             const sweepEvents = multipolys[i3].getSweepEvents();
30805             for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
30806               queue.add(sweepEvents[j2]);
30807             }
30808           }
30809           const sweepLine = new SweepLine(queue);
30810           let evt = null;
30811           if (queue.size != 0) {
30812             evt = queue.first();
30813             queue.delete(evt);
30814           }
30815           while (evt) {
30816             const newEvents = sweepLine.process(evt);
30817             for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
30818               const evt2 = newEvents[i3];
30819               if (evt2.consumedBy === void 0) queue.add(evt2);
30820             }
30821             if (queue.size != 0) {
30822               evt = queue.first();
30823               queue.delete(evt);
30824             } else {
30825               evt = null;
30826             }
30827           }
30828           precision.reset();
30829           const ringsOut = RingOut.factory(sweepLine.segments);
30830           const result = new MultiPolyOut(ringsOut);
30831           return result.getGeom();
30832         }
30833       };
30834       operation = new Operation();
30835       operation_default = operation;
30836       segmentId = 0;
30837       Segment = class _Segment {
30838         /* Warning: a reference to ringWindings input will be stored,
30839          *  and possibly will be later modified */
30840         constructor(leftSE, rightSE, rings, windings) {
30841           __publicField(this, "id");
30842           __publicField(this, "leftSE");
30843           __publicField(this, "rightSE");
30844           __publicField(this, "rings");
30845           __publicField(this, "windings");
30846           __publicField(this, "ringOut");
30847           __publicField(this, "consumedBy");
30848           __publicField(this, "prev");
30849           __publicField(this, "_prevInResult");
30850           __publicField(this, "_beforeState");
30851           __publicField(this, "_afterState");
30852           __publicField(this, "_isInResult");
30853           this.id = ++segmentId;
30854           this.leftSE = leftSE;
30855           leftSE.segment = this;
30856           leftSE.otherSE = rightSE;
30857           this.rightSE = rightSE;
30858           rightSE.segment = this;
30859           rightSE.otherSE = leftSE;
30860           this.rings = rings;
30861           this.windings = windings;
30862         }
30863         /* This compare() function is for ordering segments in the sweep
30864          * line tree, and does so according to the following criteria:
30865          *
30866          * Consider the vertical line that lies an infinestimal step to the
30867          * right of the right-more of the two left endpoints of the input
30868          * segments. Imagine slowly moving a point up from negative infinity
30869          * in the increasing y direction. Which of the two segments will that
30870          * point intersect first? That segment comes 'before' the other one.
30871          *
30872          * If neither segment would be intersected by such a line, (if one
30873          * or more of the segments are vertical) then the line to be considered
30874          * is directly on the right-more of the two left inputs.
30875          */
30876         static compare(a2, b2) {
30877           const alx = a2.leftSE.point.x;
30878           const blx = b2.leftSE.point.x;
30879           const arx = a2.rightSE.point.x;
30880           const brx = b2.rightSE.point.x;
30881           if (brx.isLessThan(alx)) return 1;
30882           if (arx.isLessThan(blx)) return -1;
30883           const aly = a2.leftSE.point.y;
30884           const bly = b2.leftSE.point.y;
30885           const ary = a2.rightSE.point.y;
30886           const bry = b2.rightSE.point.y;
30887           if (alx.isLessThan(blx)) {
30888             if (bly.isLessThan(aly) && bly.isLessThan(ary)) return 1;
30889             if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary)) return -1;
30890             const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
30891             if (aCmpBLeft < 0) return 1;
30892             if (aCmpBLeft > 0) return -1;
30893             const bCmpARight = b2.comparePoint(a2.rightSE.point);
30894             if (bCmpARight !== 0) return bCmpARight;
30895             return -1;
30896           }
30897           if (alx.isGreaterThan(blx)) {
30898             if (aly.isLessThan(bly) && aly.isLessThan(bry)) return -1;
30899             if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry)) return 1;
30900             const bCmpALeft = b2.comparePoint(a2.leftSE.point);
30901             if (bCmpALeft !== 0) return bCmpALeft;
30902             const aCmpBRight = a2.comparePoint(b2.rightSE.point);
30903             if (aCmpBRight < 0) return 1;
30904             if (aCmpBRight > 0) return -1;
30905             return 1;
30906           }
30907           if (aly.isLessThan(bly)) return -1;
30908           if (aly.isGreaterThan(bly)) return 1;
30909           if (arx.isLessThan(brx)) {
30910             const bCmpARight = b2.comparePoint(a2.rightSE.point);
30911             if (bCmpARight !== 0) return bCmpARight;
30912           }
30913           if (arx.isGreaterThan(brx)) {
30914             const aCmpBRight = a2.comparePoint(b2.rightSE.point);
30915             if (aCmpBRight < 0) return 1;
30916             if (aCmpBRight > 0) return -1;
30917           }
30918           if (!arx.eq(brx)) {
30919             const ay = ary.minus(aly);
30920             const ax = arx.minus(alx);
30921             const by = bry.minus(bly);
30922             const bx = brx.minus(blx);
30923             if (ay.isGreaterThan(ax) && by.isLessThan(bx)) return 1;
30924             if (ay.isLessThan(ax) && by.isGreaterThan(bx)) return -1;
30925           }
30926           if (arx.isGreaterThan(brx)) return 1;
30927           if (arx.isLessThan(brx)) return -1;
30928           if (ary.isLessThan(bry)) return -1;
30929           if (ary.isGreaterThan(bry)) return 1;
30930           if (a2.id < b2.id) return -1;
30931           if (a2.id > b2.id) return 1;
30932           return 0;
30933         }
30934         static fromRing(pt1, pt2, ring) {
30935           let leftPt, rightPt, winding;
30936           const cmpPts = SweepEvent.comparePoints(pt1, pt2);
30937           if (cmpPts < 0) {
30938             leftPt = pt1;
30939             rightPt = pt2;
30940             winding = 1;
30941           } else if (cmpPts > 0) {
30942             leftPt = pt2;
30943             rightPt = pt1;
30944             winding = -1;
30945           } else
30946             throw new Error(
30947               `Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`
30948             );
30949           const leftSE = new SweepEvent(leftPt, true);
30950           const rightSE = new SweepEvent(rightPt, false);
30951           return new _Segment(leftSE, rightSE, [ring], [winding]);
30952         }
30953         /* When a segment is split, the rightSE is replaced with a new sweep event */
30954         replaceRightSE(newRightSE) {
30955           this.rightSE = newRightSE;
30956           this.rightSE.segment = this;
30957           this.rightSE.otherSE = this.leftSE;
30958           this.leftSE.otherSE = this.rightSE;
30959         }
30960         bbox() {
30961           const y12 = this.leftSE.point.y;
30962           const y2 = this.rightSE.point.y;
30963           return {
30964             ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
30965             ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
30966           };
30967         }
30968         /* A vector from the left point to the right */
30969         vector() {
30970           return {
30971             x: this.rightSE.point.x.minus(this.leftSE.point.x),
30972             y: this.rightSE.point.y.minus(this.leftSE.point.y)
30973           };
30974         }
30975         isAnEndpoint(pt2) {
30976           return pt2.x.eq(this.leftSE.point.x) && pt2.y.eq(this.leftSE.point.y) || pt2.x.eq(this.rightSE.point.x) && pt2.y.eq(this.rightSE.point.y);
30977         }
30978         /* Compare this segment with a point.
30979          *
30980          * A point P is considered to be colinear to a segment if there
30981          * exists a distance D such that if we travel along the segment
30982          * from one * endpoint towards the other a distance D, we find
30983          * ourselves at point P.
30984          *
30985          * Return value indicates:
30986          *
30987          *   1: point lies above the segment (to the left of vertical)
30988          *   0: point is colinear to segment
30989          *  -1: point lies below the segment (to the right of vertical)
30990          */
30991         comparePoint(point) {
30992           return precision.orient(this.leftSE.point, point, this.rightSE.point);
30993         }
30994         /**
30995          * Given another segment, returns the first non-trivial intersection
30996          * between the two segments (in terms of sweep line ordering), if it exists.
30997          *
30998          * A 'non-trivial' intersection is one that will cause one or both of the
30999          * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
31000          *
31001          *   * endpoint of segA with endpoint of segB --> trivial
31002          *   * endpoint of segA with point along segB --> non-trivial
31003          *   * endpoint of segB with point along segA --> non-trivial
31004          *   * point along segA with point along segB --> non-trivial
31005          *
31006          * If no non-trivial intersection exists, return null
31007          * Else, return null.
31008          */
31009         getIntersection(other2) {
31010           const tBbox = this.bbox();
31011           const oBbox = other2.bbox();
31012           const bboxOverlap = getBboxOverlap(tBbox, oBbox);
31013           if (bboxOverlap === null) return null;
31014           const tlp = this.leftSE.point;
31015           const trp = this.rightSE.point;
31016           const olp = other2.leftSE.point;
31017           const orp = other2.rightSE.point;
31018           const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
31019           const touchesThisLSE = isInBbox(oBbox, tlp) && other2.comparePoint(tlp) === 0;
31020           const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
31021           const touchesThisRSE = isInBbox(oBbox, trp) && other2.comparePoint(trp) === 0;
31022           if (touchesThisLSE && touchesOtherLSE) {
31023             if (touchesThisRSE && !touchesOtherRSE) return trp;
31024             if (!touchesThisRSE && touchesOtherRSE) return orp;
31025             return null;
31026           }
31027           if (touchesThisLSE) {
31028             if (touchesOtherRSE) {
31029               if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y)) return null;
31030             }
31031             return tlp;
31032           }
31033           if (touchesOtherLSE) {
31034             if (touchesThisRSE) {
31035               if (trp.x.eq(olp.x) && trp.y.eq(olp.y)) return null;
31036             }
31037             return olp;
31038           }
31039           if (touchesThisRSE && touchesOtherRSE) return null;
31040           if (touchesThisRSE) return trp;
31041           if (touchesOtherRSE) return orp;
31042           const pt2 = intersection(tlp, this.vector(), olp, other2.vector());
31043           if (pt2 === null) return null;
31044           if (!isInBbox(bboxOverlap, pt2)) return null;
31045           return precision.snap(pt2);
31046         }
31047         /**
31048          * Split the given segment into multiple segments on the given points.
31049          *  * Each existing segment will retain its leftSE and a new rightSE will be
31050          *    generated for it.
31051          *  * A new segment will be generated which will adopt the original segment's
31052          *    rightSE, and a new leftSE will be generated for it.
31053          *  * If there are more than two points given to split on, new segments
31054          *    in the middle will be generated with new leftSE and rightSE's.
31055          *  * An array of the newly generated SweepEvents will be returned.
31056          *
31057          * Warning: input array of points is modified
31058          */
31059         split(point) {
31060           const newEvents = [];
31061           const alreadyLinked = point.events !== void 0;
31062           const newLeftSE = new SweepEvent(point, true);
31063           const newRightSE = new SweepEvent(point, false);
31064           const oldRightSE = this.rightSE;
31065           this.replaceRightSE(newRightSE);
31066           newEvents.push(newRightSE);
31067           newEvents.push(newLeftSE);
31068           const newSeg = new _Segment(
31069             newLeftSE,
31070             oldRightSE,
31071             this.rings.slice(),
31072             this.windings.slice()
31073           );
31074           if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
31075             newSeg.swapEvents();
31076           }
31077           if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
31078             this.swapEvents();
31079           }
31080           if (alreadyLinked) {
31081             newLeftSE.checkForConsuming();
31082             newRightSE.checkForConsuming();
31083           }
31084           return newEvents;
31085         }
31086         /* Swap which event is left and right */
31087         swapEvents() {
31088           const tmpEvt = this.rightSE;
31089           this.rightSE = this.leftSE;
31090           this.leftSE = tmpEvt;
31091           this.leftSE.isLeft = true;
31092           this.rightSE.isLeft = false;
31093           for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
31094             this.windings[i3] *= -1;
31095           }
31096         }
31097         /* Consume another segment. We take their rings under our wing
31098          * and mark them as consumed. Use for perfectly overlapping segments */
31099         consume(other2) {
31100           let consumer = this;
31101           let consumee = other2;
31102           while (consumer.consumedBy) consumer = consumer.consumedBy;
31103           while (consumee.consumedBy) consumee = consumee.consumedBy;
31104           const cmp = _Segment.compare(consumer, consumee);
31105           if (cmp === 0) return;
31106           if (cmp > 0) {
31107             const tmp = consumer;
31108             consumer = consumee;
31109             consumee = tmp;
31110           }
31111           if (consumer.prev === consumee) {
31112             const tmp = consumer;
31113             consumer = consumee;
31114             consumee = tmp;
31115           }
31116           for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
31117             const ring = consumee.rings[i3];
31118             const winding = consumee.windings[i3];
31119             const index = consumer.rings.indexOf(ring);
31120             if (index === -1) {
31121               consumer.rings.push(ring);
31122               consumer.windings.push(winding);
31123             } else consumer.windings[index] += winding;
31124           }
31125           consumee.rings = null;
31126           consumee.windings = null;
31127           consumee.consumedBy = consumer;
31128           consumee.leftSE.consumedBy = consumer.leftSE;
31129           consumee.rightSE.consumedBy = consumer.rightSE;
31130         }
31131         /* The first segment previous segment chain that is in the result */
31132         prevInResult() {
31133           if (this._prevInResult !== void 0) return this._prevInResult;
31134           if (!this.prev) this._prevInResult = null;
31135           else if (this.prev.isInResult()) this._prevInResult = this.prev;
31136           else this._prevInResult = this.prev.prevInResult();
31137           return this._prevInResult;
31138         }
31139         beforeState() {
31140           if (this._beforeState !== void 0) return this._beforeState;
31141           if (!this.prev)
31142             this._beforeState = {
31143               rings: [],
31144               windings: [],
31145               multiPolys: []
31146             };
31147           else {
31148             const seg = this.prev.consumedBy || this.prev;
31149             this._beforeState = seg.afterState();
31150           }
31151           return this._beforeState;
31152         }
31153         afterState() {
31154           if (this._afterState !== void 0) return this._afterState;
31155           const beforeState = this.beforeState();
31156           this._afterState = {
31157             rings: beforeState.rings.slice(0),
31158             windings: beforeState.windings.slice(0),
31159             multiPolys: []
31160           };
31161           const ringsAfter = this._afterState.rings;
31162           const windingsAfter = this._afterState.windings;
31163           const mpsAfter = this._afterState.multiPolys;
31164           for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
31165             const ring = this.rings[i3];
31166             const winding = this.windings[i3];
31167             const index = ringsAfter.indexOf(ring);
31168             if (index === -1) {
31169               ringsAfter.push(ring);
31170               windingsAfter.push(winding);
31171             } else windingsAfter[index] += winding;
31172           }
31173           const polysAfter = [];
31174           const polysExclude = [];
31175           for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
31176             if (windingsAfter[i3] === 0) continue;
31177             const ring = ringsAfter[i3];
31178             const poly = ring.poly;
31179             if (polysExclude.indexOf(poly) !== -1) continue;
31180             if (ring.isExterior) polysAfter.push(poly);
31181             else {
31182               if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
31183               const index = polysAfter.indexOf(ring.poly);
31184               if (index !== -1) polysAfter.splice(index, 1);
31185             }
31186           }
31187           for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
31188             const mp = polysAfter[i3].multiPoly;
31189             if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
31190           }
31191           return this._afterState;
31192         }
31193         /* Is this segment part of the final result? */
31194         isInResult() {
31195           if (this.consumedBy) return false;
31196           if (this._isInResult !== void 0) return this._isInResult;
31197           const mpsBefore = this.beforeState().multiPolys;
31198           const mpsAfter = this.afterState().multiPolys;
31199           switch (operation_default.type) {
31200             case "union": {
31201               const noBefores = mpsBefore.length === 0;
31202               const noAfters = mpsAfter.length === 0;
31203               this._isInResult = noBefores !== noAfters;
31204               break;
31205             }
31206             case "intersection": {
31207               let least;
31208               let most;
31209               if (mpsBefore.length < mpsAfter.length) {
31210                 least = mpsBefore.length;
31211                 most = mpsAfter.length;
31212               } else {
31213                 least = mpsAfter.length;
31214                 most = mpsBefore.length;
31215               }
31216               this._isInResult = most === operation_default.numMultiPolys && least < most;
31217               break;
31218             }
31219             case "xor": {
31220               const diff = Math.abs(mpsBefore.length - mpsAfter.length);
31221               this._isInResult = diff % 2 === 1;
31222               break;
31223             }
31224             case "difference": {
31225               const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
31226               this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
31227               break;
31228             }
31229           }
31230           return this._isInResult;
31231         }
31232       };
31233       RingIn = class {
31234         constructor(geomRing, poly, isExterior) {
31235           __publicField(this, "poly");
31236           __publicField(this, "isExterior");
31237           __publicField(this, "segments");
31238           __publicField(this, "bbox");
31239           if (!Array.isArray(geomRing) || geomRing.length === 0) {
31240             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31241           }
31242           this.poly = poly;
31243           this.isExterior = isExterior;
31244           this.segments = [];
31245           if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
31246             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31247           }
31248           const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
31249           this.bbox = {
31250             ll: { x: firstPoint.x, y: firstPoint.y },
31251             ur: { x: firstPoint.x, y: firstPoint.y }
31252           };
31253           let prevPoint = firstPoint;
31254           for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
31255             if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
31256               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31257             }
31258             const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
31259             if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y)) continue;
31260             this.segments.push(Segment.fromRing(prevPoint, point, this));
31261             if (point.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = point.x;
31262             if (point.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = point.y;
31263             if (point.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = point.x;
31264             if (point.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = point.y;
31265             prevPoint = point;
31266           }
31267           if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
31268             this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
31269           }
31270         }
31271         getSweepEvents() {
31272           const sweepEvents = [];
31273           for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
31274             const segment = this.segments[i3];
31275             sweepEvents.push(segment.leftSE);
31276             sweepEvents.push(segment.rightSE);
31277           }
31278           return sweepEvents;
31279         }
31280       };
31281       PolyIn = class {
31282         constructor(geomPoly, multiPoly) {
31283           __publicField(this, "multiPoly");
31284           __publicField(this, "exteriorRing");
31285           __publicField(this, "interiorRings");
31286           __publicField(this, "bbox");
31287           if (!Array.isArray(geomPoly)) {
31288             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31289           }
31290           this.exteriorRing = new RingIn(geomPoly[0], this, true);
31291           this.bbox = {
31292             ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
31293             ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
31294           };
31295           this.interiorRings = [];
31296           for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
31297             const ring = new RingIn(geomPoly[i3], this, false);
31298             if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = ring.bbox.ll.x;
31299             if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = ring.bbox.ll.y;
31300             if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = ring.bbox.ur.x;
31301             if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = ring.bbox.ur.y;
31302             this.interiorRings.push(ring);
31303           }
31304           this.multiPoly = multiPoly;
31305         }
31306         getSweepEvents() {
31307           const sweepEvents = this.exteriorRing.getSweepEvents();
31308           for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
31309             const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
31310             for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
31311               sweepEvents.push(ringSweepEvents[j2]);
31312             }
31313           }
31314           return sweepEvents;
31315         }
31316       };
31317       MultiPolyIn = class {
31318         constructor(geom, isSubject) {
31319           __publicField(this, "isSubject");
31320           __publicField(this, "polys");
31321           __publicField(this, "bbox");
31322           if (!Array.isArray(geom)) {
31323             throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
31324           }
31325           try {
31326             if (typeof geom[0][0][0] === "number") geom = [geom];
31327           } catch (ex) {
31328           }
31329           this.polys = [];
31330           this.bbox = {
31331             ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
31332             ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
31333           };
31334           for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
31335             const poly = new PolyIn(geom[i3], this);
31336             if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x)) this.bbox.ll.x = poly.bbox.ll.x;
31337             if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y)) this.bbox.ll.y = poly.bbox.ll.y;
31338             if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x)) this.bbox.ur.x = poly.bbox.ur.x;
31339             if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y)) this.bbox.ur.y = poly.bbox.ur.y;
31340             this.polys.push(poly);
31341           }
31342           this.isSubject = isSubject;
31343         }
31344         getSweepEvents() {
31345           const sweepEvents = [];
31346           for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
31347             const polySweepEvents = this.polys[i3].getSweepEvents();
31348             for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
31349               sweepEvents.push(polySweepEvents[j2]);
31350             }
31351           }
31352           return sweepEvents;
31353         }
31354       };
31355       union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
31356       difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
31357       setPrecision = precision.set;
31358     }
31359   });
31360
31361   // node_modules/wgs84/index.js
31362   var require_wgs84 = __commonJS({
31363     "node_modules/wgs84/index.js"(exports2, module2) {
31364       module2.exports.RADIUS = 6378137;
31365       module2.exports.FLATTENING = 1 / 298.257223563;
31366       module2.exports.POLAR_RADIUS = 63567523142e-4;
31367     }
31368   });
31369
31370   // node_modules/@mapbox/geojson-area/index.js
31371   var require_geojson_area = __commonJS({
31372     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
31373       var wgs84 = require_wgs84();
31374       module2.exports.geometry = geometry;
31375       module2.exports.ring = ringArea;
31376       function geometry(_2) {
31377         var area = 0, i3;
31378         switch (_2.type) {
31379           case "Polygon":
31380             return polygonArea(_2.coordinates);
31381           case "MultiPolygon":
31382             for (i3 = 0; i3 < _2.coordinates.length; i3++) {
31383               area += polygonArea(_2.coordinates[i3]);
31384             }
31385             return area;
31386           case "Point":
31387           case "MultiPoint":
31388           case "LineString":
31389           case "MultiLineString":
31390             return 0;
31391           case "GeometryCollection":
31392             for (i3 = 0; i3 < _2.geometries.length; i3++) {
31393               area += geometry(_2.geometries[i3]);
31394             }
31395             return area;
31396         }
31397       }
31398       function polygonArea(coords) {
31399         var area = 0;
31400         if (coords && coords.length > 0) {
31401           area += Math.abs(ringArea(coords[0]));
31402           for (var i3 = 1; i3 < coords.length; i3++) {
31403             area -= Math.abs(ringArea(coords[i3]));
31404           }
31405         }
31406         return area;
31407       }
31408       function ringArea(coords) {
31409         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
31410         if (coordsLength > 2) {
31411           for (i3 = 0; i3 < coordsLength; i3++) {
31412             if (i3 === coordsLength - 2) {
31413               lowerIndex = coordsLength - 2;
31414               middleIndex = coordsLength - 1;
31415               upperIndex = 0;
31416             } else if (i3 === coordsLength - 1) {
31417               lowerIndex = coordsLength - 1;
31418               middleIndex = 0;
31419               upperIndex = 1;
31420             } else {
31421               lowerIndex = i3;
31422               middleIndex = i3 + 1;
31423               upperIndex = i3 + 2;
31424             }
31425             p1 = coords[lowerIndex];
31426             p2 = coords[middleIndex];
31427             p3 = coords[upperIndex];
31428             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
31429           }
31430           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
31431         }
31432         return area;
31433       }
31434       function rad(_2) {
31435         return _2 * Math.PI / 180;
31436       }
31437     }
31438   });
31439
31440   // node_modules/circle-to-polygon/input-validation/validateCenter.js
31441   var require_validateCenter = __commonJS({
31442     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
31443       exports2.validateCenter = function validateCenter(center) {
31444         var validCenterLengths = [2, 3];
31445         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
31446           throw new Error("ERROR! Center has to be an array of length two or three");
31447         }
31448         var [lng, lat] = center;
31449         if (typeof lng !== "number" || typeof lat !== "number") {
31450           throw new Error(
31451             `ERROR! Longitude and Latitude has to be numbers but where ${typeof lng} and ${typeof lat}`
31452           );
31453         }
31454         if (lng > 180 || lng < -180) {
31455           throw new Error(`ERROR! Longitude has to be between -180 and 180 but was ${lng}`);
31456         }
31457         if (lat > 90 || lat < -90) {
31458           throw new Error(`ERROR! Latitude has to be between -90 and 90 but was ${lat}`);
31459         }
31460       };
31461     }
31462   });
31463
31464   // node_modules/circle-to-polygon/input-validation/validateRadius.js
31465   var require_validateRadius = __commonJS({
31466     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
31467       exports2.validateRadius = function validateRadius(radius) {
31468         if (typeof radius !== "number") {
31469           throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`);
31470         }
31471         if (radius <= 0) {
31472           throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`);
31473         }
31474       };
31475     }
31476   });
31477
31478   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
31479   var require_validateNumberOfEdges = __commonJS({
31480     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
31481       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
31482         if (typeof numberOfEdges !== "number") {
31483           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
31484           throw new Error(`ERROR! Number of edges has to be a number but was: ${ARGUMENT_TYPE}`);
31485         }
31486         if (numberOfEdges < 3) {
31487           throw new Error(`ERROR! Number of edges has to be at least 3 but was: ${numberOfEdges}`);
31488         }
31489       };
31490     }
31491   });
31492
31493   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
31494   var require_validateEarthRadius = __commonJS({
31495     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
31496       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
31497         if (typeof earthRadius2 !== "number") {
31498           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
31499           throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`);
31500         }
31501         if (earthRadius2 <= 0) {
31502           throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius2}`);
31503         }
31504       };
31505     }
31506   });
31507
31508   // node_modules/circle-to-polygon/input-validation/validateBearing.js
31509   var require_validateBearing = __commonJS({
31510     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
31511       exports2.validateBearing = function validateBearing(bearing) {
31512         if (typeof bearing !== "number") {
31513           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
31514           throw new Error(`ERROR! Bearing has to be a number but was: ${ARGUMENT_TYPE}`);
31515         }
31516       };
31517     }
31518   });
31519
31520   // node_modules/circle-to-polygon/input-validation/index.js
31521   var require_input_validation = __commonJS({
31522     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
31523       var validateCenter = require_validateCenter().validateCenter;
31524       var validateRadius = require_validateRadius().validateRadius;
31525       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
31526       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
31527       var validateBearing = require_validateBearing().validateBearing;
31528       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
31529         validateCenter(center);
31530         validateRadius(radius);
31531         validateNumberOfEdges(numberOfEdges);
31532         validateEarthRadius(earthRadius2);
31533         validateBearing(bearing);
31534       }
31535       exports2.validateCenter = validateCenter;
31536       exports2.validateRadius = validateRadius;
31537       exports2.validateNumberOfEdges = validateNumberOfEdges;
31538       exports2.validateEarthRadius = validateEarthRadius;
31539       exports2.validateBearing = validateBearing;
31540       exports2.validateInput = validateInput;
31541     }
31542   });
31543
31544   // node_modules/circle-to-polygon/index.js
31545   var require_circle_to_polygon = __commonJS({
31546     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
31547       "use strict";
31548       var { validateInput } = require_input_validation();
31549       var defaultEarthRadius = 6378137;
31550       function toRadians(angleInDegrees) {
31551         return angleInDegrees * Math.PI / 180;
31552       }
31553       function toDegrees(angleInRadians) {
31554         return angleInRadians * 180 / Math.PI;
31555       }
31556       function offset(c1, distance, earthRadius2, bearing) {
31557         var lat1 = toRadians(c1[1]);
31558         var lon1 = toRadians(c1[0]);
31559         var dByR = distance / earthRadius2;
31560         var lat = Math.asin(
31561           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
31562         );
31563         var lon = lon1 + Math.atan2(
31564           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
31565           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
31566         );
31567         return [toDegrees(lon), toDegrees(lat)];
31568       }
31569       module2.exports = function circleToPolygon2(center, radius, options2) {
31570         var n3 = getNumberOfEdges(options2);
31571         var earthRadius2 = getEarthRadius(options2);
31572         var bearing = getBearing(options2);
31573         var direction = getDirection(options2);
31574         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
31575         var start2 = toRadians(bearing);
31576         var coordinates = [];
31577         for (var i3 = 0; i3 < n3; ++i3) {
31578           coordinates.push(
31579             offset(
31580               center,
31581               radius,
31582               earthRadius2,
31583               start2 + direction * 2 * Math.PI * -i3 / n3
31584             )
31585           );
31586         }
31587         coordinates.push(coordinates[0]);
31588         return {
31589           type: "Polygon",
31590           coordinates: [coordinates]
31591         };
31592       };
31593       function getNumberOfEdges(options2) {
31594         if (isUndefinedOrNull(options2)) {
31595           return 32;
31596         } else if (isObjectNotArray(options2)) {
31597           var numberOfEdges = options2.numberOfEdges;
31598           return numberOfEdges === void 0 ? 32 : numberOfEdges;
31599         }
31600         return options2;
31601       }
31602       function getEarthRadius(options2) {
31603         if (isUndefinedOrNull(options2)) {
31604           return defaultEarthRadius;
31605         } else if (isObjectNotArray(options2)) {
31606           var earthRadius2 = options2.earthRadius;
31607           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
31608         }
31609         return defaultEarthRadius;
31610       }
31611       function getDirection(options2) {
31612         if (isObjectNotArray(options2) && options2.rightHandRule) {
31613           return -1;
31614         }
31615         return 1;
31616       }
31617       function getBearing(options2) {
31618         if (isUndefinedOrNull(options2)) {
31619           return 0;
31620         } else if (isObjectNotArray(options2)) {
31621           var bearing = options2.bearing;
31622           return bearing === void 0 ? 0 : bearing;
31623         }
31624         return 0;
31625       }
31626       function isObjectNotArray(argument) {
31627         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
31628       }
31629       function isUndefinedOrNull(argument) {
31630         return argument === null || argument === void 0;
31631       }
31632     }
31633   });
31634
31635   // node_modules/geojson-precision/index.js
31636   var require_geojson_precision = __commonJS({
31637     "node_modules/geojson-precision/index.js"(exports2, module2) {
31638       (function() {
31639         function parse(t2, coordinatePrecision, extrasPrecision) {
31640           function point(p2) {
31641             return p2.map(function(e3, index) {
31642               if (index < 2) {
31643                 return 1 * e3.toFixed(coordinatePrecision);
31644               } else {
31645                 return 1 * e3.toFixed(extrasPrecision);
31646               }
31647             });
31648           }
31649           function multi(l2) {
31650             return l2.map(point);
31651           }
31652           function poly(p2) {
31653             return p2.map(multi);
31654           }
31655           function multiPoly(m2) {
31656             return m2.map(poly);
31657           }
31658           function geometry(obj) {
31659             if (!obj) {
31660               return {};
31661             }
31662             switch (obj.type) {
31663               case "Point":
31664                 obj.coordinates = point(obj.coordinates);
31665                 return obj;
31666               case "LineString":
31667               case "MultiPoint":
31668                 obj.coordinates = multi(obj.coordinates);
31669                 return obj;
31670               case "Polygon":
31671               case "MultiLineString":
31672                 obj.coordinates = poly(obj.coordinates);
31673                 return obj;
31674               case "MultiPolygon":
31675                 obj.coordinates = multiPoly(obj.coordinates);
31676                 return obj;
31677               case "GeometryCollection":
31678                 obj.geometries = obj.geometries.map(geometry);
31679                 return obj;
31680               default:
31681                 return {};
31682             }
31683           }
31684           function feature3(obj) {
31685             obj.geometry = geometry(obj.geometry);
31686             return obj;
31687           }
31688           function featureCollection(f2) {
31689             f2.features = f2.features.map(feature3);
31690             return f2;
31691           }
31692           function geometryCollection(g3) {
31693             g3.geometries = g3.geometries.map(geometry);
31694             return g3;
31695           }
31696           if (!t2) {
31697             return t2;
31698           }
31699           switch (t2.type) {
31700             case "Feature":
31701               return feature3(t2);
31702             case "GeometryCollection":
31703               return geometryCollection(t2);
31704             case "FeatureCollection":
31705               return featureCollection(t2);
31706             case "Point":
31707             case "LineString":
31708             case "Polygon":
31709             case "MultiPoint":
31710             case "MultiPolygon":
31711             case "MultiLineString":
31712               return geometry(t2);
31713             default:
31714               return t2;
31715           }
31716         }
31717         module2.exports = parse;
31718         module2.exports.parse = parse;
31719       })();
31720     }
31721   });
31722
31723   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
31724   var require_json_stringify_pretty_compact = __commonJS({
31725     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
31726       function isObject2(obj) {
31727         return typeof obj === "object" && obj !== null;
31728       }
31729       function forEach(obj, cb) {
31730         if (Array.isArray(obj)) {
31731           obj.forEach(cb);
31732         } else if (isObject2(obj)) {
31733           Object.keys(obj).forEach(function(key) {
31734             var val = obj[key];
31735             cb(val, key);
31736           });
31737         }
31738       }
31739       function getTreeDepth(obj) {
31740         var depth = 0;
31741         if (Array.isArray(obj) || isObject2(obj)) {
31742           forEach(obj, function(val) {
31743             if (Array.isArray(val) || isObject2(val)) {
31744               var tmpDepth = getTreeDepth(val);
31745               if (tmpDepth > depth) {
31746                 depth = tmpDepth;
31747               }
31748             }
31749           });
31750           return depth + 1;
31751         }
31752         return depth;
31753       }
31754       function stringify3(obj, options2) {
31755         options2 = options2 || {};
31756         var indent = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
31757         var addMargin = get4(options2, "margins", false);
31758         var addArrayMargin = get4(options2, "arrayMargins", false);
31759         var addObjectMargin = get4(options2, "objectMargins", false);
31760         var maxLength = indent === "" ? Infinity : get4(options2, "maxLength", 80);
31761         var maxNesting = get4(options2, "maxNesting", Infinity);
31762         return function _stringify(obj2, currentIndent, reserved) {
31763           if (obj2 && typeof obj2.toJSON === "function") {
31764             obj2 = obj2.toJSON();
31765           }
31766           var string = JSON.stringify(obj2);
31767           if (string === void 0) {
31768             return string;
31769           }
31770           var length2 = maxLength - currentIndent.length - reserved;
31771           var treeDepth = getTreeDepth(obj2);
31772           if (treeDepth <= maxNesting && string.length <= length2) {
31773             var prettified = prettify(string, {
31774               addMargin,
31775               addArrayMargin,
31776               addObjectMargin
31777             });
31778             if (prettified.length <= length2) {
31779               return prettified;
31780             }
31781           }
31782           if (isObject2(obj2)) {
31783             var nextIndent = currentIndent + indent;
31784             var items = [];
31785             var delimiters;
31786             var comma = function(array2, index2) {
31787               return index2 === array2.length - 1 ? 0 : 1;
31788             };
31789             if (Array.isArray(obj2)) {
31790               for (var index = 0; index < obj2.length; index++) {
31791                 items.push(
31792                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
31793                 );
31794               }
31795               delimiters = "[]";
31796             } else {
31797               Object.keys(obj2).forEach(function(key, index2, array2) {
31798                 var keyPart = JSON.stringify(key) + ": ";
31799                 var value = _stringify(
31800                   obj2[key],
31801                   nextIndent,
31802                   keyPart.length + comma(array2, index2)
31803                 );
31804                 if (value !== void 0) {
31805                   items.push(keyPart + value);
31806                 }
31807               });
31808               delimiters = "{}";
31809             }
31810             if (items.length > 0) {
31811               return [
31812                 delimiters[0],
31813                 indent + items.join(",\n" + nextIndent),
31814                 delimiters[1]
31815               ].join("\n" + currentIndent);
31816             }
31817           }
31818           return string;
31819         }(obj, "", 0);
31820       }
31821       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
31822       function prettify(string, options2) {
31823         options2 = options2 || {};
31824         var tokens = {
31825           "{": "{",
31826           "}": "}",
31827           "[": "[",
31828           "]": "]",
31829           ",": ", ",
31830           ":": ": "
31831         };
31832         if (options2.addMargin || options2.addObjectMargin) {
31833           tokens["{"] = "{ ";
31834           tokens["}"] = " }";
31835         }
31836         if (options2.addMargin || options2.addArrayMargin) {
31837           tokens["["] = "[ ";
31838           tokens["]"] = " ]";
31839         }
31840         return string.replace(stringOrChar, function(match, string2) {
31841           return string2 ? match : tokens[match];
31842         });
31843       }
31844       function get4(options2, name, defaultValue) {
31845         return name in options2 ? options2[name] : defaultValue;
31846       }
31847       module2.exports = stringify3;
31848     }
31849   });
31850
31851   // node_modules/@rapideditor/location-conflation/index.mjs
31852   function _clip(features, which) {
31853     if (!Array.isArray(features) || !features.length) return null;
31854     const fn = { UNION: union, DIFFERENCE: difference }[which];
31855     const args = features.map((feature3) => feature3.geometry.coordinates);
31856     const coords = fn.apply(null, args);
31857     return {
31858       type: "Feature",
31859       properties: {},
31860       geometry: {
31861         type: whichType(coords),
31862         coordinates: coords
31863       }
31864     };
31865     function whichType(coords2) {
31866       const a2 = Array.isArray(coords2);
31867       const b2 = a2 && Array.isArray(coords2[0]);
31868       const c2 = b2 && Array.isArray(coords2[0][0]);
31869       const d2 = c2 && Array.isArray(coords2[0][0][0]);
31870       return d2 ? "MultiPolygon" : "Polygon";
31871     }
31872   }
31873   function _cloneDeep(obj) {
31874     return JSON.parse(JSON.stringify(obj));
31875   }
31876   function _sortLocations(a2, b2) {
31877     const rank = { countrycoder: 1, geojson: 2, point: 3 };
31878     const aRank = rank[a2.type];
31879     const bRank = rank[b2.type];
31880     return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
31881   }
31882   var import_geojson_area, import_circle_to_polygon, import_geojson_precision, import_json_stringify_pretty_compact, LocationConflation;
31883   var init_location_conflation = __esm({
31884     "node_modules/@rapideditor/location-conflation/index.mjs"() {
31885       init_country_coder();
31886       init_esm2();
31887       import_geojson_area = __toESM(require_geojson_area(), 1);
31888       import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
31889       import_geojson_precision = __toESM(require_geojson_precision(), 1);
31890       import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
31891       LocationConflation = class {
31892         // constructor
31893         //
31894         // `fc`  Optional FeatureCollection of known features
31895         //
31896         // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
31897         // Each feature must have a filename-like `id`, for example: `something.geojson`
31898         //
31899         // {
31900         //   "type": "FeatureCollection"
31901         //   "features": [
31902         //     {
31903         //       "type": "Feature",
31904         //       "id": "philly_metro.geojson",
31905         //       "properties": { … },
31906         //       "geometry": { … }
31907         //     }
31908         //   ]
31909         // }
31910         constructor(fc) {
31911           this._cache = {};
31912           this.strict = true;
31913           if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
31914             fc.features.forEach((feature3) => {
31915               feature3.properties = feature3.properties || {};
31916               let props = feature3.properties;
31917               let id2 = feature3.id || props.id;
31918               if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
31919               id2 = id2.toLowerCase();
31920               feature3.id = id2;
31921               props.id = id2;
31922               if (!props.area) {
31923                 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
31924                 props.area = Number(area.toFixed(2));
31925               }
31926               this._cache[id2] = feature3;
31927             });
31928           }
31929           let world = _cloneDeep(feature("Q2"));
31930           world.geometry = {
31931             type: "Polygon",
31932             coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
31933           };
31934           world.id = "Q2";
31935           world.properties.id = "Q2";
31936           world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
31937           this._cache.Q2 = world;
31938         }
31939         // validateLocation
31940         // `location`  The location to validate
31941         //
31942         // Pass a `location` value to validate
31943         //
31944         // Returns a result like:
31945         //   {
31946         //     type:     'point', 'geojson', or 'countrycoder'
31947         //     location:  the queried location
31948         //     id:        the stable identifier for the feature
31949         //   }
31950         // or `null` if the location is invalid
31951         //
31952         validateLocation(location) {
31953           if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
31954             const lon = location[0];
31955             const lat = location[1];
31956             const radius = location[2];
31957             if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
31958               const id2 = "[" + location.toString() + "]";
31959               return { type: "point", location, id: id2 };
31960             }
31961           } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
31962             const id2 = location.toLowerCase();
31963             if (this._cache[id2]) {
31964               return { type: "geojson", location, id: id2 };
31965             }
31966           } else if (typeof location === "string" || typeof location === "number") {
31967             const feature3 = feature(location);
31968             if (feature3) {
31969               const id2 = feature3.properties.wikidata;
31970               return { type: "countrycoder", location, id: id2 };
31971             }
31972           }
31973           if (this.strict) {
31974             throw new Error(`validateLocation:  Invalid location: "${location}".`);
31975           } else {
31976             return null;
31977           }
31978         }
31979         // resolveLocation
31980         // `location`  The location to resolve
31981         //
31982         // Pass a `location` value to resolve
31983         //
31984         // Returns a result like:
31985         //   {
31986         //     type:      'point', 'geojson', or 'countrycoder'
31987         //     location:  the queried location
31988         //     id:        a stable identifier for the feature
31989         //     feature:   the resolved GeoJSON feature
31990         //   }
31991         //  or `null` if the location is invalid
31992         //
31993         resolveLocation(location) {
31994           const valid = this.validateLocation(location);
31995           if (!valid) return null;
31996           const id2 = valid.id;
31997           if (this._cache[id2]) {
31998             return Object.assign(valid, { feature: this._cache[id2] });
31999           }
32000           if (valid.type === "point") {
32001             const lon = location[0];
32002             const lat = location[1];
32003             const radius = location[2] || 25;
32004             const EDGES = 10;
32005             const PRECISION = 3;
32006             const area = Math.PI * radius * radius;
32007             const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
32008               type: "Feature",
32009               id: id2,
32010               properties: { id: id2, area: Number(area.toFixed(2)) },
32011               geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
32012               // km to m
32013             }, PRECISION);
32014             return Object.assign(valid, { feature: feature3 });
32015           } else if (valid.type === "geojson") {
32016           } else if (valid.type === "countrycoder") {
32017             let feature3 = _cloneDeep(feature(id2));
32018             let props = feature3.properties;
32019             if (Array.isArray(props.members)) {
32020               let aggregate = aggregateFeature(id2);
32021               aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
32022               feature3.geometry = aggregate.geometry;
32023             }
32024             if (!props.area) {
32025               const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
32026               props.area = Number(area.toFixed(2));
32027             }
32028             feature3.id = id2;
32029             props.id = id2;
32030             this._cache[id2] = feature3;
32031             return Object.assign(valid, { feature: feature3 });
32032           }
32033           if (this.strict) {
32034             throw new Error(`resolveLocation:  Couldn't resolve location "${location}".`);
32035           } else {
32036             return null;
32037           }
32038         }
32039         // validateLocationSet
32040         // `locationSet`  the locationSet to validate
32041         //
32042         // Pass a locationSet Object to validate like:
32043         //   {
32044         //     include: [ Array of locations ],
32045         //     exclude: [ Array of locations ]
32046         //   }
32047         //
32048         // Returns a result like:
32049         //   {
32050         //     type:         'locationset'
32051         //     locationSet:  the queried locationSet
32052         //     id:           the stable identifier for the feature
32053         //   }
32054         // or `null` if the locationSet is invalid
32055         //
32056         validateLocationSet(locationSet) {
32057           locationSet = locationSet || {};
32058           const validator = this.validateLocation.bind(this);
32059           let include = (locationSet.include || []).map(validator).filter(Boolean);
32060           let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
32061           if (!include.length) {
32062             if (this.strict) {
32063               throw new Error(`validateLocationSet:  LocationSet includes nothing.`);
32064             } else {
32065               locationSet.include = ["Q2"];
32066               include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
32067             }
32068           }
32069           include.sort(_sortLocations);
32070           let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
32071           if (exclude.length) {
32072             exclude.sort(_sortLocations);
32073             id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
32074           }
32075           return { type: "locationset", locationSet, id: id2 };
32076         }
32077         // resolveLocationSet
32078         // `locationSet`  the locationSet to resolve
32079         //
32080         // Pass a locationSet Object to validate like:
32081         //   {
32082         //     include: [ Array of locations ],
32083         //     exclude: [ Array of locations ]
32084         //   }
32085         //
32086         // Returns a result like:
32087         //   {
32088         //     type:         'locationset'
32089         //     locationSet:  the queried locationSet
32090         //     id:           the stable identifier for the feature
32091         //     feature:      the resolved GeoJSON feature
32092         //   }
32093         // or `null` if the locationSet is invalid
32094         //
32095         resolveLocationSet(locationSet) {
32096           locationSet = locationSet || {};
32097           const valid = this.validateLocationSet(locationSet);
32098           if (!valid) return null;
32099           const id2 = valid.id;
32100           if (this._cache[id2]) {
32101             return Object.assign(valid, { feature: this._cache[id2] });
32102           }
32103           const resolver = this.resolveLocation.bind(this);
32104           const includes = (locationSet.include || []).map(resolver).filter(Boolean);
32105           const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
32106           if (includes.length === 1 && excludes.length === 0) {
32107             return Object.assign(valid, { feature: includes[0].feature });
32108           }
32109           const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
32110           const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
32111           let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
32112           const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
32113           resultGeoJSON.id = id2;
32114           resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
32115           this._cache[id2] = resultGeoJSON;
32116           return Object.assign(valid, { feature: resultGeoJSON });
32117         }
32118         // stringify
32119         // convenience method to prettyStringify the given object
32120         stringify(obj, options2) {
32121           return (0, import_json_stringify_pretty_compact.default)(obj, options2);
32122         }
32123       };
32124     }
32125   });
32126
32127   // modules/core/LocationManager.js
32128   var LocationManager_exports = {};
32129   __export(LocationManager_exports, {
32130     LocationManager: () => LocationManager,
32131     locationManager: () => _sharedLocationManager
32132   });
32133   var import_which_polygon2, import_geojson_area2, _loco, LocationManager, _sharedLocationManager;
32134   var init_LocationManager = __esm({
32135     "modules/core/LocationManager.js"() {
32136       "use strict";
32137       init_location_conflation();
32138       import_which_polygon2 = __toESM(require_which_polygon());
32139       import_geojson_area2 = __toESM(require_geojson_area());
32140       _loco = new LocationConflation();
32141       LocationManager = class {
32142         /**
32143          * @constructor
32144          */
32145         constructor() {
32146           this._wp = null;
32147           this._resolved = /* @__PURE__ */ new Map();
32148           this._knownLocationSets = /* @__PURE__ */ new Map();
32149           this._locationIncludedIn = /* @__PURE__ */ new Map();
32150           this._locationExcludedIn = /* @__PURE__ */ new Map();
32151           const world = { locationSet: { include: ["Q2"] } };
32152           this._resolveLocationSet(world);
32153           this._rebuildIndex();
32154         }
32155         /**
32156          * _validateLocationSet
32157          * Pass an Object with a `locationSet` property.
32158          * Validates the `locationSet` and sets a `locationSetID` property on the object.
32159          * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
32160          *
32161          * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
32162          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
32163          *
32164          * @param  `obj`  Object to check, it should have `locationSet` property
32165          */
32166         _validateLocationSet(obj) {
32167           if (obj.locationSetID) return;
32168           try {
32169             let locationSet = obj.locationSet;
32170             if (!locationSet) {
32171               throw new Error("object missing locationSet property");
32172             }
32173             if (!locationSet.include) {
32174               locationSet.include = ["Q2"];
32175             }
32176             const locationSetID = _loco.validateLocationSet(locationSet).id;
32177             obj.locationSetID = locationSetID;
32178             if (this._knownLocationSets.has(locationSetID)) return;
32179             let area = 0;
32180             (locationSet.include || []).forEach((location) => {
32181               const locationID = _loco.validateLocation(location).id;
32182               let geojson = this._resolved.get(locationID);
32183               if (!geojson) {
32184                 geojson = _loco.resolveLocation(location).feature;
32185                 this._resolved.set(locationID, geojson);
32186               }
32187               area += geojson.properties.area;
32188               let s2 = this._locationIncludedIn.get(locationID);
32189               if (!s2) {
32190                 s2 = /* @__PURE__ */ new Set();
32191                 this._locationIncludedIn.set(locationID, s2);
32192               }
32193               s2.add(locationSetID);
32194             });
32195             (locationSet.exclude || []).forEach((location) => {
32196               const locationID = _loco.validateLocation(location).id;
32197               let geojson = this._resolved.get(locationID);
32198               if (!geojson) {
32199                 geojson = _loco.resolveLocation(location).feature;
32200                 this._resolved.set(locationID, geojson);
32201               }
32202               area -= geojson.properties.area;
32203               let s2 = this._locationExcludedIn.get(locationID);
32204               if (!s2) {
32205                 s2 = /* @__PURE__ */ new Set();
32206                 this._locationExcludedIn.set(locationID, s2);
32207               }
32208               s2.add(locationSetID);
32209             });
32210             this._knownLocationSets.set(locationSetID, area);
32211           } catch {
32212             obj.locationSet = { include: ["Q2"] };
32213             obj.locationSetID = "+[Q2]";
32214           }
32215         }
32216         /**
32217          * _resolveLocationSet
32218          * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
32219          * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
32220          *
32221          * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
32222          *
32223          * @param  `obj`  Object to check, it should have `locationSet` property
32224          */
32225         _resolveLocationSet(obj) {
32226           this._validateLocationSet(obj);
32227           if (this._resolved.has(obj.locationSetID)) return;
32228           try {
32229             const result = _loco.resolveLocationSet(obj.locationSet);
32230             const locationSetID = result.id;
32231             obj.locationSetID = locationSetID;
32232             if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
32233               throw new Error(`locationSet ${locationSetID} resolves to an empty feature.`);
32234             }
32235             let geojson = JSON.parse(JSON.stringify(result.feature));
32236             geojson.id = locationSetID;
32237             geojson.properties.id = locationSetID;
32238             this._resolved.set(locationSetID, geojson);
32239           } catch {
32240             obj.locationSet = { include: ["Q2"] };
32241             obj.locationSetID = "+[Q2]";
32242           }
32243         }
32244         /**
32245          * _rebuildIndex
32246          * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
32247          */
32248         _rebuildIndex() {
32249           this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
32250         }
32251         /**
32252          * mergeCustomGeoJSON
32253          * Accepts a FeatureCollection-like object containing custom locations
32254          * Each feature must have a filename-like `id`, for example: `something.geojson`
32255          * {
32256          *   "type": "FeatureCollection"
32257          *   "features": [
32258          *     {
32259          *       "type": "Feature",
32260          *       "id": "philly_metro.geojson",
32261          *       "properties": { … },
32262          *       "geometry": { … }
32263          *     }
32264          *   ]
32265          * }
32266          *
32267          * @param  `fc`  FeatureCollection-like Object containing custom locations
32268          */
32269         mergeCustomGeoJSON(fc) {
32270           if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
32271           fc.features.forEach((feature3) => {
32272             feature3.properties = feature3.properties || {};
32273             let props = feature3.properties;
32274             let id2 = feature3.id || props.id;
32275             if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
32276             id2 = id2.toLowerCase();
32277             feature3.id = id2;
32278             props.id = id2;
32279             if (!props.area) {
32280               const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
32281               props.area = Number(area.toFixed(2));
32282             }
32283             _loco._cache[id2] = feature3;
32284           });
32285         }
32286         /**
32287          * mergeLocationSets
32288          * Accepts an Array of Objects containing `locationSet` properties:
32289          * [
32290          *  { id: 'preset1', locationSet: {…} },
32291          *  { id: 'preset2', locationSet: {…} },
32292          *  …
32293          * ]
32294          * After validating, the Objects will be decorated with a `locationSetID` property:
32295          * [
32296          *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
32297          *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
32298          *  …
32299          * ]
32300          *
32301          * @param  `objects`  Objects to check - they should have `locationSet` property
32302          * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
32303          */
32304         mergeLocationSets(objects) {
32305           if (!Array.isArray(objects)) return Promise.reject("nothing to do");
32306           objects.forEach((obj) => this._validateLocationSet(obj));
32307           this._rebuildIndex();
32308           return Promise.resolve(objects);
32309         }
32310         /**
32311          * locationSetID
32312          * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
32313          * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
32314          *
32315          * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
32316          * @return  String locationSetID, e.g. `+[Q30]`
32317          */
32318         locationSetID(locationSet) {
32319           let locationSetID;
32320           try {
32321             locationSetID = _loco.validateLocationSet(locationSet).id;
32322           } catch {
32323             locationSetID = "+[Q2]";
32324           }
32325           return locationSetID;
32326         }
32327         /**
32328          * feature
32329          * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
32330          * A GeoJSON feature:
32331          * {
32332          *   type: 'Feature',
32333          *   id: '+[Q30]',
32334          *   properties: { id: '+[Q30]', area: 21817019.17, … },
32335          *   geometry: { … }
32336          * }
32337          *
32338          * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
32339          * @return  GeoJSON object (fallback to world)
32340          */
32341         feature(locationSetID = "+[Q2]") {
32342           const feature3 = this._resolved.get(locationSetID);
32343           return feature3 || this._resolved.get("+[Q2]");
32344         }
32345         /**
32346          * locationSetsAt
32347          * Find all the locationSets valid at the given location.
32348          * Results include the area (in km²) to facilitate sorting.
32349          *
32350          * Object of locationSetIDs to areas (in km²)
32351          * {
32352          *   "+[Q2]": 511207893.3958111,
32353          *   "+[Q30]": 21817019.17,
32354          *   "+[new_jersey.geojson]": 22390.77,
32355          *   …
32356          * }
32357          *
32358          * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
32359          * @return  Object of locationSetIDs valid at given location
32360          */
32361         locationSetsAt(loc) {
32362           let result = {};
32363           const hits = this._wp(loc, true) || [];
32364           const thiz = this;
32365           hits.forEach((prop) => {
32366             if (prop.id[0] !== "+") return;
32367             const locationSetID = prop.id;
32368             const area = thiz._knownLocationSets.get(locationSetID);
32369             if (area) {
32370               result[locationSetID] = area;
32371             }
32372           });
32373           hits.forEach((prop) => {
32374             if (prop.id[0] === "+") return;
32375             const locationID = prop.id;
32376             const included = thiz._locationIncludedIn.get(locationID);
32377             (included || []).forEach((locationSetID) => {
32378               const area = thiz._knownLocationSets.get(locationSetID);
32379               if (area) {
32380                 result[locationSetID] = area;
32381               }
32382             });
32383           });
32384           hits.forEach((prop) => {
32385             if (prop.id[0] === "+") return;
32386             const locationID = prop.id;
32387             const excluded = thiz._locationExcludedIn.get(locationID);
32388             (excluded || []).forEach((locationSetID) => {
32389               delete result[locationSetID];
32390             });
32391           });
32392           return result;
32393         }
32394         // Direct access to the location-conflation resolver
32395         loco() {
32396           return _loco;
32397         }
32398       };
32399       _sharedLocationManager = new LocationManager();
32400     }
32401   });
32402
32403   // modules/presets/collection.js
32404   var collection_exports = {};
32405   __export(collection_exports, {
32406     presetCollection: () => presetCollection
32407   });
32408   function presetCollection(collection) {
32409     const MAXRESULTS = 50;
32410     let _this = {};
32411     let _memo = {};
32412     _this.collection = collection;
32413     _this.item = (id2) => {
32414       if (_memo[id2]) return _memo[id2];
32415       const found = _this.collection.find((d2) => d2.id === id2);
32416       if (found) _memo[id2] = found;
32417       return found;
32418     };
32419     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
32420     _this.matchGeometry = (geometry) => {
32421       return presetCollection(
32422         _this.collection.filter((d2) => d2.matchGeometry(geometry))
32423       );
32424     };
32425     _this.matchAllGeometry = (geometries) => {
32426       return presetCollection(
32427         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
32428       );
32429     };
32430     _this.matchAnyGeometry = (geometries) => {
32431       return presetCollection(
32432         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
32433       );
32434     };
32435     _this.fallback = (geometry) => {
32436       let id2 = geometry;
32437       if (id2 === "vertex") id2 = "point";
32438       return _this.item(id2);
32439     };
32440     _this.search = (value, geometry, loc) => {
32441       if (!value) return _this;
32442       value = value.toLowerCase().trim();
32443       function leading(a2) {
32444         const index = a2.indexOf(value);
32445         return index === 0 || a2[index - 1] === " ";
32446       }
32447       function leadingStrict(a2) {
32448         const index = a2.indexOf(value);
32449         return index === 0;
32450       }
32451       function sortPresets(nameProp, aliasesProp) {
32452         return function sortNames(a2, b2) {
32453           let aCompare = a2[nameProp]();
32454           let bCompare = b2[nameProp]();
32455           if (aliasesProp) {
32456             const findMatchingAlias = (strings) => {
32457               if (strings.some((s2) => s2 === value)) {
32458                 return strings.find((s2) => s2 === value);
32459               } else {
32460                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
32461               }
32462             };
32463             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
32464             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
32465           }
32466           if (value === aCompare) return -1;
32467           if (value === bCompare) return 1;
32468           let i3 = b2.originalScore - a2.originalScore;
32469           if (i3 !== 0) return i3;
32470           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
32471           if (i3 !== 0) return i3;
32472           return aCompare.length - bCompare.length;
32473         };
32474       }
32475       let pool = _this.collection;
32476       if (Array.isArray(loc)) {
32477         const validHere = _sharedLocationManager.locationSetsAt(loc);
32478         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
32479       }
32480       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
32481       const suggestions = pool.filter((a2) => a2.suggestion === true);
32482       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
32483       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
32484       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
32485       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
32486       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
32487       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
32488       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
32489       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);
32490       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);
32491       const similarTerms = searchable.filter((a2) => {
32492         return (a2.terms() || []).some((b2) => {
32493           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
32494         });
32495       });
32496       let leadingTagKeyValues = [];
32497       if (value.includes("=")) {
32498         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]))));
32499       }
32500       let results = leadingNames.concat(
32501         leadingSuggestions,
32502         leadingNamesStripped,
32503         leadingSuggestionsStripped,
32504         leadingTerms,
32505         leadingSuggestionTerms,
32506         leadingTagValues,
32507         similarName,
32508         similarSuggestions,
32509         similarTerms,
32510         leadingTagKeyValues
32511       ).slice(0, MAXRESULTS - 1);
32512       if (geometry) {
32513         if (typeof geometry === "string") {
32514           results.push(_this.fallback(geometry));
32515         } else {
32516           geometry.forEach((geom) => results.push(_this.fallback(geom)));
32517         }
32518       }
32519       return presetCollection(utilArrayUniq(results));
32520     };
32521     return _this;
32522   }
32523   var init_collection = __esm({
32524     "modules/presets/collection.js"() {
32525       "use strict";
32526       init_LocationManager();
32527       init_array3();
32528       init_util();
32529     }
32530   });
32531
32532   // modules/presets/category.js
32533   var category_exports = {};
32534   __export(category_exports, {
32535     presetCategory: () => presetCategory
32536   });
32537   function presetCategory(categoryID, category, allPresets) {
32538     let _this = Object.assign({}, category);
32539     let _searchName;
32540     let _searchNameStripped;
32541     _this.id = categoryID;
32542     _this.members = presetCollection(
32543       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
32544     );
32545     _this.geometry = _this.members.collection.reduce((acc, preset) => {
32546       for (let i3 in preset.geometry) {
32547         const geometry = preset.geometry[i3];
32548         if (acc.indexOf(geometry) === -1) {
32549           acc.push(geometry);
32550         }
32551       }
32552       return acc;
32553     }, []);
32554     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
32555     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
32556     _this.matchScore = () => -1;
32557     _this.name = () => _t(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
32558     _this.nameLabel = () => _t.append(`_tagging.presets.categories.${categoryID}.name`, { "default": categoryID });
32559     _this.terms = () => [];
32560     _this.searchName = () => {
32561       if (!_searchName) {
32562         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
32563       }
32564       return _searchName;
32565     };
32566     _this.searchNameStripped = () => {
32567       if (!_searchNameStripped) {
32568         _searchNameStripped = _this.searchName();
32569         if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
32570         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
32571       }
32572       return _searchNameStripped;
32573     };
32574     _this.searchAliases = () => [];
32575     _this.searchAliasesStripped = () => [];
32576     return _this;
32577   }
32578   var init_category = __esm({
32579     "modules/presets/category.js"() {
32580       "use strict";
32581       init_localizer();
32582       init_collection();
32583     }
32584   });
32585
32586   // modules/presets/field.js
32587   var field_exports = {};
32588   __export(field_exports, {
32589     presetField: () => presetField
32590   });
32591   function presetField(fieldID, field, allFields) {
32592     allFields = allFields || {};
32593     let _this = Object.assign({}, field);
32594     _this.id = fieldID;
32595     _this.safeid = utilSafeClassName(fieldID);
32596     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
32597     _this.matchAllGeometry = (geometries) => {
32598       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
32599     };
32600     _this.t = (scope, options2) => _t(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32601     _this.t.html = (scope, options2) => _t.html(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32602     _this.t.append = (scope, options2) => _t.append(`_tagging.presets.fields.${fieldID}.${scope}`, options2);
32603     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId(`_tagging.presets.fields.${fieldID}.${scope}`);
32604     _this.resolveReference = (which) => {
32605       const referenceRegex = /^\{(.*)\}$/;
32606       const match = (field[which] || "").match(referenceRegex);
32607       if (match) {
32608         const field2 = allFields[match[1]];
32609         if (field2) {
32610           return field2;
32611         }
32612         console.error(`Unable to resolve referenced field: ${match[1]}`);
32613       }
32614       return _this;
32615     };
32616     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
32617     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
32618     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
32619     _this.originalTerms = (_this.terms || []).join();
32620     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
32621     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
32622     return _this;
32623   }
32624   var init_field = __esm({
32625     "modules/presets/field.js"() {
32626       "use strict";
32627       init_localizer();
32628       init_util2();
32629     }
32630   });
32631
32632   // modules/presets/preset.js
32633   var preset_exports = {};
32634   __export(preset_exports, {
32635     presetPreset: () => presetPreset
32636   });
32637   function presetPreset(presetID, preset, addable, allFields, allPresets) {
32638     allFields = allFields || {};
32639     allPresets = allPresets || {};
32640     let _this = Object.assign({}, preset);
32641     let _addable = addable || false;
32642     let _searchName;
32643     let _searchNameStripped;
32644     let _searchAliases;
32645     let _searchAliasesStripped;
32646     const referenceRegex = /^\{(.*)\}$/;
32647     _this.id = presetID;
32648     _this.safeid = utilSafeClassName(presetID);
32649     _this.originalTerms = (_this.terms || []).join();
32650     _this.originalName = _this.name || "";
32651     _this.originalAliases = (_this.aliases || []).join("\n");
32652     _this.originalScore = _this.matchScore || 1;
32653     _this.originalReference = _this.reference || {};
32654     _this.originalFields = _this.fields || [];
32655     _this.originalMoreFields = _this.moreFields || [];
32656     _this.fields = (loc) => resolveFields("fields", loc);
32657     _this.moreFields = (loc) => resolveFields("moreFields", loc);
32658     _this.tags = _this.tags || {};
32659     _this.addTags = _this.addTags || _this.tags;
32660     _this.removeTags = _this.removeTags || _this.addTags;
32661     _this.geometry = _this.geometry || [];
32662     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
32663     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
32664     _this.matchScore = (entityTags) => {
32665       const tags = _this.tags;
32666       let seen = {};
32667       let score = 0;
32668       for (let k2 in tags) {
32669         seen[k2] = true;
32670         if (entityTags[k2] === tags[k2]) {
32671           score += _this.originalScore;
32672         } else if (tags[k2] === "*" && k2 in entityTags) {
32673           score += _this.originalScore / 2;
32674         } else {
32675           return -1;
32676         }
32677       }
32678       const addTags = _this.addTags;
32679       for (let k2 in addTags) {
32680         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
32681           score += _this.originalScore;
32682         }
32683       }
32684       if (_this.searchable === false) {
32685         score *= 0.999;
32686       }
32687       return score;
32688     };
32689     _this.t = (scope, options2) => {
32690       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
32691       return _t(textID, options2);
32692     };
32693     _this.t.append = (scope, options2) => {
32694       const textID = `_tagging.presets.presets.${presetID}.${scope}`;
32695       return _t.append(textID, options2);
32696     };
32697     function resolveReference(which) {
32698       const match = (_this[which] || "").match(referenceRegex);
32699       if (match) {
32700         const preset2 = allPresets[match[1]];
32701         if (preset2) {
32702           return preset2;
32703         }
32704         console.error(`Unable to resolve referenced preset: ${match[1]}`);
32705       }
32706       return _this;
32707     }
32708     _this.name = () => {
32709       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
32710     };
32711     _this.nameLabel = () => {
32712       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
32713     };
32714     _this.subtitle = () => {
32715       if (_this.suggestion) {
32716         let path = presetID.split("/");
32717         path.pop();
32718         return _t("_tagging.presets.presets." + path.join("/") + ".name");
32719       }
32720       return null;
32721     };
32722     _this.subtitleLabel = () => {
32723       if (_this.suggestion) {
32724         let path = presetID.split("/");
32725         path.pop();
32726         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
32727       }
32728       return null;
32729     };
32730     _this.aliases = () => {
32731       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/).filter(Boolean);
32732     };
32733     _this.terms = () => {
32734       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
32735     };
32736     _this.searchName = () => {
32737       if (!_searchName) {
32738         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
32739       }
32740       return _searchName;
32741     };
32742     _this.searchNameStripped = () => {
32743       if (!_searchNameStripped) {
32744         _searchNameStripped = stripDiacritics(_this.searchName());
32745       }
32746       return _searchNameStripped;
32747     };
32748     _this.searchAliases = () => {
32749       if (!_searchAliases) {
32750         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
32751       }
32752       return _searchAliases;
32753     };
32754     _this.searchAliasesStripped = () => {
32755       if (!_searchAliasesStripped) {
32756         _searchAliasesStripped = _this.searchAliases();
32757         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
32758       }
32759       return _searchAliasesStripped;
32760     };
32761     _this.isFallback = () => {
32762       const tagCount = Object.keys(_this.tags).length;
32763       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
32764     };
32765     _this.addable = function(val) {
32766       if (!arguments.length) return _addable;
32767       _addable = val;
32768       return _this;
32769     };
32770     _this.reference = () => {
32771       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
32772       if (qid) {
32773         return { qid };
32774       }
32775       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
32776       let value = _this.originalReference.value || _this.tags[key];
32777       if (value === "*") {
32778         return { key };
32779       } else {
32780         return { key, value };
32781       }
32782     };
32783     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
32784       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
32785       tags = utilObjectOmit(tags, Object.keys(removeTags));
32786       if (geometry && !skipFieldDefaults) {
32787         _this.fields(loc).forEach((field) => {
32788           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
32789             delete tags[field.key];
32790           }
32791         });
32792       }
32793       delete tags.area;
32794       return tags;
32795     };
32796     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
32797       const addTags = _this.addTags;
32798       tags = Object.assign({}, tags);
32799       for (let k2 in addTags) {
32800         if (addTags[k2] === "*") {
32801           if (_this.tags[k2] || !tags[k2]) {
32802             tags[k2] = "yes";
32803           }
32804         } else {
32805           tags[k2] = addTags[k2];
32806         }
32807       }
32808       if (!addTags.hasOwnProperty("area")) {
32809         delete tags.area;
32810         if (geometry === "area") {
32811           let needsAreaTag = true;
32812           for (let k2 in addTags) {
32813             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
32814               needsAreaTag = false;
32815               break;
32816             }
32817           }
32818           if (needsAreaTag) {
32819             tags.area = "yes";
32820           }
32821         }
32822       }
32823       if (geometry && !skipFieldDefaults) {
32824         _this.fields(loc).forEach((field) => {
32825           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
32826             tags[field.key] = field.default;
32827           }
32828         });
32829       }
32830       return tags;
32831     };
32832     function resolveFields(which, loc) {
32833       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
32834       let resolved = [];
32835       fieldIDs.forEach((fieldID) => {
32836         const match = fieldID.match(referenceRegex);
32837         if (match !== null) {
32838           resolved = resolved.concat(inheritFields(allPresets[match[1]], which, loc));
32839         } else if (allFields[fieldID]) {
32840           resolved.push(allFields[fieldID]);
32841         } else {
32842           console.log(`Cannot resolve "${fieldID}" found in ${_this.id}.${which}`);
32843         }
32844       });
32845       if (!resolved.length) {
32846         const endIndex = _this.id.lastIndexOf("/");
32847         const parentID = endIndex && _this.id.substring(0, endIndex);
32848         if (parentID) {
32849           let parent = allPresets[parentID];
32850           if (loc) {
32851             const validHere = _sharedLocationManager.locationSetsAt(loc);
32852             if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
32853               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
32854               parent = allPresets[candidateIDs.find((candidateID) => {
32855                 const candidate = allPresets[candidateID];
32856                 return validHere[candidate.locationSetID] && (0, import_lodash2.isEqual)(candidate.tags, parent.tags);
32857               })];
32858             }
32859           }
32860           resolved = inheritFields(parent, which, loc);
32861         }
32862       }
32863       if (loc) {
32864         const validHere = _sharedLocationManager.locationSetsAt(loc);
32865         resolved = resolved.filter((field) => !field.locationSetID || validHere[field.locationSetID]);
32866       }
32867       return resolved;
32868       function inheritFields(parent, which2, loc2) {
32869         if (!parent) return [];
32870         if (which2 === "fields") {
32871           return parent.fields(loc2).filter(shouldInherit);
32872         } else if (which2 === "moreFields") {
32873           return parent.moreFields(loc2).filter(shouldInherit);
32874         } else {
32875           return [];
32876         }
32877       }
32878       function shouldInherit(f2) {
32879         if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
32880         f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
32881         if (f2.key && (_this.originalFields.some((originalField) => {
32882           var _a3;
32883           return f2.key === ((_a3 = allFields[originalField]) == null ? void 0 : _a3.key);
32884         }) || _this.originalMoreFields.some((originalField) => {
32885           var _a3;
32886           return f2.key === ((_a3 = allFields[originalField]) == null ? void 0 : _a3.key);
32887         }))) {
32888           return false;
32889         }
32890         return true;
32891       }
32892     }
32893     function stripDiacritics(s2) {
32894       if (s2.normalize) s2 = s2.normalize("NFD");
32895       s2 = s2.replace(/[\u0300-\u036f]/g, "");
32896       return s2;
32897     }
32898     return _this;
32899   }
32900   var import_lodash2;
32901   var init_preset = __esm({
32902     "modules/presets/preset.js"() {
32903       "use strict";
32904       import_lodash2 = __toESM(require_lodash());
32905       init_localizer();
32906       init_tags();
32907       init_util();
32908       init_util2();
32909       init_LocationManager();
32910     }
32911   });
32912
32913   // modules/presets/index.js
32914   var presets_exports = {};
32915   __export(presets_exports, {
32916     presetCategory: () => presetCategory,
32917     presetCollection: () => presetCollection,
32918     presetField: () => presetField,
32919     presetIndex: () => presetIndex,
32920     presetManager: () => _mainPresetIndex,
32921     presetPreset: () => presetPreset
32922   });
32923   function presetIndex() {
32924     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
32925     const MAXRECENTS = 30;
32926     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
32927     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
32928     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
32929     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
32930     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
32931     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
32932     let _defaults2 = {
32933       point: presetCollection([POINT]),
32934       vertex: presetCollection([POINT]),
32935       line: presetCollection([LINE]),
32936       area: presetCollection([AREA]),
32937       relation: presetCollection([RELATION])
32938     };
32939     let _fields = {};
32940     let _categories = {};
32941     let _universal = [];
32942     let _addablePresetIDs = null;
32943     let _recents;
32944     let _favorites;
32945     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
32946     let _loadPromise;
32947     _this.ensureLoaded = (bypassCache) => {
32948       if (_loadPromise && !bypassCache) return _loadPromise;
32949       return _loadPromise = Promise.all([
32950         _mainFileFetcher.get("preset_categories"),
32951         _mainFileFetcher.get("preset_defaults"),
32952         _mainFileFetcher.get("preset_presets"),
32953         _mainFileFetcher.get("preset_fields")
32954       ]).then((vals) => {
32955         _this.merge({
32956           categories: vals[0],
32957           defaults: vals[1],
32958           presets: vals[2],
32959           fields: vals[3]
32960         });
32961         osmSetAreaKeys(_this.areaKeys());
32962         osmSetLineTags(_this.lineTags());
32963         osmSetPointTags(_this.pointTags());
32964         osmSetVertexTags(_this.vertexTags());
32965       });
32966     };
32967     _this.merge = (d2) => {
32968       let newLocationSets = [];
32969       if (d2.fields) {
32970         Object.keys(d2.fields).forEach((fieldID) => {
32971           let f2 = d2.fields[fieldID];
32972           if (f2) {
32973             f2 = presetField(fieldID, f2, _fields);
32974             if (f2.locationSet) newLocationSets.push(f2);
32975             _fields[fieldID] = f2;
32976           } else {
32977             delete _fields[fieldID];
32978           }
32979         });
32980       }
32981       if (d2.presets) {
32982         Object.keys(d2.presets).forEach((presetID) => {
32983           let p2 = d2.presets[presetID];
32984           if (p2) {
32985             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
32986             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
32987             if (p2.locationSet) newLocationSets.push(p2);
32988             _presets[presetID] = p2;
32989           } else {
32990             const existing = _presets[presetID];
32991             if (existing && !existing.isFallback()) {
32992               delete _presets[presetID];
32993             }
32994           }
32995         });
32996       }
32997       if (d2.categories) {
32998         Object.keys(d2.categories).forEach((categoryID) => {
32999           let c2 = d2.categories[categoryID];
33000           if (c2) {
33001             c2 = presetCategory(categoryID, c2, _presets);
33002             if (c2.locationSet) newLocationSets.push(c2);
33003             _categories[categoryID] = c2;
33004           } else {
33005             delete _categories[categoryID];
33006           }
33007         });
33008       }
33009       _this.collection = Object.values(_presets).concat(Object.values(_categories));
33010       if (d2.defaults) {
33011         Object.keys(d2.defaults).forEach((geometry) => {
33012           const def2 = d2.defaults[geometry];
33013           if (Array.isArray(def2)) {
33014             _defaults2[geometry] = presetCollection(
33015               def2.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
33016             );
33017           } else {
33018             delete _defaults2[geometry];
33019           }
33020         });
33021       }
33022       _universal = Object.values(_fields).filter((field) => field.universal);
33023       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
33024       _this.collection.forEach((preset) => {
33025         (preset.geometry || []).forEach((geometry) => {
33026           let g3 = _geometryIndex[geometry];
33027           for (let key in preset.tags) {
33028             g3[key] = g3[key] || {};
33029             let value = preset.tags[key];
33030             (g3[key][value] = g3[key][value] || []).push(preset);
33031           }
33032         });
33033       });
33034       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
33035         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
33036       }
33037       if (newLocationSets.length) {
33038         _sharedLocationManager.mergeLocationSets(newLocationSets);
33039       }
33040       return _this;
33041     };
33042     _this.match = (entity, resolver) => {
33043       return resolver.transient(entity, "presetMatch", () => {
33044         let geometry = entity.geometry(resolver);
33045         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
33046           geometry = "point";
33047         }
33048         const entityExtent = entity.extent(resolver);
33049         return _this.matchTags(entity.tags, geometry, entityExtent.center());
33050       });
33051     };
33052     _this.matchTags = (tags, geometry, loc) => {
33053       const keyIndex = _geometryIndex[geometry];
33054       let bestScore = -1;
33055       let bestMatch;
33056       let matchCandidates = [];
33057       for (let k2 in tags) {
33058         let indexMatches = [];
33059         let valueIndex = keyIndex[k2];
33060         if (!valueIndex) continue;
33061         let keyValueMatches = valueIndex[tags[k2]];
33062         if (keyValueMatches) indexMatches.push(...keyValueMatches);
33063         let keyStarMatches = valueIndex["*"];
33064         if (keyStarMatches) indexMatches.push(...keyStarMatches);
33065         if (indexMatches.length === 0) continue;
33066         for (let i3 = 0; i3 < indexMatches.length; i3++) {
33067           const candidate = indexMatches[i3];
33068           const score = candidate.matchScore(tags);
33069           if (score === -1) {
33070             continue;
33071           }
33072           matchCandidates.push({ score, candidate });
33073           if (score > bestScore) {
33074             bestScore = score;
33075             bestMatch = candidate;
33076           }
33077         }
33078       }
33079       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
33080         const validHere = _sharedLocationManager.locationSetsAt(loc);
33081         if (!validHere[bestMatch.locationSetID]) {
33082           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
33083           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
33084             const candidateScore = matchCandidates[i3];
33085             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
33086               bestMatch = candidateScore.candidate;
33087               bestScore = candidateScore.score;
33088               break;
33089             }
33090           }
33091         }
33092       }
33093       if (!bestMatch || bestMatch.isFallback()) {
33094         for (let k2 in tags) {
33095           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
33096             bestMatch = keyIndex["addr:*"]["*"][0];
33097             break;
33098           }
33099         }
33100       }
33101       return bestMatch || _this.fallback(geometry);
33102     };
33103     _this.allowsVertex = (entity, resolver) => {
33104       if (entity.type !== "node") return false;
33105       if (Object.keys(entity.tags).length === 0) return true;
33106       return resolver.transient(entity, "vertexMatch", () => {
33107         if (entity.isOnAddressLine(resolver)) return true;
33108         const geometries = osmNodeGeometriesForTags(entity.tags);
33109         if (geometries.vertex) return true;
33110         if (geometries.point) return false;
33111         return true;
33112       });
33113     };
33114     _this.areaKeys = () => {
33115       const ignore = {
33116         barrier: true,
33117         highway: true,
33118         footway: true,
33119         railway: true,
33120         junction: true,
33121         type: true
33122       };
33123       let areaKeys = {};
33124       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
33125       presets.forEach((p2) => {
33126         const keys2 = p2.tags && Object.keys(p2.tags);
33127         const key = keys2 && keys2.length && keys2[0];
33128         if (!key) return;
33129         if (ignore[key]) return;
33130         if (p2.geometry.indexOf("area") !== -1) {
33131           areaKeys[key] = areaKeys[key] || {};
33132         }
33133       });
33134       presets.forEach((p2) => {
33135         let key;
33136         for (key in p2.addTags) {
33137           const value = p2.addTags[key];
33138           if (key in areaKeys && // probably an area...
33139           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
33140           value !== "*") {
33141             areaKeys[key][value] = true;
33142           }
33143         }
33144       });
33145       return areaKeys;
33146     };
33147     _this.lineTags = () => {
33148       return _this.collection.filter((lineTags, d2) => {
33149         if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
33150         const keys2 = d2.tags && Object.keys(d2.tags);
33151         const key = keys2 && keys2.length && keys2[0];
33152         if (!key) return lineTags;
33153         if (d2.geometry.indexOf("line") !== -1) {
33154           lineTags[key] = lineTags[key] || [];
33155           lineTags[key].push(d2.tags);
33156         }
33157         return lineTags;
33158       }, {});
33159     };
33160     _this.pointTags = () => {
33161       return _this.collection.reduce((pointTags, d2) => {
33162         if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
33163         const keys2 = d2.tags && Object.keys(d2.tags);
33164         const key = keys2 && keys2.length && keys2[0];
33165         if (!key) return pointTags;
33166         if (d2.geometry.indexOf("point") !== -1) {
33167           pointTags[key] = pointTags[key] || {};
33168           pointTags[key][d2.tags[key]] = true;
33169         }
33170         return pointTags;
33171       }, {});
33172     };
33173     _this.vertexTags = () => {
33174       return _this.collection.reduce((vertexTags, d2) => {
33175         if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
33176         const keys2 = d2.tags && Object.keys(d2.tags);
33177         const key = keys2 && keys2.length && keys2[0];
33178         if (!key) return vertexTags;
33179         if (d2.geometry.indexOf("vertex") !== -1) {
33180           vertexTags[key] = vertexTags[key] || {};
33181           vertexTags[key][d2.tags[key]] = true;
33182         }
33183         return vertexTags;
33184       }, {});
33185     };
33186     _this.field = (id2) => _fields[id2];
33187     _this.universal = () => _universal;
33188     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
33189       let recents = [];
33190       if (startWithRecents) {
33191         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
33192       }
33193       let defaults;
33194       if (_addablePresetIDs) {
33195         defaults = Array.from(_addablePresetIDs).map(function(id2) {
33196           var preset = _this.item(id2);
33197           if (preset && preset.matchGeometry(geometry)) return preset;
33198           return null;
33199         }).filter(Boolean);
33200       } else {
33201         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
33202       }
33203       let result = presetCollection(
33204         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
33205       );
33206       if (Array.isArray(loc)) {
33207         const validHere = _sharedLocationManager.locationSetsAt(loc);
33208         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
33209       }
33210       return result;
33211     };
33212     _this.addablePresetIDs = function(val) {
33213       if (!arguments.length) return _addablePresetIDs;
33214       if (Array.isArray(val)) val = new Set(val);
33215       _addablePresetIDs = val;
33216       if (_addablePresetIDs) {
33217         _this.collection.forEach((p2) => {
33218           if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
33219         });
33220       } else {
33221         _this.collection.forEach((p2) => {
33222           if (p2.addable) p2.addable(true);
33223         });
33224       }
33225       return _this;
33226     };
33227     _this.recent = () => {
33228       return presetCollection(
33229         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
33230       );
33231     };
33232     function RibbonItem(preset, source) {
33233       let item = {};
33234       item.preset = preset;
33235       item.source = source;
33236       item.isFavorite = () => item.source === "favorite";
33237       item.isRecent = () => item.source === "recent";
33238       item.matches = (preset2) => item.preset.id === preset2.id;
33239       item.minified = () => ({ pID: item.preset.id });
33240       return item;
33241     }
33242     function ribbonItemForMinified(d2, source) {
33243       if (d2 && d2.pID) {
33244         const preset = _this.item(d2.pID);
33245         if (!preset) return null;
33246         return RibbonItem(preset, source);
33247       }
33248       return null;
33249     }
33250     _this.getGenericRibbonItems = () => {
33251       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
33252     };
33253     _this.getAddable = () => {
33254       if (!_addablePresetIDs) return [];
33255       return _addablePresetIDs.map((id2) => {
33256         const preset = _this.item(id2);
33257         if (preset) return RibbonItem(preset, "addable");
33258         return null;
33259       }).filter(Boolean);
33260     };
33261     function setRecents(items) {
33262       _recents = items;
33263       const minifiedItems = items.map((d2) => d2.minified());
33264       corePreferences("preset_recents", JSON.stringify(minifiedItems));
33265       dispatch14.call("recentsChange");
33266     }
33267     _this.getRecents = () => {
33268       if (!_recents) {
33269         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
33270           let item = ribbonItemForMinified(d2, "recent");
33271           if (item && item.preset.addable()) acc.push(item);
33272           return acc;
33273         }, []);
33274       }
33275       return _recents;
33276     };
33277     _this.addRecent = (preset, besidePreset, after) => {
33278       const recents = _this.getRecents();
33279       const beforeItem = _this.recentMatching(besidePreset);
33280       let toIndex = recents.indexOf(beforeItem);
33281       if (after) toIndex += 1;
33282       const newItem = RibbonItem(preset, "recent");
33283       recents.splice(toIndex, 0, newItem);
33284       setRecents(recents);
33285     };
33286     _this.removeRecent = (preset) => {
33287       const item = _this.recentMatching(preset);
33288       if (item) {
33289         let items = _this.getRecents();
33290         items.splice(items.indexOf(item), 1);
33291         setRecents(items);
33292       }
33293     };
33294     _this.recentMatching = (preset) => {
33295       const items = _this.getRecents();
33296       for (let i3 in items) {
33297         if (items[i3].matches(preset)) {
33298           return items[i3];
33299         }
33300       }
33301       return null;
33302     };
33303     _this.moveItem = (items, fromIndex, toIndex) => {
33304       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
33305       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
33306       return items;
33307     };
33308     _this.moveRecent = (item, beforeItem) => {
33309       const recents = _this.getRecents();
33310       const fromIndex = recents.indexOf(item);
33311       const toIndex = recents.indexOf(beforeItem);
33312       const items = _this.moveItem(recents, fromIndex, toIndex);
33313       if (items) setRecents(items);
33314     };
33315     _this.setMostRecent = (preset) => {
33316       if (preset.searchable === false) return;
33317       let items = _this.getRecents();
33318       let item = _this.recentMatching(preset);
33319       if (item) {
33320         items.splice(items.indexOf(item), 1);
33321       } else {
33322         item = RibbonItem(preset, "recent");
33323       }
33324       while (items.length >= MAXRECENTS) {
33325         items.pop();
33326       }
33327       items.unshift(item);
33328       setRecents(items);
33329     };
33330     function setFavorites(items) {
33331       _favorites = items;
33332       const minifiedItems = items.map((d2) => d2.minified());
33333       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
33334       dispatch14.call("favoritePreset");
33335     }
33336     _this.addFavorite = (preset, besidePreset, after) => {
33337       const favorites = _this.getFavorites();
33338       const beforeItem = _this.favoriteMatching(besidePreset);
33339       let toIndex = favorites.indexOf(beforeItem);
33340       if (after) toIndex += 1;
33341       const newItem = RibbonItem(preset, "favorite");
33342       favorites.splice(toIndex, 0, newItem);
33343       setFavorites(favorites);
33344     };
33345     _this.toggleFavorite = (preset) => {
33346       const favs = _this.getFavorites();
33347       const favorite = _this.favoriteMatching(preset);
33348       if (favorite) {
33349         favs.splice(favs.indexOf(favorite), 1);
33350       } else {
33351         if (favs.length === 10) {
33352           favs.pop();
33353         }
33354         favs.push(RibbonItem(preset, "favorite"));
33355       }
33356       setFavorites(favs);
33357     };
33358     _this.removeFavorite = (preset) => {
33359       const item = _this.favoriteMatching(preset);
33360       if (item) {
33361         const items = _this.getFavorites();
33362         items.splice(items.indexOf(item), 1);
33363         setFavorites(items);
33364       }
33365     };
33366     _this.getFavorites = () => {
33367       if (!_favorites) {
33368         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
33369         if (!rawFavorites) {
33370           rawFavorites = [];
33371           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
33372         }
33373         _favorites = rawFavorites.reduce((output, d2) => {
33374           const item = ribbonItemForMinified(d2, "favorite");
33375           if (item && item.preset.addable()) output.push(item);
33376           return output;
33377         }, []);
33378       }
33379       return _favorites;
33380     };
33381     _this.favoriteMatching = (preset) => {
33382       const favs = _this.getFavorites();
33383       for (let index in favs) {
33384         if (favs[index].matches(preset)) {
33385           return favs[index];
33386         }
33387       }
33388       return null;
33389     };
33390     return utilRebind(_this, dispatch14, "on");
33391   }
33392   var _mainPresetIndex;
33393   var init_presets = __esm({
33394     "modules/presets/index.js"() {
33395       "use strict";
33396       init_src4();
33397       init_preferences();
33398       init_file_fetcher();
33399       init_LocationManager();
33400       init_tags();
33401       init_category();
33402       init_collection();
33403       init_field();
33404       init_preset();
33405       init_util();
33406       _mainPresetIndex = presetIndex();
33407     }
33408   });
33409
33410   // modules/behavior/edit.js
33411   var edit_exports = {};
33412   __export(edit_exports, {
33413     behaviorEdit: () => behaviorEdit
33414   });
33415   function behaviorEdit(context) {
33416     function behavior() {
33417       context.map().minzoom(context.minEditableZoom());
33418     }
33419     behavior.off = function() {
33420       context.map().minzoom(0);
33421     };
33422     return behavior;
33423   }
33424   var init_edit = __esm({
33425     "modules/behavior/edit.js"() {
33426       "use strict";
33427     }
33428   });
33429
33430   // modules/behavior/hover.js
33431   var hover_exports = {};
33432   __export(hover_exports, {
33433     behaviorHover: () => behaviorHover
33434   });
33435   function behaviorHover(context) {
33436     var dispatch14 = dispatch_default("hover");
33437     var _selection = select_default2(null);
33438     var _newNodeId = null;
33439     var _initialNodeID = null;
33440     var _altDisables;
33441     var _ignoreVertex;
33442     var _targets = [];
33443     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33444     function keydown(d3_event) {
33445       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33446         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33447         _selection.classed("hover-disabled", true);
33448         dispatch14.call("hover", this, null);
33449       }
33450     }
33451     function keyup(d3_event) {
33452       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33453         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33454         _selection.classed("hover-disabled", false);
33455         dispatch14.call("hover", this, _targets);
33456       }
33457     }
33458     function behavior(selection2) {
33459       _selection = selection2;
33460       _targets = [];
33461       if (_initialNodeID) {
33462         _newNodeId = _initialNodeID;
33463         _initialNodeID = null;
33464       } else {
33465         _newNodeId = null;
33466       }
33467       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33468       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33469       function eventTarget(d3_event) {
33470         var datum2 = d3_event.target && d3_event.target.__data__;
33471         if (typeof datum2 !== "object") return null;
33472         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33473           return datum2.properties.entity;
33474         }
33475         return datum2;
33476       }
33477       function pointerover(d3_event) {
33478         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
33479         var target = eventTarget(d3_event);
33480         if (target && _targets.indexOf(target) === -1) {
33481           _targets.push(target);
33482           updateHover(d3_event, _targets);
33483         }
33484       }
33485       function pointerout(d3_event) {
33486         var target = eventTarget(d3_event);
33487         var index = _targets.indexOf(target);
33488         if (index !== -1) {
33489           _targets.splice(index);
33490           updateHover(d3_event, _targets);
33491         }
33492       }
33493       function allowsVertex(d2) {
33494         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33495       }
33496       function modeAllowsHover(target) {
33497         var mode = context.mode();
33498         if (mode.id === "add-point") {
33499           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33500         }
33501         return true;
33502       }
33503       function updateHover(d3_event, targets) {
33504         _selection.selectAll(".hover").classed("hover", false);
33505         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33506         var mode = context.mode();
33507         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33508           var node = targets.find(function(target) {
33509             return target instanceof osmEntity && target.type === "node";
33510           });
33511           _newNodeId = node && node.id;
33512         }
33513         targets = targets.filter(function(datum3) {
33514           if (datum3 instanceof osmEntity) {
33515             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33516           }
33517           return true;
33518         });
33519         var selector = "";
33520         for (var i3 in targets) {
33521           var datum2 = targets[i3];
33522           if (datum2.__featurehash__) {
33523             selector += ", .data" + datum2.__featurehash__;
33524           } else if (datum2 instanceof QAItem) {
33525             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33526           } else if (datum2 instanceof osmNote) {
33527             selector += ", .note-" + datum2.id;
33528           } else if (datum2 instanceof osmEntity) {
33529             selector += ", ." + datum2.id;
33530             if (datum2.type === "relation") {
33531               for (var j2 in datum2.members) {
33532                 selector += ", ." + datum2.members[j2].id;
33533               }
33534             }
33535           }
33536         }
33537         var suppressed = _altDisables && d3_event && d3_event.altKey;
33538         if (selector.trim().length) {
33539           selector = selector.slice(1);
33540           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33541         }
33542         dispatch14.call("hover", this, !suppressed && targets);
33543       }
33544     }
33545     behavior.off = function(selection2) {
33546       selection2.selectAll(".hover").classed("hover", false);
33547       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33548       selection2.classed("hover-disabled", false);
33549       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33550       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33551     };
33552     behavior.altDisables = function(val) {
33553       if (!arguments.length) return _altDisables;
33554       _altDisables = val;
33555       return behavior;
33556     };
33557     behavior.ignoreVertex = function(val) {
33558       if (!arguments.length) return _ignoreVertex;
33559       _ignoreVertex = val;
33560       return behavior;
33561     };
33562     behavior.initialNodeID = function(nodeId) {
33563       _initialNodeID = nodeId;
33564       return behavior;
33565     };
33566     return utilRebind(behavior, dispatch14, "on");
33567   }
33568   var init_hover = __esm({
33569     "modules/behavior/hover.js"() {
33570       "use strict";
33571       init_src4();
33572       init_src5();
33573       init_presets();
33574       init_osm();
33575       init_util();
33576     }
33577   });
33578
33579   // modules/behavior/draw.js
33580   var draw_exports = {};
33581   __export(draw_exports, {
33582     behaviorDraw: () => behaviorDraw
33583   });
33584   function behaviorDraw(context) {
33585     var dispatch14 = dispatch_default(
33586       "move",
33587       "down",
33588       "downcancel",
33589       "click",
33590       "clickWay",
33591       "clickNode",
33592       "undo",
33593       "cancel",
33594       "finish"
33595     );
33596     var keybinding = utilKeybinding("draw");
33597     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33598     var _edit = behaviorEdit(context);
33599     var _closeTolerance = 4;
33600     var _tolerance = 12;
33601     var _mouseLeave = false;
33602     var _lastMouse = null;
33603     var _lastPointerUpEvent;
33604     var _downPointer;
33605     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33606     function datum2(d3_event) {
33607       var mode = context.mode();
33608       var isNote = mode && mode.id.indexOf("note") !== -1;
33609       if (d3_event.altKey || isNote) return {};
33610       var element;
33611       if (d3_event.type === "keydown") {
33612         element = _lastMouse && _lastMouse.target;
33613       } else {
33614         element = d3_event.target;
33615       }
33616       var d2 = element.__data__;
33617       return d2 && d2.properties && d2.properties.target ? d2 : {};
33618     }
33619     function pointerdown(d3_event) {
33620       if (_downPointer) return;
33621       var pointerLocGetter = utilFastMouse(this);
33622       _downPointer = {
33623         id: d3_event.pointerId || "mouse",
33624         pointerLocGetter,
33625         downTime: +/* @__PURE__ */ new Date(),
33626         downLoc: pointerLocGetter(d3_event)
33627       };
33628       dispatch14.call("down", this, d3_event, datum2(d3_event));
33629     }
33630     function pointerup(d3_event) {
33631       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
33632       var downPointer = _downPointer;
33633       _downPointer = null;
33634       _lastPointerUpEvent = d3_event;
33635       if (downPointer.isCancelled) return;
33636       var t2 = +/* @__PURE__ */ new Date();
33637       var p2 = downPointer.pointerLocGetter(d3_event);
33638       var dist = geoVecLength(downPointer.downLoc, p2);
33639       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
33640         select_default2(window).on("click.draw-block", function() {
33641           d3_event.stopPropagation();
33642         }, true);
33643         context.map().dblclickZoomEnable(false);
33644         window.setTimeout(function() {
33645           context.map().dblclickZoomEnable(true);
33646           select_default2(window).on("click.draw-block", null);
33647         }, 500);
33648         click(d3_event, p2);
33649       }
33650     }
33651     function pointermove(d3_event) {
33652       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
33653         var p2 = _downPointer.pointerLocGetter(d3_event);
33654         var dist = geoVecLength(_downPointer.downLoc, p2);
33655         if (dist >= _closeTolerance) {
33656           _downPointer.isCancelled = true;
33657           dispatch14.call("downcancel", this);
33658         }
33659       }
33660       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
33661       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
33662       _lastMouse = d3_event;
33663       dispatch14.call("move", this, d3_event, datum2(d3_event));
33664     }
33665     function pointercancel(d3_event) {
33666       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
33667         if (!_downPointer.isCancelled) {
33668           dispatch14.call("downcancel", this);
33669         }
33670         _downPointer = null;
33671       }
33672     }
33673     function mouseenter() {
33674       _mouseLeave = false;
33675     }
33676     function mouseleave() {
33677       _mouseLeave = true;
33678     }
33679     function allowsVertex(d2) {
33680       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33681     }
33682     function click(d3_event, loc) {
33683       var d2 = datum2(d3_event);
33684       var target = d2 && d2.properties && d2.properties.entity;
33685       var mode = context.mode();
33686       if (target && target.type === "node" && allowsVertex(target)) {
33687         dispatch14.call("clickNode", this, target, d2);
33688         return;
33689       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
33690         var choice = geoChooseEdge(
33691           context.graph().childNodes(target),
33692           loc,
33693           context.projection,
33694           context.activeID()
33695         );
33696         if (choice) {
33697           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
33698           dispatch14.call("clickWay", this, choice.loc, edge, d2);
33699           return;
33700         }
33701       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
33702         var locLatLng = context.projection.invert(loc);
33703         dispatch14.call("click", this, locLatLng, d2);
33704       }
33705     }
33706     function space(d3_event) {
33707       d3_event.preventDefault();
33708       d3_event.stopPropagation();
33709       var currSpace = context.map().mouse();
33710       if (_disableSpace && _lastSpace) {
33711         var dist = geoVecLength(_lastSpace, currSpace);
33712         if (dist > _tolerance) {
33713           _disableSpace = false;
33714         }
33715       }
33716       if (_disableSpace || _mouseLeave || !_lastMouse) return;
33717       _lastSpace = currSpace;
33718       _disableSpace = true;
33719       select_default2(window).on("keyup.space-block", function() {
33720         d3_event.preventDefault();
33721         d3_event.stopPropagation();
33722         _disableSpace = false;
33723         select_default2(window).on("keyup.space-block", null);
33724       });
33725       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
33726       context.projection(context.map().center());
33727       click(d3_event, loc);
33728     }
33729     function backspace(d3_event) {
33730       d3_event.preventDefault();
33731       dispatch14.call("undo");
33732     }
33733     function del(d3_event) {
33734       d3_event.preventDefault();
33735       dispatch14.call("cancel");
33736     }
33737     function ret(d3_event) {
33738       d3_event.preventDefault();
33739       dispatch14.call("finish");
33740     }
33741     function behavior(selection2) {
33742       context.install(_hover);
33743       context.install(_edit);
33744       _downPointer = null;
33745       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
33746       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
33747       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
33748       select_default2(document).call(keybinding);
33749       return behavior;
33750     }
33751     behavior.off = function(selection2) {
33752       context.ui().sidebar.hover.cancel();
33753       context.uninstall(_hover);
33754       context.uninstall(_edit);
33755       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
33756       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
33757       select_default2(document).call(keybinding.unbind);
33758     };
33759     behavior.hover = function() {
33760       return _hover;
33761     };
33762     return utilRebind(behavior, dispatch14, "on");
33763   }
33764   var _disableSpace, _lastSpace;
33765   var init_draw = __esm({
33766     "modules/behavior/draw.js"() {
33767       "use strict";
33768       init_src4();
33769       init_src5();
33770       init_presets();
33771       init_edit();
33772       init_hover();
33773       init_geo2();
33774       init_util();
33775       _disableSpace = false;
33776       _lastSpace = null;
33777     }
33778   });
33779
33780   // node_modules/d3-scale/src/init.js
33781   function initRange(domain, range3) {
33782     switch (arguments.length) {
33783       case 0:
33784         break;
33785       case 1:
33786         this.range(domain);
33787         break;
33788       default:
33789         this.range(range3).domain(domain);
33790         break;
33791     }
33792     return this;
33793   }
33794   var init_init = __esm({
33795     "node_modules/d3-scale/src/init.js"() {
33796     }
33797   });
33798
33799   // node_modules/d3-scale/src/constant.js
33800   function constants(x2) {
33801     return function() {
33802       return x2;
33803     };
33804   }
33805   var init_constant6 = __esm({
33806     "node_modules/d3-scale/src/constant.js"() {
33807     }
33808   });
33809
33810   // node_modules/d3-scale/src/number.js
33811   function number2(x2) {
33812     return +x2;
33813   }
33814   var init_number3 = __esm({
33815     "node_modules/d3-scale/src/number.js"() {
33816     }
33817   });
33818
33819   // node_modules/d3-scale/src/continuous.js
33820   function identity4(x2) {
33821     return x2;
33822   }
33823   function normalize(a2, b2) {
33824     return (b2 -= a2 = +a2) ? function(x2) {
33825       return (x2 - a2) / b2;
33826     } : constants(isNaN(b2) ? NaN : 0.5);
33827   }
33828   function clamper(a2, b2) {
33829     var t2;
33830     if (a2 > b2) t2 = a2, a2 = b2, b2 = t2;
33831     return function(x2) {
33832       return Math.max(a2, Math.min(b2, x2));
33833     };
33834   }
33835   function bimap(domain, range3, interpolate) {
33836     var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
33837     if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
33838     else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
33839     return function(x2) {
33840       return r0(d0(x2));
33841     };
33842   }
33843   function polymap(domain, range3, interpolate) {
33844     var j2 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j2), r2 = new Array(j2), i3 = -1;
33845     if (domain[j2] < domain[0]) {
33846       domain = domain.slice().reverse();
33847       range3 = range3.slice().reverse();
33848     }
33849     while (++i3 < j2) {
33850       d2[i3] = normalize(domain[i3], domain[i3 + 1]);
33851       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
33852     }
33853     return function(x2) {
33854       var i4 = bisect_default(domain, x2, 1, j2) - 1;
33855       return r2[i4](d2[i4](x2));
33856     };
33857   }
33858   function copy(source, target) {
33859     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
33860   }
33861   function transformer2() {
33862     var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity4, piecewise, output, input;
33863     function rescale() {
33864       var n3 = Math.min(domain.length, range3.length);
33865       if (clamp3 !== identity4) clamp3 = clamper(domain[0], domain[n3 - 1]);
33866       piecewise = n3 > 2 ? polymap : bimap;
33867       output = input = null;
33868       return scale;
33869     }
33870     function scale(x2) {
33871       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
33872     }
33873     scale.invert = function(y2) {
33874       return clamp3(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
33875     };
33876     scale.domain = function(_2) {
33877       return arguments.length ? (domain = Array.from(_2, number2), rescale()) : domain.slice();
33878     };
33879     scale.range = function(_2) {
33880       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
33881     };
33882     scale.rangeRound = function(_2) {
33883       return range3 = Array.from(_2), interpolate = round_default, rescale();
33884     };
33885     scale.clamp = function(_2) {
33886       return arguments.length ? (clamp3 = _2 ? true : identity4, rescale()) : clamp3 !== identity4;
33887     };
33888     scale.interpolate = function(_2) {
33889       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
33890     };
33891     scale.unknown = function(_2) {
33892       return arguments.length ? (unknown = _2, scale) : unknown;
33893     };
33894     return function(t2, u2) {
33895       transform2 = t2, untransform = u2;
33896       return rescale();
33897     };
33898   }
33899   function continuous() {
33900     return transformer2()(identity4, identity4);
33901   }
33902   var unit;
33903   var init_continuous = __esm({
33904     "node_modules/d3-scale/src/continuous.js"() {
33905       init_src();
33906       init_src8();
33907       init_constant6();
33908       init_number3();
33909       unit = [0, 1];
33910     }
33911   });
33912
33913   // node_modules/d3-format/src/formatDecimal.js
33914   function formatDecimal_default(x2) {
33915     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
33916   }
33917   function formatDecimalParts(x2, p2) {
33918     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
33919     var i3, coefficient = x2.slice(0, i3);
33920     return [
33921       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
33922       +x2.slice(i3 + 1)
33923     ];
33924   }
33925   var init_formatDecimal = __esm({
33926     "node_modules/d3-format/src/formatDecimal.js"() {
33927     }
33928   });
33929
33930   // node_modules/d3-format/src/exponent.js
33931   function exponent_default(x2) {
33932     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
33933   }
33934   var init_exponent = __esm({
33935     "node_modules/d3-format/src/exponent.js"() {
33936       init_formatDecimal();
33937     }
33938   });
33939
33940   // node_modules/d3-format/src/formatGroup.js
33941   function formatGroup_default(grouping, thousands) {
33942     return function(value, width) {
33943       var i3 = value.length, t2 = [], j2 = 0, g3 = grouping[0], length2 = 0;
33944       while (i3 > 0 && g3 > 0) {
33945         if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
33946         t2.push(value.substring(i3 -= g3, i3 + g3));
33947         if ((length2 += g3 + 1) > width) break;
33948         g3 = grouping[j2 = (j2 + 1) % grouping.length];
33949       }
33950       return t2.reverse().join(thousands);
33951     };
33952   }
33953   var init_formatGroup = __esm({
33954     "node_modules/d3-format/src/formatGroup.js"() {
33955     }
33956   });
33957
33958   // node_modules/d3-format/src/formatNumerals.js
33959   function formatNumerals_default(numerals) {
33960     return function(value) {
33961       return value.replace(/[0-9]/g, function(i3) {
33962         return numerals[+i3];
33963       });
33964     };
33965   }
33966   var init_formatNumerals = __esm({
33967     "node_modules/d3-format/src/formatNumerals.js"() {
33968     }
33969   });
33970
33971   // node_modules/d3-format/src/formatSpecifier.js
33972   function formatSpecifier(specifier) {
33973     if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
33974     var match;
33975     return new FormatSpecifier({
33976       fill: match[1],
33977       align: match[2],
33978       sign: match[3],
33979       symbol: match[4],
33980       zero: match[5],
33981       width: match[6],
33982       comma: match[7],
33983       precision: match[8] && match[8].slice(1),
33984       trim: match[9],
33985       type: match[10]
33986     });
33987   }
33988   function FormatSpecifier(specifier) {
33989     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
33990     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
33991     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
33992     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
33993     this.zero = !!specifier.zero;
33994     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
33995     this.comma = !!specifier.comma;
33996     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
33997     this.trim = !!specifier.trim;
33998     this.type = specifier.type === void 0 ? "" : specifier.type + "";
33999   }
34000   var re;
34001   var init_formatSpecifier = __esm({
34002     "node_modules/d3-format/src/formatSpecifier.js"() {
34003       re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34004       formatSpecifier.prototype = FormatSpecifier.prototype;
34005       FormatSpecifier.prototype.toString = function() {
34006         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;
34007       };
34008     }
34009   });
34010
34011   // node_modules/d3-format/src/formatTrim.js
34012   function formatTrim_default(s2) {
34013     out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34014       switch (s2[i3]) {
34015         case ".":
34016           i0 = i1 = i3;
34017           break;
34018         case "0":
34019           if (i0 === 0) i0 = i3;
34020           i1 = i3;
34021           break;
34022         default:
34023           if (!+s2[i3]) break out;
34024           if (i0 > 0) i0 = 0;
34025           break;
34026       }
34027     }
34028     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34029   }
34030   var init_formatTrim = __esm({
34031     "node_modules/d3-format/src/formatTrim.js"() {
34032     }
34033   });
34034
34035   // node_modules/d3-format/src/formatPrefixAuto.js
34036   function formatPrefixAuto_default(x2, p2) {
34037     var d2 = formatDecimalParts(x2, p2);
34038     if (!d2) return x2 + "";
34039     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;
34040     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];
34041   }
34042   var prefixExponent;
34043   var init_formatPrefixAuto = __esm({
34044     "node_modules/d3-format/src/formatPrefixAuto.js"() {
34045       init_formatDecimal();
34046     }
34047   });
34048
34049   // node_modules/d3-format/src/formatRounded.js
34050   function formatRounded_default(x2, p2) {
34051     var d2 = formatDecimalParts(x2, p2);
34052     if (!d2) return x2 + "";
34053     var coefficient = d2[0], exponent = d2[1];
34054     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");
34055   }
34056   var init_formatRounded = __esm({
34057     "node_modules/d3-format/src/formatRounded.js"() {
34058       init_formatDecimal();
34059     }
34060   });
34061
34062   // node_modules/d3-format/src/formatTypes.js
34063   var formatTypes_default;
34064   var init_formatTypes = __esm({
34065     "node_modules/d3-format/src/formatTypes.js"() {
34066       init_formatDecimal();
34067       init_formatPrefixAuto();
34068       init_formatRounded();
34069       formatTypes_default = {
34070         "%": (x2, p2) => (x2 * 100).toFixed(p2),
34071         "b": (x2) => Math.round(x2).toString(2),
34072         "c": (x2) => x2 + "",
34073         "d": formatDecimal_default,
34074         "e": (x2, p2) => x2.toExponential(p2),
34075         "f": (x2, p2) => x2.toFixed(p2),
34076         "g": (x2, p2) => x2.toPrecision(p2),
34077         "o": (x2) => Math.round(x2).toString(8),
34078         "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34079         "r": formatRounded_default,
34080         "s": formatPrefixAuto_default,
34081         "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34082         "x": (x2) => Math.round(x2).toString(16)
34083       };
34084     }
34085   });
34086
34087   // node_modules/d3-format/src/identity.js
34088   function identity_default5(x2) {
34089     return x2;
34090   }
34091   var init_identity4 = __esm({
34092     "node_modules/d3-format/src/identity.js"() {
34093     }
34094   });
34095
34096   // node_modules/d3-format/src/locale.js
34097   function locale_default(locale3) {
34098     var group = locale3.grouping === void 0 || locale3.thousands === void 0 ? identity_default5 : formatGroup_default(map.call(locale3.grouping, Number), locale3.thousands + ""), currencyPrefix = locale3.currency === void 0 ? "" : locale3.currency[0] + "", currencySuffix = locale3.currency === void 0 ? "" : locale3.currency[1] + "", decimal = locale3.decimal === void 0 ? "." : locale3.decimal + "", numerals = locale3.numerals === void 0 ? identity_default5 : formatNumerals_default(map.call(locale3.numerals, String)), percent = locale3.percent === void 0 ? "%" : locale3.percent + "", minus = locale3.minus === void 0 ? "\u2212" : locale3.minus + "", nan = locale3.nan === void 0 ? "NaN" : locale3.nan + "";
34099     function newFormat(specifier) {
34100       specifier = formatSpecifier(specifier);
34101       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision3 = specifier.precision, trim = specifier.trim, type2 = specifier.type;
34102       if (type2 === "n") comma = true, type2 = "g";
34103       else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
34104       if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
34105       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34106       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34107       precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
34108       function format2(value) {
34109         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34110         if (type2 === "c") {
34111           valueSuffix = formatType(value) + valueSuffix;
34112           value = "";
34113         } else {
34114           value = +value;
34115           var valueNegative = value < 0 || 1 / value < 0;
34116           value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
34117           if (trim) value = formatTrim_default(value);
34118           if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
34119           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34120           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34121           if (maybeSuffix) {
34122             i3 = -1, n3 = value.length;
34123             while (++i3 < n3) {
34124               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34125                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34126                 value = value.slice(0, i3);
34127                 break;
34128               }
34129             }
34130           }
34131         }
34132         if (comma && !zero3) value = group(value, Infinity);
34133         var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
34134         if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34135         switch (align) {
34136           case "<":
34137             value = valuePrefix + value + valueSuffix + padding;
34138             break;
34139           case "=":
34140             value = valuePrefix + padding + value + valueSuffix;
34141             break;
34142           case "^":
34143             value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
34144             break;
34145           default:
34146             value = padding + valuePrefix + value + valueSuffix;
34147             break;
34148         }
34149         return numerals(value);
34150       }
34151       format2.toString = function() {
34152         return specifier + "";
34153       };
34154       return format2;
34155     }
34156     function formatPrefix2(specifier, value) {
34157       var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
34158       return function(value2) {
34159         return f2(k2 * value2) + prefix;
34160       };
34161     }
34162     return {
34163       format: newFormat,
34164       formatPrefix: formatPrefix2
34165     };
34166   }
34167   var map, prefixes;
34168   var init_locale = __esm({
34169     "node_modules/d3-format/src/locale.js"() {
34170       init_exponent();
34171       init_formatGroup();
34172       init_formatNumerals();
34173       init_formatSpecifier();
34174       init_formatTrim();
34175       init_formatTypes();
34176       init_formatPrefixAuto();
34177       init_identity4();
34178       map = Array.prototype.map;
34179       prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34180     }
34181   });
34182
34183   // node_modules/d3-format/src/defaultLocale.js
34184   function defaultLocale(definition) {
34185     locale = locale_default(definition);
34186     format = locale.format;
34187     formatPrefix = locale.formatPrefix;
34188     return locale;
34189   }
34190   var locale, format, formatPrefix;
34191   var init_defaultLocale = __esm({
34192     "node_modules/d3-format/src/defaultLocale.js"() {
34193       init_locale();
34194       defaultLocale({
34195         thousands: ",",
34196         grouping: [3],
34197         currency: ["$", ""]
34198       });
34199     }
34200   });
34201
34202   // node_modules/d3-format/src/precisionFixed.js
34203   function precisionFixed_default(step) {
34204     return Math.max(0, -exponent_default(Math.abs(step)));
34205   }
34206   var init_precisionFixed = __esm({
34207     "node_modules/d3-format/src/precisionFixed.js"() {
34208       init_exponent();
34209     }
34210   });
34211
34212   // node_modules/d3-format/src/precisionPrefix.js
34213   function precisionPrefix_default(step, value) {
34214     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34215   }
34216   var init_precisionPrefix = __esm({
34217     "node_modules/d3-format/src/precisionPrefix.js"() {
34218       init_exponent();
34219     }
34220   });
34221
34222   // node_modules/d3-format/src/precisionRound.js
34223   function precisionRound_default(step, max3) {
34224     step = Math.abs(step), max3 = Math.abs(max3) - step;
34225     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34226   }
34227   var init_precisionRound = __esm({
34228     "node_modules/d3-format/src/precisionRound.js"() {
34229       init_exponent();
34230     }
34231   });
34232
34233   // node_modules/d3-format/src/index.js
34234   var init_src13 = __esm({
34235     "node_modules/d3-format/src/index.js"() {
34236       init_defaultLocale();
34237       init_formatSpecifier();
34238       init_precisionFixed();
34239       init_precisionPrefix();
34240       init_precisionRound();
34241     }
34242   });
34243
34244   // node_modules/d3-scale/src/tickFormat.js
34245   function tickFormat(start2, stop, count, specifier) {
34246     var step = tickStep(start2, stop, count), precision3;
34247     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34248     switch (specifier.type) {
34249       case "s": {
34250         var value = Math.max(Math.abs(start2), Math.abs(stop));
34251         if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
34252         return formatPrefix(specifier, value);
34253       }
34254       case "":
34255       case "e":
34256       case "g":
34257       case "p":
34258       case "r": {
34259         if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
34260         break;
34261       }
34262       case "f":
34263       case "%": {
34264         if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
34265         break;
34266       }
34267     }
34268     return format(specifier);
34269   }
34270   var init_tickFormat = __esm({
34271     "node_modules/d3-scale/src/tickFormat.js"() {
34272       init_src();
34273       init_src13();
34274     }
34275   });
34276
34277   // node_modules/d3-scale/src/linear.js
34278   function linearish(scale) {
34279     var domain = scale.domain;
34280     scale.ticks = function(count) {
34281       var d2 = domain();
34282       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34283     };
34284     scale.tickFormat = function(count, specifier) {
34285       var d2 = domain();
34286       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34287     };
34288     scale.nice = function(count) {
34289       if (count == null) count = 10;
34290       var d2 = domain();
34291       var i0 = 0;
34292       var i1 = d2.length - 1;
34293       var start2 = d2[i0];
34294       var stop = d2[i1];
34295       var prestep;
34296       var step;
34297       var maxIter = 10;
34298       if (stop < start2) {
34299         step = start2, start2 = stop, stop = step;
34300         step = i0, i0 = i1, i1 = step;
34301       }
34302       while (maxIter-- > 0) {
34303         step = tickIncrement(start2, stop, count);
34304         if (step === prestep) {
34305           d2[i0] = start2;
34306           d2[i1] = stop;
34307           return domain(d2);
34308         } else if (step > 0) {
34309           start2 = Math.floor(start2 / step) * step;
34310           stop = Math.ceil(stop / step) * step;
34311         } else if (step < 0) {
34312           start2 = Math.ceil(start2 * step) / step;
34313           stop = Math.floor(stop * step) / step;
34314         } else {
34315           break;
34316         }
34317         prestep = step;
34318       }
34319       return scale;
34320     };
34321     return scale;
34322   }
34323   function linear3() {
34324     var scale = continuous();
34325     scale.copy = function() {
34326       return copy(scale, linear3());
34327     };
34328     initRange.apply(scale, arguments);
34329     return linearish(scale);
34330   }
34331   var init_linear2 = __esm({
34332     "node_modules/d3-scale/src/linear.js"() {
34333       init_src();
34334       init_continuous();
34335       init_init();
34336       init_tickFormat();
34337     }
34338   });
34339
34340   // node_modules/d3-scale/src/quantize.js
34341   function quantize() {
34342     var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
34343     function scale(x2) {
34344       return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
34345     }
34346     function rescale() {
34347       var i3 = -1;
34348       domain = new Array(n3);
34349       while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34350       return scale;
34351     }
34352     scale.domain = function(_2) {
34353       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34354     };
34355     scale.range = function(_2) {
34356       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34357     };
34358     scale.invertExtent = function(y2) {
34359       var i3 = range3.indexOf(y2);
34360       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
34361     };
34362     scale.unknown = function(_2) {
34363       return arguments.length ? (unknown = _2, scale) : scale;
34364     };
34365     scale.thresholds = function() {
34366       return domain.slice();
34367     };
34368     scale.copy = function() {
34369       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34370     };
34371     return initRange.apply(linearish(scale), arguments);
34372   }
34373   var init_quantize2 = __esm({
34374     "node_modules/d3-scale/src/quantize.js"() {
34375       init_src();
34376       init_linear2();
34377       init_init();
34378     }
34379   });
34380
34381   // node_modules/d3-time/src/interval.js
34382   function timeInterval(floori, offseti, count, field) {
34383     function interval2(date) {
34384       return floori(date = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date)), date;
34385     }
34386     interval2.floor = (date) => {
34387       return floori(date = /* @__PURE__ */ new Date(+date)), date;
34388     };
34389     interval2.ceil = (date) => {
34390       return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
34391     };
34392     interval2.round = (date) => {
34393       const d0 = interval2(date), d1 = interval2.ceil(date);
34394       return date - d0 < d1 - date ? d0 : d1;
34395     };
34396     interval2.offset = (date, step) => {
34397       return offseti(date = /* @__PURE__ */ new Date(+date), step == null ? 1 : Math.floor(step)), date;
34398     };
34399     interval2.range = (start2, stop, step) => {
34400       const range3 = [];
34401       start2 = interval2.ceil(start2);
34402       step = step == null ? 1 : Math.floor(step);
34403       if (!(start2 < stop) || !(step > 0)) return range3;
34404       let previous;
34405       do
34406         range3.push(previous = /* @__PURE__ */ new Date(+start2)), offseti(start2, step), floori(start2);
34407       while (previous < start2 && start2 < stop);
34408       return range3;
34409     };
34410     interval2.filter = (test) => {
34411       return timeInterval((date) => {
34412         if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
34413       }, (date, step) => {
34414         if (date >= date) {
34415           if (step < 0) while (++step <= 0) {
34416             while (offseti(date, -1), !test(date)) {
34417             }
34418           }
34419           else while (--step >= 0) {
34420             while (offseti(date, 1), !test(date)) {
34421             }
34422           }
34423         }
34424       });
34425     };
34426     if (count) {
34427       interval2.count = (start2, end) => {
34428         t0.setTime(+start2), t1.setTime(+end);
34429         floori(t0), floori(t1);
34430         return Math.floor(count(t0, t1));
34431       };
34432       interval2.every = (step) => {
34433         step = Math.floor(step);
34434         return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? (d2) => field(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0);
34435       };
34436     }
34437     return interval2;
34438   }
34439   var t0, t1;
34440   var init_interval = __esm({
34441     "node_modules/d3-time/src/interval.js"() {
34442       t0 = /* @__PURE__ */ new Date();
34443       t1 = /* @__PURE__ */ new Date();
34444     }
34445   });
34446
34447   // node_modules/d3-time/src/duration.js
34448   var durationSecond, durationMinute, durationHour, durationDay, durationWeek, durationMonth, durationYear;
34449   var init_duration2 = __esm({
34450     "node_modules/d3-time/src/duration.js"() {
34451       durationSecond = 1e3;
34452       durationMinute = durationSecond * 60;
34453       durationHour = durationMinute * 60;
34454       durationDay = durationHour * 24;
34455       durationWeek = durationDay * 7;
34456       durationMonth = durationDay * 30;
34457       durationYear = durationDay * 365;
34458     }
34459   });
34460
34461   // node_modules/d3-time/src/day.js
34462   var timeDay, timeDays, utcDay, utcDays, unixDay, unixDays;
34463   var init_day = __esm({
34464     "node_modules/d3-time/src/day.js"() {
34465       init_interval();
34466       init_duration2();
34467       timeDay = timeInterval(
34468         (date) => date.setHours(0, 0, 0, 0),
34469         (date, step) => date.setDate(date.getDate() + step),
34470         (start2, end) => (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay,
34471         (date) => date.getDate() - 1
34472       );
34473       timeDays = timeDay.range;
34474       utcDay = timeInterval((date) => {
34475         date.setUTCHours(0, 0, 0, 0);
34476       }, (date, step) => {
34477         date.setUTCDate(date.getUTCDate() + step);
34478       }, (start2, end) => {
34479         return (end - start2) / durationDay;
34480       }, (date) => {
34481         return date.getUTCDate() - 1;
34482       });
34483       utcDays = utcDay.range;
34484       unixDay = timeInterval((date) => {
34485         date.setUTCHours(0, 0, 0, 0);
34486       }, (date, step) => {
34487         date.setUTCDate(date.getUTCDate() + step);
34488       }, (start2, end) => {
34489         return (end - start2) / durationDay;
34490       }, (date) => {
34491         return Math.floor(date / durationDay);
34492       });
34493       unixDays = unixDay.range;
34494     }
34495   });
34496
34497   // node_modules/d3-time/src/week.js
34498   function timeWeekday(i3) {
34499     return timeInterval((date) => {
34500       date.setDate(date.getDate() - (date.getDay() + 7 - i3) % 7);
34501       date.setHours(0, 0, 0, 0);
34502     }, (date, step) => {
34503       date.setDate(date.getDate() + step * 7);
34504     }, (start2, end) => {
34505       return (end - start2 - (end.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek;
34506     });
34507   }
34508   function utcWeekday(i3) {
34509     return timeInterval((date) => {
34510       date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i3) % 7);
34511       date.setUTCHours(0, 0, 0, 0);
34512     }, (date, step) => {
34513       date.setUTCDate(date.getUTCDate() + step * 7);
34514     }, (start2, end) => {
34515       return (end - start2) / durationWeek;
34516     });
34517   }
34518   var timeSunday, timeMonday, timeTuesday, timeWednesday, timeThursday, timeFriday, timeSaturday, timeSundays, timeMondays, timeTuesdays, timeWednesdays, timeThursdays, timeFridays, timeSaturdays, utcSunday, utcMonday, utcTuesday, utcWednesday, utcThursday, utcFriday, utcSaturday, utcSundays, utcMondays, utcTuesdays, utcWednesdays, utcThursdays, utcFridays, utcSaturdays;
34519   var init_week = __esm({
34520     "node_modules/d3-time/src/week.js"() {
34521       init_interval();
34522       init_duration2();
34523       timeSunday = timeWeekday(0);
34524       timeMonday = timeWeekday(1);
34525       timeTuesday = timeWeekday(2);
34526       timeWednesday = timeWeekday(3);
34527       timeThursday = timeWeekday(4);
34528       timeFriday = timeWeekday(5);
34529       timeSaturday = timeWeekday(6);
34530       timeSundays = timeSunday.range;
34531       timeMondays = timeMonday.range;
34532       timeTuesdays = timeTuesday.range;
34533       timeWednesdays = timeWednesday.range;
34534       timeThursdays = timeThursday.range;
34535       timeFridays = timeFriday.range;
34536       timeSaturdays = timeSaturday.range;
34537       utcSunday = utcWeekday(0);
34538       utcMonday = utcWeekday(1);
34539       utcTuesday = utcWeekday(2);
34540       utcWednesday = utcWeekday(3);
34541       utcThursday = utcWeekday(4);
34542       utcFriday = utcWeekday(5);
34543       utcSaturday = utcWeekday(6);
34544       utcSundays = utcSunday.range;
34545       utcMondays = utcMonday.range;
34546       utcTuesdays = utcTuesday.range;
34547       utcWednesdays = utcWednesday.range;
34548       utcThursdays = utcThursday.range;
34549       utcFridays = utcFriday.range;
34550       utcSaturdays = utcSaturday.range;
34551     }
34552   });
34553
34554   // node_modules/d3-time/src/year.js
34555   var timeYear, timeYears, utcYear, utcYears;
34556   var init_year = __esm({
34557     "node_modules/d3-time/src/year.js"() {
34558       init_interval();
34559       timeYear = timeInterval((date) => {
34560         date.setMonth(0, 1);
34561         date.setHours(0, 0, 0, 0);
34562       }, (date, step) => {
34563         date.setFullYear(date.getFullYear() + step);
34564       }, (start2, end) => {
34565         return end.getFullYear() - start2.getFullYear();
34566       }, (date) => {
34567         return date.getFullYear();
34568       });
34569       timeYear.every = (k2) => {
34570         return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date) => {
34571           date.setFullYear(Math.floor(date.getFullYear() / k2) * k2);
34572           date.setMonth(0, 1);
34573           date.setHours(0, 0, 0, 0);
34574         }, (date, step) => {
34575           date.setFullYear(date.getFullYear() + step * k2);
34576         });
34577       };
34578       timeYears = timeYear.range;
34579       utcYear = timeInterval((date) => {
34580         date.setUTCMonth(0, 1);
34581         date.setUTCHours(0, 0, 0, 0);
34582       }, (date, step) => {
34583         date.setUTCFullYear(date.getUTCFullYear() + step);
34584       }, (start2, end) => {
34585         return end.getUTCFullYear() - start2.getUTCFullYear();
34586       }, (date) => {
34587         return date.getUTCFullYear();
34588       });
34589       utcYear.every = (k2) => {
34590         return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : timeInterval((date) => {
34591           date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k2) * k2);
34592           date.setUTCMonth(0, 1);
34593           date.setUTCHours(0, 0, 0, 0);
34594         }, (date, step) => {
34595           date.setUTCFullYear(date.getUTCFullYear() + step * k2);
34596         });
34597       };
34598       utcYears = utcYear.range;
34599     }
34600   });
34601
34602   // node_modules/d3-time/src/index.js
34603   var init_src14 = __esm({
34604     "node_modules/d3-time/src/index.js"() {
34605       init_day();
34606       init_week();
34607       init_year();
34608     }
34609   });
34610
34611   // node_modules/d3-time-format/src/locale.js
34612   function localDate(d2) {
34613     if (0 <= d2.y && d2.y < 100) {
34614       var date = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
34615       date.setFullYear(d2.y);
34616       return date;
34617     }
34618     return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L);
34619   }
34620   function utcDate(d2) {
34621     if (0 <= d2.y && d2.y < 100) {
34622       var date = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
34623       date.setUTCFullYear(d2.y);
34624       return date;
34625     }
34626     return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L));
34627   }
34628   function newDate(y2, m2, d2) {
34629     return { y: y2, m: m2, d: d2, H: 0, M: 0, S: 0, L: 0 };
34630   }
34631   function formatLocale(locale3) {
34632     var locale_dateTime = locale3.dateTime, locale_date = locale3.date, locale_time = locale3.time, locale_periods = locale3.periods, locale_weekdays = locale3.days, locale_shortWeekdays = locale3.shortDays, locale_months = locale3.months, locale_shortMonths = locale3.shortMonths;
34633     var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths);
34634     var formats = {
34635       "a": formatShortWeekday,
34636       "A": formatWeekday,
34637       "b": formatShortMonth,
34638       "B": formatMonth,
34639       "c": null,
34640       "d": formatDayOfMonth,
34641       "e": formatDayOfMonth,
34642       "f": formatMicroseconds,
34643       "g": formatYearISO,
34644       "G": formatFullYearISO,
34645       "H": formatHour24,
34646       "I": formatHour12,
34647       "j": formatDayOfYear,
34648       "L": formatMilliseconds,
34649       "m": formatMonthNumber,
34650       "M": formatMinutes,
34651       "p": formatPeriod,
34652       "q": formatQuarter,
34653       "Q": formatUnixTimestamp,
34654       "s": formatUnixTimestampSeconds,
34655       "S": formatSeconds,
34656       "u": formatWeekdayNumberMonday,
34657       "U": formatWeekNumberSunday,
34658       "V": formatWeekNumberISO,
34659       "w": formatWeekdayNumberSunday,
34660       "W": formatWeekNumberMonday,
34661       "x": null,
34662       "X": null,
34663       "y": formatYear,
34664       "Y": formatFullYear,
34665       "Z": formatZone,
34666       "%": formatLiteralPercent
34667     };
34668     var utcFormats = {
34669       "a": formatUTCShortWeekday,
34670       "A": formatUTCWeekday,
34671       "b": formatUTCShortMonth,
34672       "B": formatUTCMonth,
34673       "c": null,
34674       "d": formatUTCDayOfMonth,
34675       "e": formatUTCDayOfMonth,
34676       "f": formatUTCMicroseconds,
34677       "g": formatUTCYearISO,
34678       "G": formatUTCFullYearISO,
34679       "H": formatUTCHour24,
34680       "I": formatUTCHour12,
34681       "j": formatUTCDayOfYear,
34682       "L": formatUTCMilliseconds,
34683       "m": formatUTCMonthNumber,
34684       "M": formatUTCMinutes,
34685       "p": formatUTCPeriod,
34686       "q": formatUTCQuarter,
34687       "Q": formatUnixTimestamp,
34688       "s": formatUnixTimestampSeconds,
34689       "S": formatUTCSeconds,
34690       "u": formatUTCWeekdayNumberMonday,
34691       "U": formatUTCWeekNumberSunday,
34692       "V": formatUTCWeekNumberISO,
34693       "w": formatUTCWeekdayNumberSunday,
34694       "W": formatUTCWeekNumberMonday,
34695       "x": null,
34696       "X": null,
34697       "y": formatUTCYear,
34698       "Y": formatUTCFullYear,
34699       "Z": formatUTCZone,
34700       "%": formatLiteralPercent
34701     };
34702     var parses = {
34703       "a": parseShortWeekday,
34704       "A": parseWeekday,
34705       "b": parseShortMonth,
34706       "B": parseMonth,
34707       "c": parseLocaleDateTime,
34708       "d": parseDayOfMonth,
34709       "e": parseDayOfMonth,
34710       "f": parseMicroseconds,
34711       "g": parseYear,
34712       "G": parseFullYear,
34713       "H": parseHour24,
34714       "I": parseHour24,
34715       "j": parseDayOfYear,
34716       "L": parseMilliseconds,
34717       "m": parseMonthNumber,
34718       "M": parseMinutes,
34719       "p": parsePeriod,
34720       "q": parseQuarter,
34721       "Q": parseUnixTimestamp,
34722       "s": parseUnixTimestampSeconds,
34723       "S": parseSeconds,
34724       "u": parseWeekdayNumberMonday,
34725       "U": parseWeekNumberSunday,
34726       "V": parseWeekNumberISO,
34727       "w": parseWeekdayNumberSunday,
34728       "W": parseWeekNumberMonday,
34729       "x": parseLocaleDate,
34730       "X": parseLocaleTime,
34731       "y": parseYear,
34732       "Y": parseFullYear,
34733       "Z": parseZone,
34734       "%": parseLiteralPercent
34735     };
34736     formats.x = newFormat(locale_date, formats);
34737     formats.X = newFormat(locale_time, formats);
34738     formats.c = newFormat(locale_dateTime, formats);
34739     utcFormats.x = newFormat(locale_date, utcFormats);
34740     utcFormats.X = newFormat(locale_time, utcFormats);
34741     utcFormats.c = newFormat(locale_dateTime, utcFormats);
34742     function newFormat(specifier, formats2) {
34743       return function(date) {
34744         var string = [], i3 = -1, j2 = 0, n3 = specifier.length, c2, pad3, format2;
34745         if (!(date instanceof Date)) date = /* @__PURE__ */ new Date(+date);
34746         while (++i3 < n3) {
34747           if (specifier.charCodeAt(i3) === 37) {
34748             string.push(specifier.slice(j2, i3));
34749             if ((pad3 = pads[c2 = specifier.charAt(++i3)]) != null) c2 = specifier.charAt(++i3);
34750             else pad3 = c2 === "e" ? " " : "0";
34751             if (format2 = formats2[c2]) c2 = format2(date, pad3);
34752             string.push(c2);
34753             j2 = i3 + 1;
34754           }
34755         }
34756         string.push(specifier.slice(j2, i3));
34757         return string.join("");
34758       };
34759     }
34760     function newParse(specifier, Z3) {
34761       return function(string) {
34762         var d2 = newDate(1900, void 0, 1), i3 = parseSpecifier(d2, specifier, string += "", 0), week, day;
34763         if (i3 != string.length) return null;
34764         if ("Q" in d2) return new Date(d2.Q);
34765         if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0));
34766         if (Z3 && !("Z" in d2)) d2.Z = 0;
34767         if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12;
34768         if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0;
34769         if ("V" in d2) {
34770           if (d2.V < 1 || d2.V > 53) return null;
34771           if (!("w" in d2)) d2.w = 1;
34772           if ("Z" in d2) {
34773             week = utcDate(newDate(d2.y, 0, 1)), day = week.getUTCDay();
34774             week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
34775             week = utcDay.offset(week, (d2.V - 1) * 7);
34776             d2.y = week.getUTCFullYear();
34777             d2.m = week.getUTCMonth();
34778             d2.d = week.getUTCDate() + (d2.w + 6) % 7;
34779           } else {
34780             week = localDate(newDate(d2.y, 0, 1)), day = week.getDay();
34781             week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
34782             week = timeDay.offset(week, (d2.V - 1) * 7);
34783             d2.y = week.getFullYear();
34784             d2.m = week.getMonth();
34785             d2.d = week.getDate() + (d2.w + 6) % 7;
34786           }
34787         } else if ("W" in d2 || "U" in d2) {
34788           if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0;
34789           day = "Z" in d2 ? utcDate(newDate(d2.y, 0, 1)).getUTCDay() : localDate(newDate(d2.y, 0, 1)).getDay();
34790           d2.m = 0;
34791           d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7;
34792         }
34793         if ("Z" in d2) {
34794           d2.H += d2.Z / 100 | 0;
34795           d2.M += d2.Z % 100;
34796           return utcDate(d2);
34797         }
34798         return localDate(d2);
34799       };
34800     }
34801     function parseSpecifier(d2, specifier, string, j2) {
34802       var i3 = 0, n3 = specifier.length, m2 = string.length, c2, parse;
34803       while (i3 < n3) {
34804         if (j2 >= m2) return -1;
34805         c2 = specifier.charCodeAt(i3++);
34806         if (c2 === 37) {
34807           c2 = specifier.charAt(i3++);
34808           parse = parses[c2 in pads ? specifier.charAt(i3++) : c2];
34809           if (!parse || (j2 = parse(d2, string, j2)) < 0) return -1;
34810         } else if (c2 != string.charCodeAt(j2++)) {
34811           return -1;
34812         }
34813       }
34814       return j2;
34815     }
34816     function parsePeriod(d2, string, i3) {
34817       var n3 = periodRe.exec(string.slice(i3));
34818       return n3 ? (d2.p = periodLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34819     }
34820     function parseShortWeekday(d2, string, i3) {
34821       var n3 = shortWeekdayRe.exec(string.slice(i3));
34822       return n3 ? (d2.w = shortWeekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34823     }
34824     function parseWeekday(d2, string, i3) {
34825       var n3 = weekdayRe.exec(string.slice(i3));
34826       return n3 ? (d2.w = weekdayLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34827     }
34828     function parseShortMonth(d2, string, i3) {
34829       var n3 = shortMonthRe.exec(string.slice(i3));
34830       return n3 ? (d2.m = shortMonthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34831     }
34832     function parseMonth(d2, string, i3) {
34833       var n3 = monthRe.exec(string.slice(i3));
34834       return n3 ? (d2.m = monthLookup.get(n3[0].toLowerCase()), i3 + n3[0].length) : -1;
34835     }
34836     function parseLocaleDateTime(d2, string, i3) {
34837       return parseSpecifier(d2, locale_dateTime, string, i3);
34838     }
34839     function parseLocaleDate(d2, string, i3) {
34840       return parseSpecifier(d2, locale_date, string, i3);
34841     }
34842     function parseLocaleTime(d2, string, i3) {
34843       return parseSpecifier(d2, locale_time, string, i3);
34844     }
34845     function formatShortWeekday(d2) {
34846       return locale_shortWeekdays[d2.getDay()];
34847     }
34848     function formatWeekday(d2) {
34849       return locale_weekdays[d2.getDay()];
34850     }
34851     function formatShortMonth(d2) {
34852       return locale_shortMonths[d2.getMonth()];
34853     }
34854     function formatMonth(d2) {
34855       return locale_months[d2.getMonth()];
34856     }
34857     function formatPeriod(d2) {
34858       return locale_periods[+(d2.getHours() >= 12)];
34859     }
34860     function formatQuarter(d2) {
34861       return 1 + ~~(d2.getMonth() / 3);
34862     }
34863     function formatUTCShortWeekday(d2) {
34864       return locale_shortWeekdays[d2.getUTCDay()];
34865     }
34866     function formatUTCWeekday(d2) {
34867       return locale_weekdays[d2.getUTCDay()];
34868     }
34869     function formatUTCShortMonth(d2) {
34870       return locale_shortMonths[d2.getUTCMonth()];
34871     }
34872     function formatUTCMonth(d2) {
34873       return locale_months[d2.getUTCMonth()];
34874     }
34875     function formatUTCPeriod(d2) {
34876       return locale_periods[+(d2.getUTCHours() >= 12)];
34877     }
34878     function formatUTCQuarter(d2) {
34879       return 1 + ~~(d2.getUTCMonth() / 3);
34880     }
34881     return {
34882       format: function(specifier) {
34883         var f2 = newFormat(specifier += "", formats);
34884         f2.toString = function() {
34885           return specifier;
34886         };
34887         return f2;
34888       },
34889       parse: function(specifier) {
34890         var p2 = newParse(specifier += "", false);
34891         p2.toString = function() {
34892           return specifier;
34893         };
34894         return p2;
34895       },
34896       utcFormat: function(specifier) {
34897         var f2 = newFormat(specifier += "", utcFormats);
34898         f2.toString = function() {
34899           return specifier;
34900         };
34901         return f2;
34902       },
34903       utcParse: function(specifier) {
34904         var p2 = newParse(specifier += "", true);
34905         p2.toString = function() {
34906           return specifier;
34907         };
34908         return p2;
34909       }
34910     };
34911   }
34912   function pad(value, fill, width) {
34913     var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length;
34914     return sign2 + (length2 < width ? new Array(width - length2 + 1).join(fill) + string : string);
34915   }
34916   function requote(s2) {
34917     return s2.replace(requoteRe, "\\$&");
34918   }
34919   function formatRe(names) {
34920     return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
34921   }
34922   function formatLookup(names) {
34923     return new Map(names.map((name, i3) => [name.toLowerCase(), i3]));
34924   }
34925   function parseWeekdayNumberSunday(d2, string, i3) {
34926     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34927     return n3 ? (d2.w = +n3[0], i3 + n3[0].length) : -1;
34928   }
34929   function parseWeekdayNumberMonday(d2, string, i3) {
34930     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34931     return n3 ? (d2.u = +n3[0], i3 + n3[0].length) : -1;
34932   }
34933   function parseWeekNumberSunday(d2, string, i3) {
34934     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34935     return n3 ? (d2.U = +n3[0], i3 + n3[0].length) : -1;
34936   }
34937   function parseWeekNumberISO(d2, string, i3) {
34938     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34939     return n3 ? (d2.V = +n3[0], i3 + n3[0].length) : -1;
34940   }
34941   function parseWeekNumberMonday(d2, string, i3) {
34942     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34943     return n3 ? (d2.W = +n3[0], i3 + n3[0].length) : -1;
34944   }
34945   function parseFullYear(d2, string, i3) {
34946     var n3 = numberRe.exec(string.slice(i3, i3 + 4));
34947     return n3 ? (d2.y = +n3[0], i3 + n3[0].length) : -1;
34948   }
34949   function parseYear(d2, string, i3) {
34950     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34951     return n3 ? (d2.y = +n3[0] + (+n3[0] > 68 ? 1900 : 2e3), i3 + n3[0].length) : -1;
34952   }
34953   function parseZone(d2, string, i3) {
34954     var n3 = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i3, i3 + 6));
34955     return n3 ? (d2.Z = n3[1] ? 0 : -(n3[2] + (n3[3] || "00")), i3 + n3[0].length) : -1;
34956   }
34957   function parseQuarter(d2, string, i3) {
34958     var n3 = numberRe.exec(string.slice(i3, i3 + 1));
34959     return n3 ? (d2.q = n3[0] * 3 - 3, i3 + n3[0].length) : -1;
34960   }
34961   function parseMonthNumber(d2, string, i3) {
34962     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34963     return n3 ? (d2.m = n3[0] - 1, i3 + n3[0].length) : -1;
34964   }
34965   function parseDayOfMonth(d2, string, i3) {
34966     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34967     return n3 ? (d2.d = +n3[0], i3 + n3[0].length) : -1;
34968   }
34969   function parseDayOfYear(d2, string, i3) {
34970     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
34971     return n3 ? (d2.m = 0, d2.d = +n3[0], i3 + n3[0].length) : -1;
34972   }
34973   function parseHour24(d2, string, i3) {
34974     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34975     return n3 ? (d2.H = +n3[0], i3 + n3[0].length) : -1;
34976   }
34977   function parseMinutes(d2, string, i3) {
34978     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34979     return n3 ? (d2.M = +n3[0], i3 + n3[0].length) : -1;
34980   }
34981   function parseSeconds(d2, string, i3) {
34982     var n3 = numberRe.exec(string.slice(i3, i3 + 2));
34983     return n3 ? (d2.S = +n3[0], i3 + n3[0].length) : -1;
34984   }
34985   function parseMilliseconds(d2, string, i3) {
34986     var n3 = numberRe.exec(string.slice(i3, i3 + 3));
34987     return n3 ? (d2.L = +n3[0], i3 + n3[0].length) : -1;
34988   }
34989   function parseMicroseconds(d2, string, i3) {
34990     var n3 = numberRe.exec(string.slice(i3, i3 + 6));
34991     return n3 ? (d2.L = Math.floor(n3[0] / 1e3), i3 + n3[0].length) : -1;
34992   }
34993   function parseLiteralPercent(d2, string, i3) {
34994     var n3 = percentRe.exec(string.slice(i3, i3 + 1));
34995     return n3 ? i3 + n3[0].length : -1;
34996   }
34997   function parseUnixTimestamp(d2, string, i3) {
34998     var n3 = numberRe.exec(string.slice(i3));
34999     return n3 ? (d2.Q = +n3[0], i3 + n3[0].length) : -1;
35000   }
35001   function parseUnixTimestampSeconds(d2, string, i3) {
35002     var n3 = numberRe.exec(string.slice(i3));
35003     return n3 ? (d2.s = +n3[0], i3 + n3[0].length) : -1;
35004   }
35005   function formatDayOfMonth(d2, p2) {
35006     return pad(d2.getDate(), p2, 2);
35007   }
35008   function formatHour24(d2, p2) {
35009     return pad(d2.getHours(), p2, 2);
35010   }
35011   function formatHour12(d2, p2) {
35012     return pad(d2.getHours() % 12 || 12, p2, 2);
35013   }
35014   function formatDayOfYear(d2, p2) {
35015     return pad(1 + timeDay.count(timeYear(d2), d2), p2, 3);
35016   }
35017   function formatMilliseconds(d2, p2) {
35018     return pad(d2.getMilliseconds(), p2, 3);
35019   }
35020   function formatMicroseconds(d2, p2) {
35021     return formatMilliseconds(d2, p2) + "000";
35022   }
35023   function formatMonthNumber(d2, p2) {
35024     return pad(d2.getMonth() + 1, p2, 2);
35025   }
35026   function formatMinutes(d2, p2) {
35027     return pad(d2.getMinutes(), p2, 2);
35028   }
35029   function formatSeconds(d2, p2) {
35030     return pad(d2.getSeconds(), p2, 2);
35031   }
35032   function formatWeekdayNumberMonday(d2) {
35033     var day = d2.getDay();
35034     return day === 0 ? 7 : day;
35035   }
35036   function formatWeekNumberSunday(d2, p2) {
35037     return pad(timeSunday.count(timeYear(d2) - 1, d2), p2, 2);
35038   }
35039   function dISO(d2) {
35040     var day = d2.getDay();
35041     return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
35042   }
35043   function formatWeekNumberISO(d2, p2) {
35044     d2 = dISO(d2);
35045     return pad(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p2, 2);
35046   }
35047   function formatWeekdayNumberSunday(d2) {
35048     return d2.getDay();
35049   }
35050   function formatWeekNumberMonday(d2, p2) {
35051     return pad(timeMonday.count(timeYear(d2) - 1, d2), p2, 2);
35052   }
35053   function formatYear(d2, p2) {
35054     return pad(d2.getFullYear() % 100, p2, 2);
35055   }
35056   function formatYearISO(d2, p2) {
35057     d2 = dISO(d2);
35058     return pad(d2.getFullYear() % 100, p2, 2);
35059   }
35060   function formatFullYear(d2, p2) {
35061     return pad(d2.getFullYear() % 1e4, p2, 4);
35062   }
35063   function formatFullYearISO(d2, p2) {
35064     var day = d2.getDay();
35065     d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2);
35066     return pad(d2.getFullYear() % 1e4, p2, 4);
35067   }
35068   function formatZone(d2) {
35069     var z2 = d2.getTimezoneOffset();
35070     return (z2 > 0 ? "-" : (z2 *= -1, "+")) + pad(z2 / 60 | 0, "0", 2) + pad(z2 % 60, "0", 2);
35071   }
35072   function formatUTCDayOfMonth(d2, p2) {
35073     return pad(d2.getUTCDate(), p2, 2);
35074   }
35075   function formatUTCHour24(d2, p2) {
35076     return pad(d2.getUTCHours(), p2, 2);
35077   }
35078   function formatUTCHour12(d2, p2) {
35079     return pad(d2.getUTCHours() % 12 || 12, p2, 2);
35080   }
35081   function formatUTCDayOfYear(d2, p2) {
35082     return pad(1 + utcDay.count(utcYear(d2), d2), p2, 3);
35083   }
35084   function formatUTCMilliseconds(d2, p2) {
35085     return pad(d2.getUTCMilliseconds(), p2, 3);
35086   }
35087   function formatUTCMicroseconds(d2, p2) {
35088     return formatUTCMilliseconds(d2, p2) + "000";
35089   }
35090   function formatUTCMonthNumber(d2, p2) {
35091     return pad(d2.getUTCMonth() + 1, p2, 2);
35092   }
35093   function formatUTCMinutes(d2, p2) {
35094     return pad(d2.getUTCMinutes(), p2, 2);
35095   }
35096   function formatUTCSeconds(d2, p2) {
35097     return pad(d2.getUTCSeconds(), p2, 2);
35098   }
35099   function formatUTCWeekdayNumberMonday(d2) {
35100     var dow = d2.getUTCDay();
35101     return dow === 0 ? 7 : dow;
35102   }
35103   function formatUTCWeekNumberSunday(d2, p2) {
35104     return pad(utcSunday.count(utcYear(d2) - 1, d2), p2, 2);
35105   }
35106   function UTCdISO(d2) {
35107     var day = d2.getUTCDay();
35108     return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
35109   }
35110   function formatUTCWeekNumberISO(d2, p2) {
35111     d2 = UTCdISO(d2);
35112     return pad(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p2, 2);
35113   }
35114   function formatUTCWeekdayNumberSunday(d2) {
35115     return d2.getUTCDay();
35116   }
35117   function formatUTCWeekNumberMonday(d2, p2) {
35118     return pad(utcMonday.count(utcYear(d2) - 1, d2), p2, 2);
35119   }
35120   function formatUTCYear(d2, p2) {
35121     return pad(d2.getUTCFullYear() % 100, p2, 2);
35122   }
35123   function formatUTCYearISO(d2, p2) {
35124     d2 = UTCdISO(d2);
35125     return pad(d2.getUTCFullYear() % 100, p2, 2);
35126   }
35127   function formatUTCFullYear(d2, p2) {
35128     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
35129   }
35130   function formatUTCFullYearISO(d2, p2) {
35131     var day = d2.getUTCDay();
35132     d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2);
35133     return pad(d2.getUTCFullYear() % 1e4, p2, 4);
35134   }
35135   function formatUTCZone() {
35136     return "+0000";
35137   }
35138   function formatLiteralPercent() {
35139     return "%";
35140   }
35141   function formatUnixTimestamp(d2) {
35142     return +d2;
35143   }
35144   function formatUnixTimestampSeconds(d2) {
35145     return Math.floor(+d2 / 1e3);
35146   }
35147   var pads, numberRe, percentRe, requoteRe;
35148   var init_locale2 = __esm({
35149     "node_modules/d3-time-format/src/locale.js"() {
35150       init_src14();
35151       pads = { "-": "", "_": " ", "0": "0" };
35152       numberRe = /^\s*\d+/;
35153       percentRe = /^%/;
35154       requoteRe = /[\\^$*+?|[\]().{}]/g;
35155     }
35156   });
35157
35158   // node_modules/d3-time-format/src/defaultLocale.js
35159   function defaultLocale2(definition) {
35160     locale2 = formatLocale(definition);
35161     timeFormat = locale2.format;
35162     timeParse = locale2.parse;
35163     utcFormat = locale2.utcFormat;
35164     utcParse = locale2.utcParse;
35165     return locale2;
35166   }
35167   var locale2, timeFormat, timeParse, utcFormat, utcParse;
35168   var init_defaultLocale2 = __esm({
35169     "node_modules/d3-time-format/src/defaultLocale.js"() {
35170       init_locale2();
35171       defaultLocale2({
35172         dateTime: "%x, %X",
35173         date: "%-m/%-d/%Y",
35174         time: "%-I:%M:%S %p",
35175         periods: ["AM", "PM"],
35176         days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
35177         shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
35178         months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
35179         shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
35180       });
35181     }
35182   });
35183
35184   // node_modules/d3-time-format/src/index.js
35185   var init_src15 = __esm({
35186     "node_modules/d3-time-format/src/index.js"() {
35187       init_defaultLocale2();
35188     }
35189   });
35190
35191   // node_modules/d3-scale/src/index.js
35192   var init_src16 = __esm({
35193     "node_modules/d3-scale/src/index.js"() {
35194       init_linear2();
35195       init_quantize2();
35196     }
35197   });
35198
35199   // modules/behavior/breathe.js
35200   var breathe_exports = {};
35201   __export(breathe_exports, {
35202     behaviorBreathe: () => behaviorBreathe
35203   });
35204   function behaviorBreathe() {
35205     var duration = 800;
35206     var steps = 4;
35207     var selector = ".selected.shadow, .selected .shadow";
35208     var _selected = select_default2(null);
35209     var _classed = "";
35210     var _params = {};
35211     var _done = false;
35212     var _timer;
35213     function ratchetyInterpolator(a2, b2, steps2, units) {
35214       a2 = Number(a2);
35215       b2 = Number(b2);
35216       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
35217       return function(t2) {
35218         return String(sample(t2)) + (units || "");
35219       };
35220     }
35221     function reset(selection2) {
35222       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
35223     }
35224     function setAnimationParams(transition2, fromTo) {
35225       var toFrom = fromTo === "from" ? "to" : "from";
35226       transition2.styleTween("stroke-opacity", function(d2) {
35227         return ratchetyInterpolator(
35228           _params[d2.id][toFrom].opacity,
35229           _params[d2.id][fromTo].opacity,
35230           steps
35231         );
35232       }).styleTween("stroke-width", function(d2) {
35233         return ratchetyInterpolator(
35234           _params[d2.id][toFrom].width,
35235           _params[d2.id][fromTo].width,
35236           steps,
35237           "px"
35238         );
35239       }).styleTween("fill-opacity", function(d2) {
35240         return ratchetyInterpolator(
35241           _params[d2.id][toFrom].opacity,
35242           _params[d2.id][fromTo].opacity,
35243           steps
35244         );
35245       }).styleTween("r", function(d2) {
35246         return ratchetyInterpolator(
35247           _params[d2.id][toFrom].width,
35248           _params[d2.id][fromTo].width,
35249           steps,
35250           "px"
35251         );
35252       });
35253     }
35254     function calcAnimationParams(selection2) {
35255       selection2.call(reset).each(function(d2) {
35256         var s2 = select_default2(this);
35257         var tag2 = s2.node().tagName;
35258         var p2 = { "from": {}, "to": {} };
35259         var opacity;
35260         var width;
35261         if (tag2 === "circle") {
35262           opacity = Number(s2.style("fill-opacity") || 0.5);
35263           width = Number(s2.style("r") || 15.5);
35264         } else {
35265           opacity = Number(s2.style("stroke-opacity") || 0.7);
35266           width = Number(s2.style("stroke-width") || 10);
35267         }
35268         p2.tag = tag2;
35269         p2.from.opacity = opacity * 0.6;
35270         p2.to.opacity = opacity * 1.25;
35271         p2.from.width = width * 0.7;
35272         p2.to.width = width * (tag2 === "circle" ? 1.5 : 1);
35273         _params[d2.id] = p2;
35274       });
35275     }
35276     function run(surface, fromTo) {
35277       var toFrom = fromTo === "from" ? "to" : "from";
35278       var currSelected = surface.selectAll(selector);
35279       var currClassed = surface.attr("class");
35280       if (_done || currSelected.empty()) {
35281         _selected.call(reset);
35282         _selected = select_default2(null);
35283         return;
35284       }
35285       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
35286         _selected.call(reset);
35287         _classed = currClassed;
35288         _selected = currSelected.call(calcAnimationParams);
35289       }
35290       var didCallNextRun = false;
35291       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
35292         if (!didCallNextRun) {
35293           surface.call(run, toFrom);
35294           didCallNextRun = true;
35295         }
35296         if (!select_default2(this).classed("selected")) {
35297           reset(select_default2(this));
35298         }
35299       });
35300     }
35301     function behavior(surface) {
35302       _done = false;
35303       _timer = timer(function() {
35304         if (surface.selectAll(selector).empty()) {
35305           return false;
35306         }
35307         surface.call(run, "from");
35308         _timer.stop();
35309         return true;
35310       }, 20);
35311     }
35312     behavior.restartIfNeeded = function(surface) {
35313       if (_selected.empty()) {
35314         surface.call(run, "from");
35315         if (_timer) {
35316           _timer.stop();
35317         }
35318       }
35319     };
35320     behavior.off = function() {
35321       _done = true;
35322       if (_timer) {
35323         _timer.stop();
35324       }
35325       _selected.interrupt().call(reset);
35326     };
35327     return behavior;
35328   }
35329   var import_fast_deep_equal2;
35330   var init_breathe = __esm({
35331     "modules/behavior/breathe.js"() {
35332       "use strict";
35333       import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
35334       init_src8();
35335       init_src5();
35336       init_src16();
35337       init_src9();
35338     }
35339   });
35340
35341   // modules/behavior/operation.js
35342   var operation_exports = {};
35343   __export(operation_exports, {
35344     behaviorOperation: () => behaviorOperation
35345   });
35346   function behaviorOperation(context) {
35347     var _operation;
35348     function keypress(d3_event) {
35349       if (!context.map().withinEditableZoom()) return;
35350       if (_operation.availableForKeypress && !_operation.availableForKeypress()) return;
35351       d3_event.preventDefault();
35352       var disabled = _operation.disabled();
35353       if (disabled) {
35354         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
35355       } else {
35356         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
35357         if (_operation.point) _operation.point(null);
35358         _operation(d3_event);
35359       }
35360     }
35361     function behavior() {
35362       if (_operation && _operation.available()) {
35363         context.keybinding().on(_operation.keys, keypress);
35364       }
35365       return behavior;
35366     }
35367     behavior.off = function() {
35368       context.keybinding().off(_operation.keys);
35369     };
35370     behavior.which = function(_2) {
35371       if (!arguments.length) return _operation;
35372       _operation = _2;
35373       return behavior;
35374     };
35375     return behavior;
35376   }
35377   var init_operation = __esm({
35378     "modules/behavior/operation.js"() {
35379       "use strict";
35380     }
35381   });
35382
35383   // modules/operations/circularize.js
35384   var circularize_exports2 = {};
35385   __export(circularize_exports2, {
35386     operationCircularize: () => operationCircularize
35387   });
35388   function operationCircularize(context, selectedIDs) {
35389     var _extent;
35390     var _actions = selectedIDs.map(getAction).filter(Boolean);
35391     var _amount = _actions.length === 1 ? "single" : "multiple";
35392     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35393       return n3.loc;
35394     });
35395     function getAction(entityID) {
35396       var entity = context.entity(entityID);
35397       if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
35398       if (!_extent) {
35399         _extent = entity.extent(context.graph());
35400       } else {
35401         _extent = _extent.extend(entity.extent(context.graph()));
35402       }
35403       return actionCircularize(entityID, context.projection);
35404     }
35405     var operation2 = function() {
35406       if (!_actions.length) return;
35407       var combinedAction = function(graph, t2) {
35408         _actions.forEach(function(action) {
35409           if (!action.disabled(graph)) {
35410             graph = action(graph, t2);
35411           }
35412         });
35413         return graph;
35414       };
35415       combinedAction.transitionable = true;
35416       context.perform(combinedAction, operation2.annotation());
35417       window.setTimeout(function() {
35418         context.validator().validate();
35419       }, 300);
35420     };
35421     operation2.available = function() {
35422       return _actions.length && selectedIDs.length === _actions.length;
35423     };
35424     operation2.disabled = function() {
35425       if (!_actions.length) return "";
35426       var actionDisableds = _actions.map(function(action) {
35427         return action.disabled(context.graph());
35428       }).filter(Boolean);
35429       if (actionDisableds.length === _actions.length) {
35430         if (new Set(actionDisableds).size > 1) {
35431           return "multiple_blockers";
35432         }
35433         return actionDisableds[0];
35434       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
35435         return "too_large";
35436       } else if (someMissing()) {
35437         return "not_downloaded";
35438       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35439         return "connected_to_hidden";
35440       }
35441       return false;
35442       function someMissing() {
35443         if (context.inIntro()) return false;
35444         var osm = context.connection();
35445         if (osm) {
35446           var missing = _coords.filter(function(loc) {
35447             return !osm.isDataLoaded(loc);
35448           });
35449           if (missing.length) {
35450             missing.forEach(function(loc) {
35451               context.loadTileAtLoc(loc);
35452             });
35453             return true;
35454           }
35455         }
35456         return false;
35457       }
35458     };
35459     operation2.tooltip = function() {
35460       var disable = operation2.disabled();
35461       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
35462     };
35463     operation2.annotation = function() {
35464       return _t("operations.circularize.annotation.feature", { n: _actions.length });
35465     };
35466     operation2.id = "circularize";
35467     operation2.keys = [_t("operations.circularize.key")];
35468     operation2.title = _t.append("operations.circularize.title");
35469     operation2.behavior = behaviorOperation(context).which(operation2);
35470     return operation2;
35471   }
35472   var init_circularize2 = __esm({
35473     "modules/operations/circularize.js"() {
35474       "use strict";
35475       init_localizer();
35476       init_circularize();
35477       init_operation();
35478       init_util();
35479     }
35480   });
35481
35482   // modules/ui/cmd.js
35483   var cmd_exports = {};
35484   __export(cmd_exports, {
35485     uiCmd: () => uiCmd
35486   });
35487   var uiCmd;
35488   var init_cmd = __esm({
35489     "modules/ui/cmd.js"() {
35490       "use strict";
35491       init_localizer();
35492       init_detect();
35493       uiCmd = function(code) {
35494         var detected = utilDetect();
35495         if (detected.os === "mac") {
35496           return code;
35497         }
35498         if (detected.os === "win") {
35499           if (code === "\u2318\u21E7Z") return "Ctrl+Y";
35500         }
35501         var result = "", replacements = {
35502           "\u2318": "Ctrl",
35503           "\u21E7": "Shift",
35504           "\u2325": "Alt",
35505           "\u232B": "Backspace",
35506           "\u2326": "Delete"
35507         };
35508         for (var i3 = 0; i3 < code.length; i3++) {
35509           if (code[i3] in replacements) {
35510             result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
35511           } else {
35512             result += code[i3];
35513           }
35514         }
35515         return result;
35516       };
35517       uiCmd.display = function(code) {
35518         if (code.length !== 1) return code;
35519         var detected = utilDetect();
35520         var mac = detected.os === "mac";
35521         var replacements = {
35522           "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
35523           "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
35524           "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
35525           "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
35526           "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
35527           "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
35528           "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
35529           "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
35530           "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
35531           "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
35532           "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
35533           "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
35534           "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
35535         };
35536         return replacements[code] || code;
35537       };
35538     }
35539   });
35540
35541   // modules/operations/delete.js
35542   var delete_exports = {};
35543   __export(delete_exports, {
35544     operationDelete: () => operationDelete
35545   });
35546   function operationDelete(context, selectedIDs) {
35547     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35548     var action = actionDeleteMultiple(selectedIDs);
35549     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35550     var coords = nodes.map(function(n3) {
35551       return n3.loc;
35552     });
35553     var extent = utilTotalExtent(selectedIDs, context.graph());
35554     var operation2 = function() {
35555       var nextSelectedID;
35556       var nextSelectedLoc;
35557       if (selectedIDs.length === 1) {
35558         var id2 = selectedIDs[0];
35559         var entity = context.entity(id2);
35560         var geometry = entity.geometry(context.graph());
35561         var parents = context.graph().parentWays(entity);
35562         var parent = parents[0];
35563         if (geometry === "vertex") {
35564           var nodes2 = parent.nodes;
35565           var i3 = nodes2.indexOf(id2);
35566           if (i3 === 0) {
35567             i3++;
35568           } else if (i3 === nodes2.length - 1) {
35569             i3--;
35570           } else {
35571             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
35572             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
35573             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
35574           }
35575           nextSelectedID = nodes2[i3];
35576           nextSelectedLoc = context.entity(nextSelectedID).loc;
35577         }
35578       }
35579       context.perform(action, operation2.annotation());
35580       context.validator().validate();
35581       if (nextSelectedID && nextSelectedLoc) {
35582         if (context.hasEntity(nextSelectedID)) {
35583           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
35584         } else {
35585           context.map().centerEase(nextSelectedLoc);
35586           context.enter(modeBrowse(context));
35587         }
35588       } else {
35589         context.enter(modeBrowse(context));
35590       }
35591     };
35592     operation2.available = function() {
35593       return true;
35594     };
35595     operation2.disabled = function() {
35596       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35597         return "too_large";
35598       } else if (someMissing()) {
35599         return "not_downloaded";
35600       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35601         return "connected_to_hidden";
35602       } else if (selectedIDs.some(protectedMember)) {
35603         return "part_of_relation";
35604       } else if (selectedIDs.some(incompleteRelation)) {
35605         return "incomplete_relation";
35606       } else if (selectedIDs.some(hasWikidataTag)) {
35607         return "has_wikidata_tag";
35608       }
35609       return false;
35610       function someMissing() {
35611         if (context.inIntro()) return false;
35612         var osm = context.connection();
35613         if (osm) {
35614           var missing = coords.filter(function(loc) {
35615             return !osm.isDataLoaded(loc);
35616           });
35617           if (missing.length) {
35618             missing.forEach(function(loc) {
35619               context.loadTileAtLoc(loc);
35620             });
35621             return true;
35622           }
35623         }
35624         return false;
35625       }
35626       function hasWikidataTag(id2) {
35627         var entity = context.entity(id2);
35628         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
35629       }
35630       function incompleteRelation(id2) {
35631         var entity = context.entity(id2);
35632         return entity.type === "relation" && !entity.isComplete(context.graph());
35633       }
35634       function protectedMember(id2) {
35635         var entity = context.entity(id2);
35636         if (entity.type !== "way") return false;
35637         var parents = context.graph().parentRelations(entity);
35638         for (var i3 = 0; i3 < parents.length; i3++) {
35639           var parent = parents[i3];
35640           var type2 = parent.tags.type;
35641           var role = parent.memberById(id2).role || "outer";
35642           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
35643             return true;
35644           }
35645         }
35646         return false;
35647       }
35648     };
35649     operation2.tooltip = function() {
35650       var disable = operation2.disabled();
35651       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35652     };
35653     operation2.annotation = function() {
35654       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35655     };
35656     operation2.id = "delete";
35657     operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35658     operation2.title = _t.append("operations.delete.title");
35659     operation2.behavior = behaviorOperation(context).which(operation2);
35660     return operation2;
35661   }
35662   var init_delete = __esm({
35663     "modules/operations/delete.js"() {
35664       "use strict";
35665       init_localizer();
35666       init_delete_multiple();
35667       init_operation();
35668       init_geo2();
35669       init_browse();
35670       init_select5();
35671       init_cmd();
35672       init_util();
35673     }
35674   });
35675
35676   // modules/operations/orthogonalize.js
35677   var orthogonalize_exports2 = {};
35678   __export(orthogonalize_exports2, {
35679     operationOrthogonalize: () => operationOrthogonalize
35680   });
35681   function operationOrthogonalize(context, selectedIDs) {
35682     var _extent;
35683     var _type;
35684     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35685     var _amount = _actions.length === 1 ? "single" : "multiple";
35686     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35687       return n3.loc;
35688     });
35689     function chooseAction(entityID) {
35690       var entity = context.entity(entityID);
35691       var geometry = entity.geometry(context.graph());
35692       if (!_extent) {
35693         _extent = entity.extent(context.graph());
35694       } else {
35695         _extent = _extent.extend(entity.extent(context.graph()));
35696       }
35697       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35698         if (_type && _type !== "feature") return null;
35699         _type = "feature";
35700         return actionOrthogonalize(entityID, context.projection);
35701       } else if (geometry === "vertex") {
35702         if (_type && _type !== "corner") return null;
35703         _type = "corner";
35704         var graph = context.graph();
35705         var parents = graph.parentWays(entity);
35706         if (parents.length === 1) {
35707           var way = parents[0];
35708           if (way.nodes.indexOf(entityID) !== -1) {
35709             return actionOrthogonalize(way.id, context.projection, entityID);
35710           }
35711         }
35712       }
35713       return null;
35714     }
35715     var operation2 = function() {
35716       if (!_actions.length) return;
35717       var combinedAction = function(graph, t2) {
35718         _actions.forEach(function(action) {
35719           if (!action.disabled(graph)) {
35720             graph = action(graph, t2);
35721           }
35722         });
35723         return graph;
35724       };
35725       combinedAction.transitionable = true;
35726       context.perform(combinedAction, operation2.annotation());
35727       window.setTimeout(function() {
35728         context.validator().validate();
35729       }, 300);
35730     };
35731     operation2.available = function() {
35732       return _actions.length && selectedIDs.length === _actions.length;
35733     };
35734     operation2.disabled = function() {
35735       if (!_actions.length) return "";
35736       var actionDisableds = _actions.map(function(action) {
35737         return action.disabled(context.graph());
35738       }).filter(Boolean);
35739       if (actionDisableds.length === _actions.length) {
35740         if (new Set(actionDisableds).size > 1) {
35741           return "multiple_blockers";
35742         }
35743         return actionDisableds[0];
35744       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35745         return "too_large";
35746       } else if (someMissing()) {
35747         return "not_downloaded";
35748       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35749         return "connected_to_hidden";
35750       }
35751       return false;
35752       function someMissing() {
35753         if (context.inIntro()) return false;
35754         var osm = context.connection();
35755         if (osm) {
35756           var missing = _coords.filter(function(loc) {
35757             return !osm.isDataLoaded(loc);
35758           });
35759           if (missing.length) {
35760             missing.forEach(function(loc) {
35761               context.loadTileAtLoc(loc);
35762             });
35763             return true;
35764           }
35765         }
35766         return false;
35767       }
35768     };
35769     operation2.tooltip = function() {
35770       var disable = operation2.disabled();
35771       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35772     };
35773     operation2.annotation = function() {
35774       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35775     };
35776     operation2.id = "orthogonalize";
35777     operation2.keys = [_t("operations.orthogonalize.key")];
35778     operation2.title = _t.append("operations.orthogonalize.title");
35779     operation2.behavior = behaviorOperation(context).which(operation2);
35780     return operation2;
35781   }
35782   var init_orthogonalize2 = __esm({
35783     "modules/operations/orthogonalize.js"() {
35784       "use strict";
35785       init_localizer();
35786       init_orthogonalize();
35787       init_operation();
35788       init_util();
35789     }
35790   });
35791
35792   // modules/operations/reflect.js
35793   var reflect_exports2 = {};
35794   __export(reflect_exports2, {
35795     operationReflect: () => operationReflect,
35796     operationReflectLong: () => operationReflectLong,
35797     operationReflectShort: () => operationReflectShort
35798   });
35799   function operationReflectShort(context, selectedIDs) {
35800     return operationReflect(context, selectedIDs, "short");
35801   }
35802   function operationReflectLong(context, selectedIDs) {
35803     return operationReflect(context, selectedIDs, "long");
35804   }
35805   function operationReflect(context, selectedIDs, axis) {
35806     axis = axis || "long";
35807     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35808     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35809     var coords = nodes.map(function(n3) {
35810       return n3.loc;
35811     });
35812     var extent = utilTotalExtent(selectedIDs, context.graph());
35813     var operation2 = function() {
35814       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35815       context.perform(action, operation2.annotation());
35816       window.setTimeout(function() {
35817         context.validator().validate();
35818       }, 300);
35819     };
35820     operation2.available = function() {
35821       return nodes.length >= 3;
35822     };
35823     operation2.disabled = function() {
35824       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35825         return "too_large";
35826       } else if (someMissing()) {
35827         return "not_downloaded";
35828       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35829         return "connected_to_hidden";
35830       } else if (selectedIDs.some(incompleteRelation)) {
35831         return "incomplete_relation";
35832       }
35833       return false;
35834       function someMissing() {
35835         if (context.inIntro()) return false;
35836         var osm = context.connection();
35837         if (osm) {
35838           var missing = coords.filter(function(loc) {
35839             return !osm.isDataLoaded(loc);
35840           });
35841           if (missing.length) {
35842             missing.forEach(function(loc) {
35843               context.loadTileAtLoc(loc);
35844             });
35845             return true;
35846           }
35847         }
35848         return false;
35849       }
35850       function incompleteRelation(id2) {
35851         var entity = context.entity(id2);
35852         return entity.type === "relation" && !entity.isComplete(context.graph());
35853       }
35854     };
35855     operation2.tooltip = function() {
35856       var disable = operation2.disabled();
35857       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35858     };
35859     operation2.annotation = function() {
35860       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35861     };
35862     operation2.id = "reflect-" + axis;
35863     operation2.keys = [_t("operations.reflect.key." + axis)];
35864     operation2.title = _t.append("operations.reflect.title." + axis);
35865     operation2.behavior = behaviorOperation(context).which(operation2);
35866     return operation2;
35867   }
35868   var init_reflect2 = __esm({
35869     "modules/operations/reflect.js"() {
35870       "use strict";
35871       init_localizer();
35872       init_reflect();
35873       init_operation();
35874       init_util2();
35875     }
35876   });
35877
35878   // modules/operations/move.js
35879   var move_exports2 = {};
35880   __export(move_exports2, {
35881     operationMove: () => operationMove
35882   });
35883   function operationMove(context, selectedIDs) {
35884     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35885     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35886     var coords = nodes.map(function(n3) {
35887       return n3.loc;
35888     });
35889     var extent = utilTotalExtent(selectedIDs, context.graph());
35890     var operation2 = function() {
35891       context.enter(modeMove(context, selectedIDs));
35892     };
35893     operation2.available = function() {
35894       return selectedIDs.length > 0;
35895     };
35896     operation2.disabled = function() {
35897       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35898         return "too_large";
35899       } else if (someMissing()) {
35900         return "not_downloaded";
35901       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35902         return "connected_to_hidden";
35903       } else if (selectedIDs.some(incompleteRelation)) {
35904         return "incomplete_relation";
35905       }
35906       return false;
35907       function someMissing() {
35908         if (context.inIntro()) return false;
35909         var osm = context.connection();
35910         if (osm) {
35911           var missing = coords.filter(function(loc) {
35912             return !osm.isDataLoaded(loc);
35913           });
35914           if (missing.length) {
35915             missing.forEach(function(loc) {
35916               context.loadTileAtLoc(loc);
35917             });
35918             return true;
35919           }
35920         }
35921         return false;
35922       }
35923       function incompleteRelation(id2) {
35924         var entity = context.entity(id2);
35925         return entity.type === "relation" && !entity.isComplete(context.graph());
35926       }
35927     };
35928     operation2.tooltip = function() {
35929       var disable = operation2.disabled();
35930       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35931     };
35932     operation2.annotation = function() {
35933       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35934     };
35935     operation2.id = "move";
35936     operation2.keys = [_t("operations.move.key")];
35937     operation2.title = _t.append("operations.move.title");
35938     operation2.behavior = behaviorOperation(context).which(operation2);
35939     operation2.mouseOnly = true;
35940     return operation2;
35941   }
35942   var init_move2 = __esm({
35943     "modules/operations/move.js"() {
35944       "use strict";
35945       init_localizer();
35946       init_operation();
35947       init_move3();
35948       init_util2();
35949     }
35950   });
35951
35952   // modules/modes/rotate.js
35953   var rotate_exports2 = {};
35954   __export(rotate_exports2, {
35955     modeRotate: () => modeRotate
35956   });
35957   function modeRotate(context, entityIDs) {
35958     var _tolerancePx = 4;
35959     var mode = {
35960       id: "rotate",
35961       button: "browse"
35962     };
35963     var keybinding = utilKeybinding("rotate");
35964     var behaviors = [
35965       behaviorEdit(context),
35966       operationCircularize(context, entityIDs).behavior,
35967       operationDelete(context, entityIDs).behavior,
35968       operationMove(context, entityIDs).behavior,
35969       operationOrthogonalize(context, entityIDs).behavior,
35970       operationReflectLong(context, entityIDs).behavior,
35971       operationReflectShort(context, entityIDs).behavior
35972     ];
35973     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35974     var _prevGraph;
35975     var _prevAngle;
35976     var _prevTransform;
35977     var _pivot;
35978     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35979     function doRotate(d3_event) {
35980       var fn;
35981       if (context.graph() !== _prevGraph) {
35982         fn = context.perform;
35983       } else {
35984         fn = context.replace;
35985       }
35986       var projection2 = context.projection;
35987       var currTransform = projection2.transform();
35988       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35989         var nodes = utilGetAllNodes(entityIDs, context.graph());
35990         var points = nodes.map(function(n3) {
35991           return projection2(n3.loc);
35992         });
35993         _pivot = getPivot(points);
35994         _prevAngle = void 0;
35995       }
35996       var currMouse = context.map().mouse(d3_event);
35997       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35998       if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
35999       var delta = currAngle - _prevAngle;
36000       fn(actionRotate(entityIDs, _pivot, delta, projection2));
36001       _prevTransform = currTransform;
36002       _prevAngle = currAngle;
36003       _prevGraph = context.graph();
36004     }
36005     function getPivot(points) {
36006       var _pivot2;
36007       if (points.length === 1) {
36008         _pivot2 = points[0];
36009       } else if (points.length === 2) {
36010         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
36011       } else {
36012         var polygonHull = hull_default(points);
36013         if (polygonHull.length === 2) {
36014           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
36015         } else {
36016           _pivot2 = centroid_default2(hull_default(points));
36017         }
36018       }
36019       return _pivot2;
36020     }
36021     function finish(d3_event) {
36022       d3_event.stopPropagation();
36023       context.replace(actionNoop(), annotation);
36024       context.enter(modeSelect(context, entityIDs));
36025     }
36026     function cancel() {
36027       if (_prevGraph) context.pop();
36028       context.enter(modeSelect(context, entityIDs));
36029     }
36030     function undone() {
36031       context.enter(modeBrowse(context));
36032     }
36033     mode.enter = function() {
36034       _prevGraph = null;
36035       context.features().forceVisible(entityIDs);
36036       behaviors.forEach(context.install);
36037       var downEvent;
36038       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
36039         downEvent = d3_event;
36040       });
36041       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
36042         if (!downEvent) return;
36043         var mapNode = context.container().select(".main-map").node();
36044         var pointGetter = utilFastMouse(mapNode);
36045         var p1 = pointGetter(downEvent);
36046         var p2 = pointGetter(d3_event);
36047         var dist = geoVecLength(p1, p2);
36048         if (dist <= _tolerancePx) finish(d3_event);
36049         downEvent = null;
36050       }, true);
36051       context.history().on("undone.modeRotate", undone);
36052       keybinding.on("\u238B", cancel).on("\u21A9", finish);
36053       select_default2(document).call(keybinding);
36054     };
36055     mode.exit = function() {
36056       behaviors.forEach(context.uninstall);
36057       context.surface().on(_pointerPrefix + "down.modeRotate", null);
36058       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
36059       context.history().on("undone.modeRotate", null);
36060       select_default2(document).call(keybinding.unbind);
36061       context.features().forceVisible([]);
36062     };
36063     mode.selectedIDs = function() {
36064       if (!arguments.length) return entityIDs;
36065       return mode;
36066     };
36067     return mode;
36068   }
36069   var init_rotate2 = __esm({
36070     "modules/modes/rotate.js"() {
36071       "use strict";
36072       init_src5();
36073       init_src3();
36074       init_localizer();
36075       init_rotate();
36076       init_noop2();
36077       init_edit();
36078       init_vector();
36079       init_browse();
36080       init_select5();
36081       init_circularize2();
36082       init_delete();
36083       init_move2();
36084       init_orthogonalize2();
36085       init_reflect2();
36086       init_keybinding();
36087       init_util2();
36088     }
36089   });
36090
36091   // modules/operations/rotate.js
36092   var rotate_exports3 = {};
36093   __export(rotate_exports3, {
36094     operationRotate: () => operationRotate
36095   });
36096   function operationRotate(context, selectedIDs) {
36097     var multi = selectedIDs.length === 1 ? "single" : "multiple";
36098     var nodes = utilGetAllNodes(selectedIDs, context.graph());
36099     var coords = nodes.map(function(n3) {
36100       return n3.loc;
36101     });
36102     var extent = utilTotalExtent(selectedIDs, context.graph());
36103     var operation2 = function() {
36104       context.enter(modeRotate(context, selectedIDs));
36105     };
36106     operation2.available = function() {
36107       return nodes.length >= 2;
36108     };
36109     operation2.disabled = function() {
36110       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
36111         return "too_large";
36112       } else if (someMissing()) {
36113         return "not_downloaded";
36114       } else if (selectedIDs.some(context.hasHiddenConnections)) {
36115         return "connected_to_hidden";
36116       } else if (selectedIDs.some(incompleteRelation)) {
36117         return "incomplete_relation";
36118       }
36119       return false;
36120       function someMissing() {
36121         if (context.inIntro()) return false;
36122         var osm = context.connection();
36123         if (osm) {
36124           var missing = coords.filter(function(loc) {
36125             return !osm.isDataLoaded(loc);
36126           });
36127           if (missing.length) {
36128             missing.forEach(function(loc) {
36129               context.loadTileAtLoc(loc);
36130             });
36131             return true;
36132           }
36133         }
36134         return false;
36135       }
36136       function incompleteRelation(id2) {
36137         var entity = context.entity(id2);
36138         return entity.type === "relation" && !entity.isComplete(context.graph());
36139       }
36140     };
36141     operation2.tooltip = function() {
36142       var disable = operation2.disabled();
36143       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
36144     };
36145     operation2.annotation = function() {
36146       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
36147     };
36148     operation2.id = "rotate";
36149     operation2.keys = [_t("operations.rotate.key")];
36150     operation2.title = _t.append("operations.rotate.title");
36151     operation2.behavior = behaviorOperation(context).which(operation2);
36152     operation2.mouseOnly = true;
36153     return operation2;
36154   }
36155   var init_rotate3 = __esm({
36156     "modules/operations/rotate.js"() {
36157       "use strict";
36158       init_localizer();
36159       init_operation();
36160       init_rotate2();
36161       init_util2();
36162     }
36163   });
36164
36165   // modules/modes/move.js
36166   var move_exports3 = {};
36167   __export(move_exports3, {
36168     modeMove: () => modeMove
36169   });
36170   function modeMove(context, entityIDs, baseGraph) {
36171     var _tolerancePx = 4;
36172     var mode = {
36173       id: "move",
36174       button: "browse"
36175     };
36176     var keybinding = utilKeybinding("move");
36177     var behaviors = [
36178       behaviorEdit(context),
36179       operationCircularize(context, entityIDs).behavior,
36180       operationDelete(context, entityIDs).behavior,
36181       operationOrthogonalize(context, entityIDs).behavior,
36182       operationReflectLong(context, entityIDs).behavior,
36183       operationReflectShort(context, entityIDs).behavior,
36184       operationRotate(context, entityIDs).behavior
36185     ];
36186     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
36187     var _prevGraph;
36188     var _cache5;
36189     var _origin;
36190     var _nudgeInterval;
36191     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36192     function doMove(nudge) {
36193       nudge = nudge || [0, 0];
36194       var fn;
36195       if (_prevGraph !== context.graph()) {
36196         _cache5 = {};
36197         _origin = context.map().mouseCoordinates();
36198         fn = context.perform;
36199       } else {
36200         fn = context.overwrite;
36201       }
36202       var currMouse = context.map().mouse();
36203       var origMouse = context.projection(_origin);
36204       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
36205       fn(actionMove(entityIDs, delta, context.projection, _cache5));
36206       _prevGraph = context.graph();
36207     }
36208     function startNudge(nudge) {
36209       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36210       _nudgeInterval = window.setInterval(function() {
36211         context.map().pan(nudge);
36212         doMove(nudge);
36213       }, 50);
36214     }
36215     function stopNudge() {
36216       if (_nudgeInterval) {
36217         window.clearInterval(_nudgeInterval);
36218         _nudgeInterval = null;
36219       }
36220     }
36221     function move() {
36222       doMove();
36223       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
36224       if (nudge) {
36225         startNudge(nudge);
36226       } else {
36227         stopNudge();
36228       }
36229     }
36230     function finish(d3_event) {
36231       d3_event.stopPropagation();
36232       context.replace(actionNoop(), annotation);
36233       context.enter(modeSelect(context, entityIDs));
36234       stopNudge();
36235     }
36236     function cancel() {
36237       if (baseGraph) {
36238         while (context.graph() !== baseGraph) context.pop();
36239         context.enter(modeBrowse(context));
36240       } else {
36241         if (_prevGraph) context.pop();
36242         context.enter(modeSelect(context, entityIDs));
36243       }
36244       stopNudge();
36245     }
36246     function undone() {
36247       context.enter(modeBrowse(context));
36248     }
36249     mode.enter = function() {
36250       _origin = context.map().mouseCoordinates();
36251       _prevGraph = null;
36252       _cache5 = {};
36253       context.features().forceVisible(entityIDs);
36254       behaviors.forEach(context.install);
36255       var downEvent;
36256       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
36257         downEvent = d3_event;
36258       });
36259       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
36260         if (!downEvent) return;
36261         var mapNode = context.container().select(".main-map").node();
36262         var pointGetter = utilFastMouse(mapNode);
36263         var p1 = pointGetter(downEvent);
36264         var p2 = pointGetter(d3_event);
36265         var dist = geoVecLength(p1, p2);
36266         if (dist <= _tolerancePx) finish(d3_event);
36267         downEvent = null;
36268       }, true);
36269       context.history().on("undone.modeMove", undone);
36270       keybinding.on("\u238B", cancel).on("\u21A9", finish);
36271       select_default2(document).call(keybinding);
36272     };
36273     mode.exit = function() {
36274       stopNudge();
36275       behaviors.forEach(function(behavior) {
36276         context.uninstall(behavior);
36277       });
36278       context.surface().on(_pointerPrefix + "down.modeMove", null);
36279       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
36280       context.history().on("undone.modeMove", null);
36281       select_default2(document).call(keybinding.unbind);
36282       context.features().forceVisible([]);
36283     };
36284     mode.selectedIDs = function() {
36285       if (!arguments.length) return entityIDs;
36286       return mode;
36287     };
36288     return mode;
36289   }
36290   var init_move3 = __esm({
36291     "modules/modes/move.js"() {
36292       "use strict";
36293       init_src5();
36294       init_localizer();
36295       init_move();
36296       init_noop2();
36297       init_edit();
36298       init_vector();
36299       init_geom();
36300       init_browse();
36301       init_select5();
36302       init_util();
36303       init_util2();
36304       init_circularize2();
36305       init_delete();
36306       init_orthogonalize2();
36307       init_reflect2();
36308       init_rotate3();
36309     }
36310   });
36311
36312   // modules/behavior/paste.js
36313   var paste_exports = {};
36314   __export(paste_exports, {
36315     behaviorPaste: () => behaviorPaste
36316   });
36317   function behaviorPaste(context) {
36318     function doPaste(d3_event) {
36319       if (!context.map().withinEditableZoom()) return;
36320       const isOsmLayerEnabled = context.layers().layer("osm").enabled();
36321       if (!isOsmLayerEnabled) return;
36322       d3_event.preventDefault();
36323       var baseGraph = context.graph();
36324       var mouse = context.map().mouse();
36325       var projection2 = context.projection;
36326       var viewport = geoExtent(projection2.clipExtent()).polygon();
36327       if (!geoPointInPolygon(mouse, viewport)) return;
36328       var oldIDs = context.copyIDs();
36329       if (!oldIDs.length) return;
36330       var extent = geoExtent();
36331       var oldGraph = context.copyGraph();
36332       var newIDs = [];
36333       var action = actionCopyEntities(oldIDs, oldGraph);
36334       context.perform(action);
36335       var copies = action.copies();
36336       var originals = /* @__PURE__ */ new Set();
36337       Object.values(copies).forEach(function(entity) {
36338         originals.add(entity.id);
36339       });
36340       for (var id2 in copies) {
36341         var oldEntity = oldGraph.entity(id2);
36342         var newEntity = copies[id2];
36343         extent._extend(oldEntity.extent(oldGraph));
36344         var parents = context.graph().parentWays(newEntity);
36345         var parentCopied = parents.some(function(parent) {
36346           return originals.has(parent.id);
36347         });
36348         if (!parentCopied) {
36349           newIDs.push(newEntity.id);
36350         }
36351       }
36352       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
36353       var delta = geoVecSubtract(mouse, copyPoint);
36354       context.perform(actionMove(newIDs, delta, projection2));
36355       context.enter(modeMove(context, newIDs, baseGraph));
36356     }
36357     function behavior() {
36358       context.keybinding().on(uiCmd("\u2318V"), doPaste);
36359       return behavior;
36360     }
36361     behavior.off = function() {
36362       context.keybinding().off(uiCmd("\u2318V"));
36363     };
36364     return behavior;
36365   }
36366   var init_paste = __esm({
36367     "modules/behavior/paste.js"() {
36368       "use strict";
36369       init_copy_entities();
36370       init_move();
36371       init_geo2();
36372       init_move3();
36373       init_cmd();
36374     }
36375   });
36376
36377   // modules/behavior/drag.js
36378   var drag_exports = {};
36379   __export(drag_exports, {
36380     behaviorDrag: () => behaviorDrag
36381   });
36382   function behaviorDrag() {
36383     var dispatch14 = dispatch_default("start", "move", "end");
36384     var _tolerancePx = 1;
36385     var _penTolerancePx = 4;
36386     var _origin = null;
36387     var _selector = "";
36388     var _targetNode;
36389     var _targetEntity;
36390     var _surface;
36391     var _pointerId;
36392     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36393     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
36394     var d3_event_userSelectSuppress = function() {
36395       var selection2 = selection_default();
36396       var select = selection2.style(d3_event_userSelectProperty);
36397       selection2.style(d3_event_userSelectProperty, "none");
36398       return function() {
36399         selection2.style(d3_event_userSelectProperty, select);
36400       };
36401     };
36402     function pointerdown(d3_event) {
36403       if (_pointerId) return;
36404       _pointerId = d3_event.pointerId || "mouse";
36405       _targetNode = this;
36406       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
36407       var offset;
36408       var startOrigin = pointerLocGetter(d3_event);
36409       var started = false;
36410       var selectEnable = d3_event_userSelectSuppress();
36411       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
36412       if (_origin) {
36413         offset = _origin.call(_targetNode, _targetEntity);
36414         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
36415       } else {
36416         offset = [0, 0];
36417       }
36418       d3_event.stopPropagation();
36419       function pointermove(d3_event2) {
36420         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36421         var p2 = pointerLocGetter(d3_event2);
36422         if (!started) {
36423           var dist = geoVecLength(startOrigin, p2);
36424           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
36425           if (dist < tolerance) return;
36426           started = true;
36427           dispatch14.call("start", this, d3_event2, _targetEntity);
36428         } else {
36429           startOrigin = p2;
36430           d3_event2.stopPropagation();
36431           d3_event2.preventDefault();
36432           var dx = p2[0] - startOrigin[0];
36433           var dy = p2[1] - startOrigin[1];
36434           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
36435         }
36436       }
36437       function pointerup(d3_event2) {
36438         if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36439         _pointerId = null;
36440         if (started) {
36441           dispatch14.call("end", this, d3_event2, _targetEntity);
36442           d3_event2.preventDefault();
36443         }
36444         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36445         selectEnable();
36446       }
36447     }
36448     function behavior(selection2) {
36449       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
36450       var delegate = pointerdown;
36451       if (_selector) {
36452         delegate = function(d3_event) {
36453           var root3 = this;
36454           var target = d3_event.target;
36455           for (; target && target !== root3; target = target.parentNode) {
36456             var datum2 = target.__data__;
36457             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
36458             if (_targetEntity && target[matchesSelector](_selector)) {
36459               return pointerdown.call(target, d3_event);
36460             }
36461           }
36462         };
36463       }
36464       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
36465     }
36466     behavior.off = function(selection2) {
36467       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
36468     };
36469     behavior.selector = function(_2) {
36470       if (!arguments.length) return _selector;
36471       _selector = _2;
36472       return behavior;
36473     };
36474     behavior.origin = function(_2) {
36475       if (!arguments.length) return _origin;
36476       _origin = _2;
36477       return behavior;
36478     };
36479     behavior.cancel = function() {
36480       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36481       return behavior;
36482     };
36483     behavior.targetNode = function(_2) {
36484       if (!arguments.length) return _targetNode;
36485       _targetNode = _2;
36486       return behavior;
36487     };
36488     behavior.targetEntity = function(_2) {
36489       if (!arguments.length) return _targetEntity;
36490       _targetEntity = _2;
36491       return behavior;
36492     };
36493     behavior.surface = function(_2) {
36494       if (!arguments.length) return _surface;
36495       _surface = _2;
36496       return behavior;
36497     };
36498     return utilRebind(behavior, dispatch14, "on");
36499   }
36500   var init_drag2 = __esm({
36501     "modules/behavior/drag.js"() {
36502       "use strict";
36503       init_src4();
36504       init_src5();
36505       init_geo2();
36506       init_osm();
36507       init_rebind();
36508       init_util();
36509     }
36510   });
36511
36512   // modules/modes/drag_node.js
36513   var drag_node_exports = {};
36514   __export(drag_node_exports, {
36515     modeDragNode: () => modeDragNode
36516   });
36517   function modeDragNode(context) {
36518     var mode = {
36519       id: "drag-node",
36520       button: "browse"
36521     };
36522     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
36523     var edit2 = behaviorEdit(context);
36524     var _nudgeInterval;
36525     var _restoreSelectedIDs = [];
36526     var _wasMidpoint = false;
36527     var _isCancelled = false;
36528     var _activeEntity;
36529     var _startLoc;
36530     var _lastLoc;
36531     function startNudge(d3_event, entity, nudge) {
36532       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36533       _nudgeInterval = window.setInterval(function() {
36534         context.map().pan(nudge);
36535         doMove(d3_event, entity, nudge);
36536       }, 50);
36537     }
36538     function stopNudge() {
36539       if (_nudgeInterval) {
36540         window.clearInterval(_nudgeInterval);
36541         _nudgeInterval = null;
36542       }
36543     }
36544     function moveAnnotation(entity) {
36545       return _t("operations.move.annotation." + entity.geometry(context.graph()));
36546     }
36547     function connectAnnotation(nodeEntity, targetEntity) {
36548       var nodeGeometry = nodeEntity.geometry(context.graph());
36549       var targetGeometry = targetEntity.geometry(context.graph());
36550       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
36551         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
36552         var targetParentWayIDs = context.graph().parentWays(targetEntity);
36553         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
36554         if (sharedParentWays.length !== 0) {
36555           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
36556             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
36557           }
36558           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
36559         }
36560       }
36561       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
36562     }
36563     function shouldSnapToNode(target) {
36564       if (!_activeEntity) return false;
36565       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
36566     }
36567     function origin(entity) {
36568       return context.projection(entity.loc);
36569     }
36570     function keydown(d3_event) {
36571       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36572         if (context.surface().classed("nope")) {
36573           context.surface().classed("nope-suppressed", true);
36574         }
36575         context.surface().classed("nope", false).classed("nope-disabled", true);
36576       }
36577     }
36578     function keyup(d3_event) {
36579       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36580         if (context.surface().classed("nope-suppressed")) {
36581           context.surface().classed("nope", true);
36582         }
36583         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
36584       }
36585     }
36586     function start2(d3_event, entity) {
36587       _wasMidpoint = entity.type === "midpoint";
36588       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
36589       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
36590       if (_isCancelled) {
36591         if (hasHidden) {
36592           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
36593         }
36594         return drag.cancel();
36595       }
36596       if (_wasMidpoint) {
36597         var midpoint = entity;
36598         entity = osmNode();
36599         context.perform(actionAddMidpoint(midpoint, entity));
36600         entity = context.entity(entity.id);
36601         var vertex = context.surface().selectAll("." + entity.id);
36602         drag.targetNode(vertex.node()).targetEntity(entity);
36603       } else {
36604         context.perform(actionNoop());
36605       }
36606       _activeEntity = entity;
36607       _startLoc = entity.loc;
36608       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
36609       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
36610       context.enter(mode);
36611     }
36612     function datum2(d3_event) {
36613       if (!d3_event || d3_event.altKey) {
36614         return {};
36615       } else {
36616         var d2 = d3_event.target.__data__;
36617         return d2 && d2.properties && d2.properties.target ? d2 : {};
36618       }
36619     }
36620     function doMove(d3_event, entity, nudge) {
36621       nudge = nudge || [0, 0];
36622       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
36623       var currMouse = geoVecSubtract(currPoint, nudge);
36624       var loc = context.projection.invert(currMouse);
36625       var target, edge;
36626       if (!_nudgeInterval) {
36627         var d2 = datum2(d3_event);
36628         target = d2 && d2.properties && d2.properties.entity;
36629         var targetLoc = target && target.loc;
36630         var targetNodes = d2 && d2.properties && d2.properties.nodes;
36631         if (targetLoc) {
36632           if (shouldSnapToNode(target)) {
36633             loc = targetLoc;
36634           }
36635         } else if (targetNodes) {
36636           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
36637           if (edge) {
36638             loc = edge.loc;
36639           }
36640         }
36641       }
36642       context.replace(
36643         actionMoveNode(entity.id, loc)
36644       );
36645       var isInvalid = false;
36646       if (target) {
36647         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
36648       }
36649       if (!isInvalid) {
36650         isInvalid = hasInvalidGeometry(entity, context.graph());
36651       }
36652       var nope = context.surface().classed("nope");
36653       if (isInvalid === "relation" || isInvalid === "restriction") {
36654         if (!nope) {
36655           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
36656             "operations.connect." + isInvalid,
36657             { relation: _mainPresetIndex.item("type/restriction").name() }
36658           ))();
36659         }
36660       } else if (isInvalid) {
36661         var errorID = isInvalid === "line" ? "lines" : "areas";
36662         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
36663       } else {
36664         if (nope) {
36665           context.ui().flash.duration(1).label("")();
36666         }
36667       }
36668       var nopeDisabled = context.surface().classed("nope-disabled");
36669       if (nopeDisabled) {
36670         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
36671       } else {
36672         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
36673       }
36674       _lastLoc = loc;
36675     }
36676     function hasRelationConflict(entity, target, edge, graph) {
36677       var testGraph = graph.update();
36678       if (edge) {
36679         var midpoint = osmNode();
36680         var action = actionAddMidpoint({
36681           loc: edge.loc,
36682           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
36683         }, midpoint);
36684         testGraph = action(testGraph);
36685         target = midpoint;
36686       }
36687       var ids = [entity.id, target.id];
36688       return actionConnect(ids).disabled(testGraph);
36689     }
36690     function hasInvalidGeometry(entity, graph) {
36691       var parents = graph.parentWays(entity);
36692       var i3, j2, k2;
36693       for (i3 = 0; i3 < parents.length; i3++) {
36694         var parent = parents[i3];
36695         var nodes = [];
36696         var activeIndex = null;
36697         var relations = graph.parentRelations(parent);
36698         for (j2 = 0; j2 < relations.length; j2++) {
36699           if (!relations[j2].isMultipolygon()) continue;
36700           var rings = osmJoinWays(relations[j2].members, graph);
36701           for (k2 = 0; k2 < rings.length; k2++) {
36702             nodes = rings[k2].nodes;
36703             if (nodes.find(function(n3) {
36704               return n3.id === entity.id;
36705             })) {
36706               activeIndex = k2;
36707               if (geoHasSelfIntersections(nodes, entity.id)) {
36708                 return "multipolygonMember";
36709               }
36710             }
36711             rings[k2].coords = nodes.map(function(n3) {
36712               return n3.loc;
36713             });
36714           }
36715           for (k2 = 0; k2 < rings.length; k2++) {
36716             if (k2 === activeIndex) continue;
36717             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
36718               return "multipolygonRing";
36719             }
36720           }
36721         }
36722         if (activeIndex === null) {
36723           nodes = parent.nodes.map(function(nodeID) {
36724             return graph.entity(nodeID);
36725           });
36726           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
36727             return parent.geometry(graph);
36728           }
36729         }
36730       }
36731       return false;
36732     }
36733     function move(d3_event, entity, point) {
36734       if (_isCancelled) return;
36735       d3_event.stopPropagation();
36736       context.surface().classed("nope-disabled", d3_event.altKey);
36737       _lastLoc = context.projection.invert(point);
36738       doMove(d3_event, entity);
36739       var nudge = geoViewportEdge(point, context.map().dimensions());
36740       if (nudge) {
36741         startNudge(d3_event, entity, nudge);
36742       } else {
36743         stopNudge();
36744       }
36745     }
36746     function end(d3_event, entity) {
36747       if (_isCancelled) return;
36748       var wasPoint = entity.geometry(context.graph()) === "point";
36749       var d2 = datum2(d3_event);
36750       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
36751       var target = d2 && d2.properties && d2.properties.entity;
36752       if (nope) {
36753         context.perform(
36754           _actionBounceBack(entity.id, _startLoc)
36755         );
36756       } else if (target && target.type === "way") {
36757         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
36758         context.replace(
36759           actionAddMidpoint({
36760             loc: choice.loc,
36761             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
36762           }, entity),
36763           connectAnnotation(entity, target)
36764         );
36765       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36766         context.replace(
36767           actionConnect([target.id, entity.id]),
36768           connectAnnotation(entity, target)
36769         );
36770       } else if (_wasMidpoint) {
36771         context.replace(
36772           actionNoop(),
36773           _t("operations.add.annotation.vertex")
36774         );
36775       } else {
36776         context.replace(
36777           actionNoop(),
36778           moveAnnotation(entity)
36779         );
36780       }
36781       if (wasPoint) {
36782         context.enter(modeSelect(context, [entity.id]));
36783       } else {
36784         var reselection = _restoreSelectedIDs.filter(function(id2) {
36785           return context.graph().hasEntity(id2);
36786         });
36787         if (reselection.length) {
36788           context.enter(modeSelect(context, reselection));
36789         } else {
36790           context.enter(modeBrowse(context));
36791         }
36792       }
36793     }
36794     function _actionBounceBack(nodeID, toLoc) {
36795       var moveNode = actionMoveNode(nodeID, toLoc);
36796       var action = function(graph, t2) {
36797         if (t2 === 1) context.pop();
36798         return moveNode(graph, t2);
36799       };
36800       action.transitionable = true;
36801       return action;
36802     }
36803     function cancel() {
36804       drag.cancel();
36805       context.enter(modeBrowse(context));
36806     }
36807     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);
36808     mode.enter = function() {
36809       context.install(hover);
36810       context.install(edit2);
36811       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36812       context.history().on("undone.drag-node", cancel);
36813     };
36814     mode.exit = function() {
36815       context.ui().sidebar.hover.cancel();
36816       context.uninstall(hover);
36817       context.uninstall(edit2);
36818       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36819       context.history().on("undone.drag-node", null);
36820       _activeEntity = null;
36821       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36822       stopNudge();
36823     };
36824     mode.selectedIDs = function() {
36825       if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
36826       return mode;
36827     };
36828     mode.activeID = function() {
36829       if (!arguments.length) return _activeEntity && _activeEntity.id;
36830       return mode;
36831     };
36832     mode.restoreSelectedIDs = function(_2) {
36833       if (!arguments.length) return _restoreSelectedIDs;
36834       _restoreSelectedIDs = _2;
36835       return mode;
36836     };
36837     mode.behavior = drag;
36838     return mode;
36839   }
36840   var init_drag_node = __esm({
36841     "modules/modes/drag_node.js"() {
36842       "use strict";
36843       init_src5();
36844       init_presets();
36845       init_localizer();
36846       init_add_midpoint();
36847       init_connect();
36848       init_move_node();
36849       init_noop2();
36850       init_drag2();
36851       init_edit();
36852       init_hover();
36853       init_geo2();
36854       init_browse();
36855       init_select5();
36856       init_osm();
36857       init_util();
36858     }
36859   });
36860
36861   // node_modules/quickselect/index.js
36862   function quickselect2(arr, k2, left = 0, right = arr.length - 1, compare2 = defaultCompare) {
36863     while (right > left) {
36864       if (right - left > 600) {
36865         const n3 = right - left + 1;
36866         const m2 = k2 - left + 1;
36867         const z2 = Math.log(n3);
36868         const s2 = 0.5 * Math.exp(2 * z2 / 3);
36869         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
36870         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
36871         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
36872         quickselect2(arr, k2, newLeft, newRight, compare2);
36873       }
36874       const t2 = arr[k2];
36875       let i3 = left;
36876       let j2 = right;
36877       swap2(arr, left, k2);
36878       if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
36879       while (i3 < j2) {
36880         swap2(arr, i3, j2);
36881         i3++;
36882         j2--;
36883         while (compare2(arr[i3], t2) < 0) i3++;
36884         while (compare2(arr[j2], t2) > 0) j2--;
36885       }
36886       if (compare2(arr[left], t2) === 0) swap2(arr, left, j2);
36887       else {
36888         j2++;
36889         swap2(arr, j2, right);
36890       }
36891       if (j2 <= k2) left = j2 + 1;
36892       if (k2 <= j2) right = j2 - 1;
36893     }
36894   }
36895   function swap2(arr, i3, j2) {
36896     const tmp = arr[i3];
36897     arr[i3] = arr[j2];
36898     arr[j2] = tmp;
36899   }
36900   function defaultCompare(a2, b2) {
36901     return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
36902   }
36903   var init_quickselect2 = __esm({
36904     "node_modules/quickselect/index.js"() {
36905     }
36906   });
36907
36908   // node_modules/rbush/index.js
36909   function findItem(item, items, equalsFn) {
36910     if (!equalsFn) return items.indexOf(item);
36911     for (let i3 = 0; i3 < items.length; i3++) {
36912       if (equalsFn(item, items[i3])) return i3;
36913     }
36914     return -1;
36915   }
36916   function calcBBox(node, toBBox) {
36917     distBBox(node, 0, node.children.length, toBBox, node);
36918   }
36919   function distBBox(node, k2, p2, toBBox, destNode) {
36920     if (!destNode) destNode = createNode(null);
36921     destNode.minX = Infinity;
36922     destNode.minY = Infinity;
36923     destNode.maxX = -Infinity;
36924     destNode.maxY = -Infinity;
36925     for (let i3 = k2; i3 < p2; i3++) {
36926       const child = node.children[i3];
36927       extend2(destNode, node.leaf ? toBBox(child) : child);
36928     }
36929     return destNode;
36930   }
36931   function extend2(a2, b2) {
36932     a2.minX = Math.min(a2.minX, b2.minX);
36933     a2.minY = Math.min(a2.minY, b2.minY);
36934     a2.maxX = Math.max(a2.maxX, b2.maxX);
36935     a2.maxY = Math.max(a2.maxY, b2.maxY);
36936     return a2;
36937   }
36938   function compareNodeMinX(a2, b2) {
36939     return a2.minX - b2.minX;
36940   }
36941   function compareNodeMinY(a2, b2) {
36942     return a2.minY - b2.minY;
36943   }
36944   function bboxArea(a2) {
36945     return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
36946   }
36947   function bboxMargin(a2) {
36948     return a2.maxX - a2.minX + (a2.maxY - a2.minY);
36949   }
36950   function enlargedArea(a2, b2) {
36951     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));
36952   }
36953   function intersectionArea(a2, b2) {
36954     const minX = Math.max(a2.minX, b2.minX);
36955     const minY = Math.max(a2.minY, b2.minY);
36956     const maxX = Math.min(a2.maxX, b2.maxX);
36957     const maxY = Math.min(a2.maxY, b2.maxY);
36958     return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
36959   }
36960   function contains(a2, b2) {
36961     return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
36962   }
36963   function intersects(a2, b2) {
36964     return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
36965   }
36966   function createNode(children2) {
36967     return {
36968       children: children2,
36969       height: 1,
36970       leaf: true,
36971       minX: Infinity,
36972       minY: Infinity,
36973       maxX: -Infinity,
36974       maxY: -Infinity
36975     };
36976   }
36977   function multiSelect(arr, left, right, n3, compare2) {
36978     const stack = [left, right];
36979     while (stack.length) {
36980       right = stack.pop();
36981       left = stack.pop();
36982       if (right - left <= n3) continue;
36983       const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
36984       quickselect2(arr, mid, left, right, compare2);
36985       stack.push(left, mid, mid, right);
36986     }
36987   }
36988   var RBush;
36989   var init_rbush = __esm({
36990     "node_modules/rbush/index.js"() {
36991       init_quickselect2();
36992       RBush = class {
36993         constructor(maxEntries = 9) {
36994           this._maxEntries = Math.max(4, maxEntries);
36995           this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
36996           this.clear();
36997         }
36998         all() {
36999           return this._all(this.data, []);
37000         }
37001         search(bbox2) {
37002           let node = this.data;
37003           const result = [];
37004           if (!intersects(bbox2, node)) return result;
37005           const toBBox = this.toBBox;
37006           const nodesToSearch = [];
37007           while (node) {
37008             for (let i3 = 0; i3 < node.children.length; i3++) {
37009               const child = node.children[i3];
37010               const childBBox = node.leaf ? toBBox(child) : child;
37011               if (intersects(bbox2, childBBox)) {
37012                 if (node.leaf) result.push(child);
37013                 else if (contains(bbox2, childBBox)) this._all(child, result);
37014                 else nodesToSearch.push(child);
37015               }
37016             }
37017             node = nodesToSearch.pop();
37018           }
37019           return result;
37020         }
37021         collides(bbox2) {
37022           let node = this.data;
37023           if (!intersects(bbox2, node)) return false;
37024           const nodesToSearch = [];
37025           while (node) {
37026             for (let i3 = 0; i3 < node.children.length; i3++) {
37027               const child = node.children[i3];
37028               const childBBox = node.leaf ? this.toBBox(child) : child;
37029               if (intersects(bbox2, childBBox)) {
37030                 if (node.leaf || contains(bbox2, childBBox)) return true;
37031                 nodesToSearch.push(child);
37032               }
37033             }
37034             node = nodesToSearch.pop();
37035           }
37036           return false;
37037         }
37038         load(data) {
37039           if (!(data && data.length)) return this;
37040           if (data.length < this._minEntries) {
37041             for (let i3 = 0; i3 < data.length; i3++) {
37042               this.insert(data[i3]);
37043             }
37044             return this;
37045           }
37046           let node = this._build(data.slice(), 0, data.length - 1, 0);
37047           if (!this.data.children.length) {
37048             this.data = node;
37049           } else if (this.data.height === node.height) {
37050             this._splitRoot(this.data, node);
37051           } else {
37052             if (this.data.height < node.height) {
37053               const tmpNode = this.data;
37054               this.data = node;
37055               node = tmpNode;
37056             }
37057             this._insert(node, this.data.height - node.height - 1, true);
37058           }
37059           return this;
37060         }
37061         insert(item) {
37062           if (item) this._insert(item, this.data.height - 1);
37063           return this;
37064         }
37065         clear() {
37066           this.data = createNode([]);
37067           return this;
37068         }
37069         remove(item, equalsFn) {
37070           if (!item) return this;
37071           let node = this.data;
37072           const bbox2 = this.toBBox(item);
37073           const path = [];
37074           const indexes = [];
37075           let i3, parent, goingUp;
37076           while (node || path.length) {
37077             if (!node) {
37078               node = path.pop();
37079               parent = path[path.length - 1];
37080               i3 = indexes.pop();
37081               goingUp = true;
37082             }
37083             if (node.leaf) {
37084               const index = findItem(item, node.children, equalsFn);
37085               if (index !== -1) {
37086                 node.children.splice(index, 1);
37087                 path.push(node);
37088                 this._condense(path);
37089                 return this;
37090               }
37091             }
37092             if (!goingUp && !node.leaf && contains(node, bbox2)) {
37093               path.push(node);
37094               indexes.push(i3);
37095               i3 = 0;
37096               parent = node;
37097               node = node.children[0];
37098             } else if (parent) {
37099               i3++;
37100               node = parent.children[i3];
37101               goingUp = false;
37102             } else node = null;
37103           }
37104           return this;
37105         }
37106         toBBox(item) {
37107           return item;
37108         }
37109         compareMinX(a2, b2) {
37110           return a2.minX - b2.minX;
37111         }
37112         compareMinY(a2, b2) {
37113           return a2.minY - b2.minY;
37114         }
37115         toJSON() {
37116           return this.data;
37117         }
37118         fromJSON(data) {
37119           this.data = data;
37120           return this;
37121         }
37122         _all(node, result) {
37123           const nodesToSearch = [];
37124           while (node) {
37125             if (node.leaf) result.push(...node.children);
37126             else nodesToSearch.push(...node.children);
37127             node = nodesToSearch.pop();
37128           }
37129           return result;
37130         }
37131         _build(items, left, right, height) {
37132           const N2 = right - left + 1;
37133           let M2 = this._maxEntries;
37134           let node;
37135           if (N2 <= M2) {
37136             node = createNode(items.slice(left, right + 1));
37137             calcBBox(node, this.toBBox);
37138             return node;
37139           }
37140           if (!height) {
37141             height = Math.ceil(Math.log(N2) / Math.log(M2));
37142             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
37143           }
37144           node = createNode([]);
37145           node.leaf = false;
37146           node.height = height;
37147           const N22 = Math.ceil(N2 / M2);
37148           const N1 = N22 * Math.ceil(Math.sqrt(M2));
37149           multiSelect(items, left, right, N1, this.compareMinX);
37150           for (let i3 = left; i3 <= right; i3 += N1) {
37151             const right2 = Math.min(i3 + N1 - 1, right);
37152             multiSelect(items, i3, right2, N22, this.compareMinY);
37153             for (let j2 = i3; j2 <= right2; j2 += N22) {
37154               const right3 = Math.min(j2 + N22 - 1, right2);
37155               node.children.push(this._build(items, j2, right3, height - 1));
37156             }
37157           }
37158           calcBBox(node, this.toBBox);
37159           return node;
37160         }
37161         _chooseSubtree(bbox2, node, level, path) {
37162           while (true) {
37163             path.push(node);
37164             if (node.leaf || path.length - 1 === level) break;
37165             let minArea = Infinity;
37166             let minEnlargement = Infinity;
37167             let targetNode;
37168             for (let i3 = 0; i3 < node.children.length; i3++) {
37169               const child = node.children[i3];
37170               const area = bboxArea(child);
37171               const enlargement = enlargedArea(bbox2, child) - area;
37172               if (enlargement < minEnlargement) {
37173                 minEnlargement = enlargement;
37174                 minArea = area < minArea ? area : minArea;
37175                 targetNode = child;
37176               } else if (enlargement === minEnlargement) {
37177                 if (area < minArea) {
37178                   minArea = area;
37179                   targetNode = child;
37180                 }
37181               }
37182             }
37183             node = targetNode || node.children[0];
37184           }
37185           return node;
37186         }
37187         _insert(item, level, isNode) {
37188           const bbox2 = isNode ? item : this.toBBox(item);
37189           const insertPath = [];
37190           const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
37191           node.children.push(item);
37192           extend2(node, bbox2);
37193           while (level >= 0) {
37194             if (insertPath[level].children.length > this._maxEntries) {
37195               this._split(insertPath, level);
37196               level--;
37197             } else break;
37198           }
37199           this._adjustParentBBoxes(bbox2, insertPath, level);
37200         }
37201         // split overflowed node into two
37202         _split(insertPath, level) {
37203           const node = insertPath[level];
37204           const M2 = node.children.length;
37205           const m2 = this._minEntries;
37206           this._chooseSplitAxis(node, m2, M2);
37207           const splitIndex = this._chooseSplitIndex(node, m2, M2);
37208           const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
37209           newNode.height = node.height;
37210           newNode.leaf = node.leaf;
37211           calcBBox(node, this.toBBox);
37212           calcBBox(newNode, this.toBBox);
37213           if (level) insertPath[level - 1].children.push(newNode);
37214           else this._splitRoot(node, newNode);
37215         }
37216         _splitRoot(node, newNode) {
37217           this.data = createNode([node, newNode]);
37218           this.data.height = node.height + 1;
37219           this.data.leaf = false;
37220           calcBBox(this.data, this.toBBox);
37221         }
37222         _chooseSplitIndex(node, m2, M2) {
37223           let index;
37224           let minOverlap = Infinity;
37225           let minArea = Infinity;
37226           for (let i3 = m2; i3 <= M2 - m2; i3++) {
37227             const bbox1 = distBBox(node, 0, i3, this.toBBox);
37228             const bbox2 = distBBox(node, i3, M2, this.toBBox);
37229             const overlap = intersectionArea(bbox1, bbox2);
37230             const area = bboxArea(bbox1) + bboxArea(bbox2);
37231             if (overlap < minOverlap) {
37232               minOverlap = overlap;
37233               index = i3;
37234               minArea = area < minArea ? area : minArea;
37235             } else if (overlap === minOverlap) {
37236               if (area < minArea) {
37237                 minArea = area;
37238                 index = i3;
37239               }
37240             }
37241           }
37242           return index || M2 - m2;
37243         }
37244         // sorts node children by the best axis for split
37245         _chooseSplitAxis(node, m2, M2) {
37246           const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
37247           const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
37248           const xMargin = this._allDistMargin(node, m2, M2, compareMinX);
37249           const yMargin = this._allDistMargin(node, m2, M2, compareMinY);
37250           if (xMargin < yMargin) node.children.sort(compareMinX);
37251         }
37252         // total margin of all possible split distributions where each node is at least m full
37253         _allDistMargin(node, m2, M2, compare2) {
37254           node.children.sort(compare2);
37255           const toBBox = this.toBBox;
37256           const leftBBox = distBBox(node, 0, m2, toBBox);
37257           const rightBBox = distBBox(node, M2 - m2, M2, toBBox);
37258           let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
37259           for (let i3 = m2; i3 < M2 - m2; i3++) {
37260             const child = node.children[i3];
37261             extend2(leftBBox, node.leaf ? toBBox(child) : child);
37262             margin += bboxMargin(leftBBox);
37263           }
37264           for (let i3 = M2 - m2 - 1; i3 >= m2; i3--) {
37265             const child = node.children[i3];
37266             extend2(rightBBox, node.leaf ? toBBox(child) : child);
37267             margin += bboxMargin(rightBBox);
37268           }
37269           return margin;
37270         }
37271         _adjustParentBBoxes(bbox2, path, level) {
37272           for (let i3 = level; i3 >= 0; i3--) {
37273             extend2(path[i3], bbox2);
37274           }
37275         }
37276         _condense(path) {
37277           for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
37278             if (path[i3].children.length === 0) {
37279               if (i3 > 0) {
37280                 siblings = path[i3 - 1].children;
37281                 siblings.splice(siblings.indexOf(path[i3]), 1);
37282               } else this.clear();
37283             } else calcBBox(path[i3], this.toBBox);
37284           }
37285         }
37286       };
37287     }
37288   });
37289
37290   // node_modules/d3-dsv/src/index.js
37291   var init_src17 = __esm({
37292     "node_modules/d3-dsv/src/index.js"() {
37293     }
37294   });
37295
37296   // node_modules/d3-fetch/src/text.js
37297   function responseText(response) {
37298     if (!response.ok) throw new Error(response.status + " " + response.statusText);
37299     return response.text();
37300   }
37301   function text_default3(input, init2) {
37302     return fetch(input, init2).then(responseText);
37303   }
37304   var init_text3 = __esm({
37305     "node_modules/d3-fetch/src/text.js"() {
37306     }
37307   });
37308
37309   // node_modules/d3-fetch/src/json.js
37310   function responseJson(response) {
37311     if (!response.ok) throw new Error(response.status + " " + response.statusText);
37312     if (response.status === 204 || response.status === 205) return;
37313     return response.json();
37314   }
37315   function json_default(input, init2) {
37316     return fetch(input, init2).then(responseJson);
37317   }
37318   var init_json = __esm({
37319     "node_modules/d3-fetch/src/json.js"() {
37320     }
37321   });
37322
37323   // node_modules/d3-fetch/src/xml.js
37324   function parser(type2) {
37325     return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
37326   }
37327   var xml_default, html, svg;
37328   var init_xml = __esm({
37329     "node_modules/d3-fetch/src/xml.js"() {
37330       init_text3();
37331       xml_default = parser("application/xml");
37332       html = parser("text/html");
37333       svg = parser("image/svg+xml");
37334     }
37335   });
37336
37337   // node_modules/d3-fetch/src/index.js
37338   var init_src18 = __esm({
37339     "node_modules/d3-fetch/src/index.js"() {
37340       init_json();
37341       init_text3();
37342       init_xml();
37343     }
37344   });
37345
37346   // modules/services/keepRight.js
37347   var keepRight_exports = {};
37348   __export(keepRight_exports, {
37349     default: () => keepRight_default
37350   });
37351   function abortRequest(controller) {
37352     if (controller) {
37353       controller.abort();
37354     }
37355   }
37356   function abortUnwantedRequests(cache, tiles) {
37357     Object.keys(cache.inflightTile).forEach((k2) => {
37358       const wanted = tiles.find((tile) => k2 === tile.id);
37359       if (!wanted) {
37360         abortRequest(cache.inflightTile[k2]);
37361         delete cache.inflightTile[k2];
37362       }
37363     });
37364   }
37365   function encodeIssueRtree(d2) {
37366     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
37367   }
37368   function updateRtree(item, replace) {
37369     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
37370     if (replace) {
37371       _cache.rtree.insert(item);
37372     }
37373   }
37374   function tokenReplacements(d2) {
37375     if (!(d2 instanceof QAItem)) return;
37376     const replacements = {};
37377     const issueTemplate = _krData.errorTypes[d2.whichType];
37378     if (!issueTemplate) {
37379       console.log("No Template: ", d2.whichType);
37380       console.log("  ", d2.description);
37381       return;
37382     }
37383     if (!issueTemplate.regex) return;
37384     const errorRegex = new RegExp(issueTemplate.regex, "i");
37385     const errorMatch = errorRegex.exec(d2.description);
37386     if (!errorMatch) {
37387       console.log("Unmatched: ", d2.whichType);
37388       console.log("  ", d2.description);
37389       console.log("  ", errorRegex);
37390       return;
37391     }
37392     for (let i3 = 1; i3 < errorMatch.length; i3++) {
37393       let capture = errorMatch[i3];
37394       let idType;
37395       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
37396       if (idType && capture) {
37397         capture = parseError(capture, idType);
37398       } else {
37399         const compare2 = capture.toLowerCase();
37400         if (_krData.localizeStrings[compare2]) {
37401           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37402         } else {
37403           capture = unescape_default(capture);
37404         }
37405       }
37406       replacements["var" + i3] = capture;
37407     }
37408     return replacements;
37409   }
37410   function parseError(capture, idType) {
37411     const compare2 = capture.toLowerCase();
37412     if (_krData.localizeStrings[compare2]) {
37413       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37414     }
37415     switch (idType) {
37416       // link a string like "this node"
37417       case "this":
37418         capture = linkErrorObject(capture);
37419         break;
37420       case "url":
37421         capture = linkURL(capture);
37422         break;
37423       // link an entity ID
37424       case "n":
37425       case "w":
37426       case "r":
37427         capture = linkEntity(idType + capture);
37428         break;
37429       // some errors have more complex ID lists/variance
37430       case "20":
37431         capture = parse20(capture);
37432         break;
37433       case "211":
37434         capture = parse211(capture);
37435         break;
37436       case "231":
37437         capture = parse231(capture);
37438         break;
37439       case "294":
37440         capture = parse294(capture);
37441         break;
37442       case "370":
37443         capture = parse370(capture);
37444         break;
37445     }
37446     return capture;
37447     function linkErrorObject(d2) {
37448       return { html: `<a class="error_object_link">${d2}</a>` };
37449     }
37450     function linkEntity(d2) {
37451       return { html: `<a class="error_entity_link">${d2}</a>` };
37452     }
37453     function linkURL(d2) {
37454       return { html: `<a class="kr_external_link" target="_blank" href="${d2}">${d2}</a>` };
37455     }
37456     function parse211(capture2) {
37457       let newList = [];
37458       const items = capture2.split(", ");
37459       items.forEach((item) => {
37460         let id2 = linkEntity("n" + item.slice(1));
37461         newList.push(id2);
37462       });
37463       return newList.join(", ");
37464     }
37465     function parse231(capture2) {
37466       let newList = [];
37467       const items = capture2.split("),");
37468       items.forEach((item) => {
37469         const match = item.match(/\#(\d+)\((.+)\)?/);
37470         if (match !== null && match.length > 2) {
37471           newList.push(
37472             linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
37473           );
37474         }
37475       });
37476       return newList.join(", ");
37477     }
37478     function parse294(capture2) {
37479       let newList = [];
37480       const items = capture2.split(",");
37481       items.forEach((item) => {
37482         item = item.split(" ");
37483         const role = `"${item[0]}"`;
37484         const idType2 = item[1].slice(0, 1);
37485         let id2 = item[2].slice(1);
37486         id2 = linkEntity(idType2 + id2);
37487         newList.push(`${role} ${item[1]} ${id2}`);
37488       });
37489       return newList.join(", ");
37490     }
37491     function parse370(capture2) {
37492       if (!capture2) return "";
37493       const match = capture2.match(/\(including the name (\'.+\')\)/);
37494       if (match && match.length) {
37495         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
37496       }
37497       return "";
37498     }
37499     function parse20(capture2) {
37500       let newList = [];
37501       const items = capture2.split(",");
37502       items.forEach((item) => {
37503         const id2 = linkEntity("n" + item.slice(1));
37504         newList.push(id2);
37505       });
37506       return newList.join(", ");
37507     }
37508   }
37509   var tiler, dispatch2, _tileZoom, _krUrlRoot, _krData, _cache, _krRuleset, keepRight_default;
37510   var init_keepRight = __esm({
37511     "modules/services/keepRight.js"() {
37512       "use strict";
37513       init_rbush();
37514       init_src4();
37515       init_src18();
37516       init_lodash();
37517       init_file_fetcher();
37518       init_geo2();
37519       init_osm();
37520       init_localizer();
37521       init_util();
37522       tiler = utilTiler();
37523       dispatch2 = dispatch_default("loaded");
37524       _tileZoom = 14;
37525       _krUrlRoot = "https://www.keepright.at";
37526       _krData = { errorTypes: {}, localizeStrings: {} };
37527       _krRuleset = [
37528         // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
37529         30,
37530         40,
37531         50,
37532         60,
37533         70,
37534         90,
37535         100,
37536         110,
37537         120,
37538         130,
37539         150,
37540         160,
37541         170,
37542         180,
37543         190,
37544         191,
37545         192,
37546         193,
37547         194,
37548         195,
37549         196,
37550         197,
37551         198,
37552         200,
37553         201,
37554         202,
37555         203,
37556         204,
37557         205,
37558         206,
37559         207,
37560         208,
37561         210,
37562         220,
37563         230,
37564         231,
37565         232,
37566         270,
37567         280,
37568         281,
37569         282,
37570         283,
37571         284,
37572         285,
37573         290,
37574         291,
37575         292,
37576         293,
37577         294,
37578         295,
37579         296,
37580         297,
37581         298,
37582         300,
37583         310,
37584         311,
37585         312,
37586         313,
37587         320,
37588         350,
37589         360,
37590         370,
37591         380,
37592         390,
37593         400,
37594         401,
37595         402,
37596         410,
37597         411,
37598         412,
37599         413
37600       ];
37601       keepRight_default = {
37602         title: "keepRight",
37603         init() {
37604           _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
37605           if (!_cache) {
37606             this.reset();
37607           }
37608           this.event = utilRebind(this, dispatch2, "on");
37609         },
37610         reset() {
37611           if (_cache) {
37612             Object.values(_cache.inflightTile).forEach(abortRequest);
37613           }
37614           _cache = {
37615             data: {},
37616             loadedTile: {},
37617             inflightTile: {},
37618             inflightPost: {},
37619             closed: {},
37620             rtree: new RBush()
37621           };
37622         },
37623         // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
37624         loadIssues(projection2) {
37625           const options2 = {
37626             format: "geojson",
37627             ch: _krRuleset
37628           };
37629           const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
37630           abortUnwantedRequests(_cache, tiles);
37631           tiles.forEach((tile) => {
37632             if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
37633             const [left, top, right, bottom] = tile.extent.rectangle();
37634             const params = Object.assign({}, options2, { left, bottom, right, top });
37635             const url = `${_krUrlRoot}/export.php?` + utilQsString(params);
37636             const controller = new AbortController();
37637             _cache.inflightTile[tile.id] = controller;
37638             json_default(url, { signal: controller.signal }).then((data) => {
37639               delete _cache.inflightTile[tile.id];
37640               _cache.loadedTile[tile.id] = true;
37641               if (!data || !data.features || !data.features.length) {
37642                 throw new Error("No Data");
37643               }
37644               data.features.forEach((feature3) => {
37645                 const {
37646                   properties: {
37647                     error_type: itemType,
37648                     error_id: id2,
37649                     comment = null,
37650                     object_id: objectId,
37651                     object_type: objectType,
37652                     schema,
37653                     title
37654                   }
37655                 } = feature3;
37656                 let {
37657                   geometry: { coordinates: loc },
37658                   properties: { description = "" }
37659                 } = feature3;
37660                 const issueTemplate = _krData.errorTypes[itemType];
37661                 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
37662                 const whichType = issueTemplate ? itemType : parentIssueType;
37663                 const whichTemplate = _krData.errorTypes[whichType];
37664                 switch (whichType) {
37665                   case "170":
37666                     description = `This feature has a FIXME tag: ${description}`;
37667                     break;
37668                   case "292":
37669                   case "293":
37670                     description = description.replace("A turn-", "This turn-");
37671                     break;
37672                   case "294":
37673                   case "295":
37674                   case "296":
37675                   case "297":
37676                   case "298":
37677                     description = `This turn-restriction~${description}`;
37678                     break;
37679                   case "300":
37680                     description = "This highway is missing a maxspeed tag";
37681                     break;
37682                   case "411":
37683                   case "412":
37684                   case "413":
37685                     description = `This feature~${description}`;
37686                     break;
37687                 }
37688                 let coincident = false;
37689                 do {
37690                   let delta = coincident ? [1e-5, 0] : [0, 1e-5];
37691                   loc = geoVecAdd(loc, delta);
37692                   let bbox2 = geoExtent(loc).bbox();
37693                   coincident = _cache.rtree.search(bbox2).length;
37694                 } while (coincident);
37695                 let d2 = new QAItem(loc, this, itemType, id2, {
37696                   comment,
37697                   description,
37698                   whichType,
37699                   parentIssueType,
37700                   severity: whichTemplate.severity || "error",
37701                   objectId,
37702                   objectType,
37703                   schema,
37704                   title
37705                 });
37706                 d2.replacements = tokenReplacements(d2);
37707                 _cache.data[id2] = d2;
37708                 _cache.rtree.insert(encodeIssueRtree(d2));
37709               });
37710               dispatch2.call("loaded");
37711             }).catch(() => {
37712               delete _cache.inflightTile[tile.id];
37713               _cache.loadedTile[tile.id] = true;
37714             });
37715           });
37716         },
37717         postUpdate(d2, callback) {
37718           if (_cache.inflightPost[d2.id]) {
37719             return callback({ message: "Error update already inflight", status: -2 }, d2);
37720           }
37721           const params = { schema: d2.schema, id: d2.id };
37722           if (d2.newStatus) {
37723             params.st = d2.newStatus;
37724           }
37725           if (d2.newComment !== void 0) {
37726             params.co = d2.newComment;
37727           }
37728           const url = `${_krUrlRoot}/comment.php?` + utilQsString(params);
37729           const controller = new AbortController();
37730           _cache.inflightPost[d2.id] = controller;
37731           json_default(url, { signal: controller.signal }).finally(() => {
37732             delete _cache.inflightPost[d2.id];
37733             if (d2.newStatus === "ignore") {
37734               this.removeItem(d2);
37735             } else if (d2.newStatus === "ignore_t") {
37736               this.removeItem(d2);
37737               _cache.closed[`${d2.schema}:${d2.id}`] = true;
37738             } else {
37739               d2 = this.replaceItem(d2.update({
37740                 comment: d2.newComment,
37741                 newComment: void 0,
37742                 newState: void 0
37743               }));
37744             }
37745             if (callback) callback(null, d2);
37746           });
37747         },
37748         // Get all cached QAItems covering the viewport
37749         getItems(projection2) {
37750           const viewport = projection2.clipExtent();
37751           const min3 = [viewport[0][0], viewport[1][1]];
37752           const max3 = [viewport[1][0], viewport[0][1]];
37753           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37754           return _cache.rtree.search(bbox2).map((d2) => d2.data);
37755         },
37756         // Get a QAItem from cache
37757         // NOTE: Don't change method name until UI v3 is merged
37758         getError(id2) {
37759           return _cache.data[id2];
37760         },
37761         // Replace a single QAItem in the cache
37762         replaceItem(item) {
37763           if (!(item instanceof QAItem) || !item.id) return;
37764           _cache.data[item.id] = item;
37765           updateRtree(encodeIssueRtree(item), true);
37766           return item;
37767         },
37768         // Remove a single QAItem from the cache
37769         removeItem(item) {
37770           if (!(item instanceof QAItem) || !item.id) return;
37771           delete _cache.data[item.id];
37772           updateRtree(encodeIssueRtree(item), false);
37773         },
37774         issueURL(item) {
37775           return `${_krUrlRoot}/report_map.php?schema=${item.schema}&error=${item.id}`;
37776         },
37777         // Get an array of issues closed during this session.
37778         // Used to populate `closed:keepright` changeset tag
37779         getClosedIDs() {
37780           return Object.keys(_cache.closed).sort();
37781         }
37782       };
37783     }
37784   });
37785
37786   // node_modules/marked/lib/marked.esm.js
37787   function _getDefaults() {
37788     return {
37789       async: false,
37790       breaks: false,
37791       extensions: null,
37792       gfm: true,
37793       hooks: null,
37794       pedantic: false,
37795       renderer: null,
37796       silent: false,
37797       tokenizer: null,
37798       walkTokens: null
37799     };
37800   }
37801   function changeDefaults(newDefaults) {
37802     _defaults = newDefaults;
37803   }
37804   function edit(regex, opt = "") {
37805     let source = typeof regex === "string" ? regex : regex.source;
37806     const obj = {
37807       replace: (name, val) => {
37808         let valSource = typeof val === "string" ? val : val.source;
37809         valSource = valSource.replace(other.caret, "$1");
37810         source = source.replace(name, valSource);
37811         return obj;
37812       },
37813       getRegex: () => {
37814         return new RegExp(source, opt);
37815       }
37816     };
37817     return obj;
37818   }
37819   function escape4(html3, encode) {
37820     if (encode) {
37821       if (other.escapeTest.test(html3)) {
37822         return html3.replace(other.escapeReplace, getEscapeReplacement);
37823       }
37824     } else {
37825       if (other.escapeTestNoEncode.test(html3)) {
37826         return html3.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
37827       }
37828     }
37829     return html3;
37830   }
37831   function cleanUrl(href) {
37832     try {
37833       href = encodeURI(href).replace(other.percentDecode, "%");
37834     } catch {
37835       return null;
37836     }
37837     return href;
37838   }
37839   function splitCells(tableRow, count) {
37840     var _a3;
37841     const row = tableRow.replace(other.findPipe, (match, offset, str) => {
37842       let escaped = false;
37843       let curr = offset;
37844       while (--curr >= 0 && str[curr] === "\\")
37845         escaped = !escaped;
37846       if (escaped) {
37847         return "|";
37848       } else {
37849         return " |";
37850       }
37851     }), cells = row.split(other.splitPipe);
37852     let i3 = 0;
37853     if (!cells[0].trim()) {
37854       cells.shift();
37855     }
37856     if (cells.length > 0 && !((_a3 = cells.at(-1)) == null ? void 0 : _a3.trim())) {
37857       cells.pop();
37858     }
37859     if (count) {
37860       if (cells.length > count) {
37861         cells.splice(count);
37862       } else {
37863         while (cells.length < count)
37864           cells.push("");
37865       }
37866     }
37867     for (; i3 < cells.length; i3++) {
37868       cells[i3] = cells[i3].trim().replace(other.slashPipe, "|");
37869     }
37870     return cells;
37871   }
37872   function rtrim(str, c2, invert) {
37873     const l2 = str.length;
37874     if (l2 === 0) {
37875       return "";
37876     }
37877     let suffLen = 0;
37878     while (suffLen < l2) {
37879       const currChar = str.charAt(l2 - suffLen - 1);
37880       if (currChar === c2 && true) {
37881         suffLen++;
37882       } else {
37883         break;
37884       }
37885     }
37886     return str.slice(0, l2 - suffLen);
37887   }
37888   function findClosingBracket(str, b2) {
37889     if (str.indexOf(b2[1]) === -1) {
37890       return -1;
37891     }
37892     let level = 0;
37893     for (let i3 = 0; i3 < str.length; i3++) {
37894       if (str[i3] === "\\") {
37895         i3++;
37896       } else if (str[i3] === b2[0]) {
37897         level++;
37898       } else if (str[i3] === b2[1]) {
37899         level--;
37900         if (level < 0) {
37901           return i3;
37902         }
37903       }
37904     }
37905     if (level > 0) {
37906       return -2;
37907     }
37908     return -1;
37909   }
37910   function outputLink(cap, link3, raw, lexer2, rules) {
37911     const href = link3.href;
37912     const title = link3.title || null;
37913     const text = cap[1].replace(rules.other.outputLinkReplace, "$1");
37914     lexer2.state.inLink = true;
37915     const token = {
37916       type: cap[0].charAt(0) === "!" ? "image" : "link",
37917       raw,
37918       href,
37919       title,
37920       text,
37921       tokens: lexer2.inlineTokens(text)
37922     };
37923     lexer2.state.inLink = false;
37924     return token;
37925   }
37926   function indentCodeCompensation(raw, text, rules) {
37927     const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
37928     if (matchIndentToCode === null) {
37929       return text;
37930     }
37931     const indentToCode = matchIndentToCode[1];
37932     return text.split("\n").map((node) => {
37933       const matchIndentInNode = node.match(rules.other.beginningSpace);
37934       if (matchIndentInNode === null) {
37935         return node;
37936       }
37937       const [indentInNode] = matchIndentInNode;
37938       if (indentInNode.length >= indentToCode.length) {
37939         return node.slice(indentToCode.length);
37940       }
37941       return node;
37942     }).join("\n");
37943   }
37944   function marked(src, opt) {
37945     return markedInstance.parse(src, opt);
37946   }
37947   var _defaults, noopTest, other, newline, blockCode, fences, hr, heading, bullet, lheadingCore, lheading, lheadingGfm, _paragraph, blockText, _blockLabel, def, list, _tag, _comment, html2, paragraph, blockquote, blockNormal, gfmTable, blockGfm, blockPedantic, escape$1, inlineCode, br, inlineText, _punctuation, _punctuationOrSpace, _notPunctuationOrSpace, punctuation, _punctuationGfmStrongEm, _punctuationOrSpaceGfmStrongEm, _notPunctuationOrSpaceGfmStrongEm, blockSkip, emStrongLDelimCore, emStrongLDelim, emStrongLDelimGfm, emStrongRDelimAstCore, emStrongRDelimAst, emStrongRDelimAstGfm, emStrongRDelimUnd, anyPunctuation, autolink, _inlineComment, tag, _inlineLabel, link2, reflink, nolink, reflinkSearch, inlineNormal, inlinePedantic, inlineGfm, inlineBreaks, block, inline, escapeReplacements, getEscapeReplacement, _Tokenizer, _Lexer, _Renderer, _TextRenderer, _Parser, _Hooks, Marked, markedInstance, options, setOptions, use, walkTokens, parseInline, parser2, lexer;
37948   var init_marked_esm = __esm({
37949     "node_modules/marked/lib/marked.esm.js"() {
37950       _defaults = _getDefaults();
37951       noopTest = { exec: () => null };
37952       other = {
37953         codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
37954         outputLinkReplace: /\\([\[\]])/g,
37955         indentCodeCompensation: /^(\s+)(?:```)/,
37956         beginningSpace: /^\s+/,
37957         endingHash: /#$/,
37958         startingSpaceChar: /^ /,
37959         endingSpaceChar: / $/,
37960         nonSpaceChar: /[^ ]/,
37961         newLineCharGlobal: /\n/g,
37962         tabCharGlobal: /\t/g,
37963         multipleSpaceGlobal: /\s+/g,
37964         blankLine: /^[ \t]*$/,
37965         doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
37966         blockquoteStart: /^ {0,3}>/,
37967         blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
37968         blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
37969         listReplaceTabs: /^\t+/,
37970         listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
37971         listIsTask: /^\[[ xX]\] /,
37972         listReplaceTask: /^\[[ xX]\] +/,
37973         anyLine: /\n.*\n/,
37974         hrefBrackets: /^<(.*)>$/,
37975         tableDelimiter: /[:|]/,
37976         tableAlignChars: /^\||\| *$/g,
37977         tableRowBlankLine: /\n[ \t]*$/,
37978         tableAlignRight: /^ *-+: *$/,
37979         tableAlignCenter: /^ *:-+: *$/,
37980         tableAlignLeft: /^ *:-+ *$/,
37981         startATag: /^<a /i,
37982         endATag: /^<\/a>/i,
37983         startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
37984         endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
37985         startAngleBracket: /^</,
37986         endAngleBracket: />$/,
37987         pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
37988         unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
37989         escapeTest: /[&<>"']/,
37990         escapeReplace: /[&<>"']/g,
37991         escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
37992         escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
37993         unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
37994         caret: /(^|[^\[])\^/g,
37995         percentDecode: /%25/g,
37996         findPipe: /\|/g,
37997         splitPipe: / \|/,
37998         slashPipe: /\\\|/g,
37999         carriageReturn: /\r\n|\r/g,
38000         spaceLine: /^ +$/gm,
38001         notSpaceStart: /^\S*/,
38002         endingNewline: /\n$/,
38003         listItemRegex: (bull) => new RegExp(`^( {0,3}${bull})((?:[       ][^\\n]*)?(?:\\n|$))`),
38004         nextBulletRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[    ][^\\n]*)?(?:\\n|$))`),
38005         hrRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
38006         fencesBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
38007         headingBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
38008         htmlBeginRegex: (indent) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, "i")
38009       };
38010       newline = /^(?:[ \t]*(?:\n|$))+/;
38011       blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
38012       fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
38013       hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
38014       heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
38015       bullet = /(?:[*+-]|\d{1,9}[.)])/;
38016       lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
38017       lheading = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
38018       lheadingGfm = edit(lheadingCore).replace(/bull/g, bullet).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
38019       _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
38020       blockText = /^[^\n]+/;
38021       _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
38022       def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
38023       list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
38024       _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
38025       _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
38026       html2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[  ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[     ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[     ]*)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
38027       paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
38028       blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
38029       blockNormal = {
38030         blockquote,
38031         code: blockCode,
38032         def,
38033         fences,
38034         heading,
38035         hr,
38036         html: html2,
38037         lheading,
38038         list,
38039         newline,
38040         paragraph,
38041         table: noopTest,
38042         text: blockText
38043       };
38044       gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}     )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
38045       blockGfm = {
38046         ...blockNormal,
38047         lheading: lheadingGfm,
38048         table: gfmTable,
38049         paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
38050       };
38051       blockPedantic = {
38052         ...blockNormal,
38053         html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
38054         def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
38055         heading: /^(#{1,6})(.*)(?:\n+|$)/,
38056         fences: noopTest,
38057         // fences not supported
38058         lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
38059         paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
38060       };
38061       escape$1 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
38062       inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
38063       br = /^( {2,}|\\)\n(?!\s*$)/;
38064       inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
38065       _punctuation = /[\p{P}\p{S}]/u;
38066       _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
38067       _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
38068       punctuation = edit(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, _punctuationOrSpace).getRegex();
38069       _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
38070       _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
38071       _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
38072       blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
38073       emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
38074       emStrongLDelim = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuation).getRegex();
38075       emStrongLDelimGfm = edit(emStrongLDelimCore, "u").replace(/punct/g, _punctuationGfmStrongEm).getRegex();
38076       emStrongRDelimAstCore = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
38077       emStrongRDelimAst = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
38078       emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, "gu").replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm).replace(/punct/g, _punctuationGfmStrongEm).getRegex();
38079       emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _notPunctuationOrSpace).replace(/punctSpace/g, _punctuationOrSpace).replace(/punct/g, _punctuation).getRegex();
38080       anyPunctuation = edit(/\\(punct)/, "gu").replace(/punct/g, _punctuation).getRegex();
38081       autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
38082       _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
38083       tag = edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
38084       _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
38085       link2 = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
38086       reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
38087       nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
38088       reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
38089       inlineNormal = {
38090         _backpedal: noopTest,
38091         // only used for GFM url
38092         anyPunctuation,
38093         autolink,
38094         blockSkip,
38095         br,
38096         code: inlineCode,
38097         del: noopTest,
38098         emStrongLDelim,
38099         emStrongRDelimAst,
38100         emStrongRDelimUnd,
38101         escape: escape$1,
38102         link: link2,
38103         nolink,
38104         punctuation,
38105         reflink,
38106         reflinkSearch,
38107         tag,
38108         text: inlineText,
38109         url: noopTest
38110       };
38111       inlinePedantic = {
38112         ...inlineNormal,
38113         link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
38114         reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
38115       };
38116       inlineGfm = {
38117         ...inlineNormal,
38118         emStrongRDelimAst: emStrongRDelimAstGfm,
38119         emStrongLDelim: emStrongLDelimGfm,
38120         url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
38121         _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
38122         del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
38123         text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
38124       };
38125       inlineBreaks = {
38126         ...inlineGfm,
38127         br: edit(br).replace("{2,}", "*").getRegex(),
38128         text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
38129       };
38130       block = {
38131         normal: blockNormal,
38132         gfm: blockGfm,
38133         pedantic: blockPedantic
38134       };
38135       inline = {
38136         normal: inlineNormal,
38137         gfm: inlineGfm,
38138         breaks: inlineBreaks,
38139         pedantic: inlinePedantic
38140       };
38141       escapeReplacements = {
38142         "&": "&amp;",
38143         "<": "&lt;",
38144         ">": "&gt;",
38145         '"': "&quot;",
38146         "'": "&#39;"
38147       };
38148       getEscapeReplacement = (ch) => escapeReplacements[ch];
38149       _Tokenizer = class {
38150         // set by the lexer
38151         constructor(options2) {
38152           __publicField(this, "options");
38153           __publicField(this, "rules");
38154           // set by the lexer
38155           __publicField(this, "lexer");
38156           this.options = options2 || _defaults;
38157         }
38158         space(src) {
38159           const cap = this.rules.block.newline.exec(src);
38160           if (cap && cap[0].length > 0) {
38161             return {
38162               type: "space",
38163               raw: cap[0]
38164             };
38165           }
38166         }
38167         code(src) {
38168           const cap = this.rules.block.code.exec(src);
38169           if (cap) {
38170             const text = cap[0].replace(this.rules.other.codeRemoveIndent, "");
38171             return {
38172               type: "code",
38173               raw: cap[0],
38174               codeBlockStyle: "indented",
38175               text: !this.options.pedantic ? rtrim(text, "\n") : text
38176             };
38177           }
38178         }
38179         fences(src) {
38180           const cap = this.rules.block.fences.exec(src);
38181           if (cap) {
38182             const raw = cap[0];
38183             const text = indentCodeCompensation(raw, cap[3] || "", this.rules);
38184             return {
38185               type: "code",
38186               raw,
38187               lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
38188               text
38189             };
38190           }
38191         }
38192         heading(src) {
38193           const cap = this.rules.block.heading.exec(src);
38194           if (cap) {
38195             let text = cap[2].trim();
38196             if (this.rules.other.endingHash.test(text)) {
38197               const trimmed = rtrim(text, "#");
38198               if (this.options.pedantic) {
38199                 text = trimmed.trim();
38200               } else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
38201                 text = trimmed.trim();
38202               }
38203             }
38204             return {
38205               type: "heading",
38206               raw: cap[0],
38207               depth: cap[1].length,
38208               text,
38209               tokens: this.lexer.inline(text)
38210             };
38211           }
38212         }
38213         hr(src) {
38214           const cap = this.rules.block.hr.exec(src);
38215           if (cap) {
38216             return {
38217               type: "hr",
38218               raw: rtrim(cap[0], "\n")
38219             };
38220           }
38221         }
38222         blockquote(src) {
38223           const cap = this.rules.block.blockquote.exec(src);
38224           if (cap) {
38225             let lines = rtrim(cap[0], "\n").split("\n");
38226             let raw = "";
38227             let text = "";
38228             const tokens = [];
38229             while (lines.length > 0) {
38230               let inBlockquote = false;
38231               const currentLines = [];
38232               let i3;
38233               for (i3 = 0; i3 < lines.length; i3++) {
38234                 if (this.rules.other.blockquoteStart.test(lines[i3])) {
38235                   currentLines.push(lines[i3]);
38236                   inBlockquote = true;
38237                 } else if (!inBlockquote) {
38238                   currentLines.push(lines[i3]);
38239                 } else {
38240                   break;
38241                 }
38242               }
38243               lines = lines.slice(i3);
38244               const currentRaw = currentLines.join("\n");
38245               const currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n    $1").replace(this.rules.other.blockquoteSetextReplace2, "");
38246               raw = raw ? `${raw}
38247 ${currentRaw}` : currentRaw;
38248               text = text ? `${text}
38249 ${currentText}` : currentText;
38250               const top = this.lexer.state.top;
38251               this.lexer.state.top = true;
38252               this.lexer.blockTokens(currentText, tokens, true);
38253               this.lexer.state.top = top;
38254               if (lines.length === 0) {
38255                 break;
38256               }
38257               const lastToken = tokens.at(-1);
38258               if ((lastToken == null ? void 0 : lastToken.type) === "code") {
38259                 break;
38260               } else if ((lastToken == null ? void 0 : lastToken.type) === "blockquote") {
38261                 const oldToken = lastToken;
38262                 const newText = oldToken.raw + "\n" + lines.join("\n");
38263                 const newToken = this.blockquote(newText);
38264                 tokens[tokens.length - 1] = newToken;
38265                 raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
38266                 text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
38267                 break;
38268               } else if ((lastToken == null ? void 0 : lastToken.type) === "list") {
38269                 const oldToken = lastToken;
38270                 const newText = oldToken.raw + "\n" + lines.join("\n");
38271                 const newToken = this.list(newText);
38272                 tokens[tokens.length - 1] = newToken;
38273                 raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
38274                 text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
38275                 lines = newText.substring(tokens.at(-1).raw.length).split("\n");
38276                 continue;
38277               }
38278             }
38279             return {
38280               type: "blockquote",
38281               raw,
38282               tokens,
38283               text
38284             };
38285           }
38286         }
38287         list(src) {
38288           let cap = this.rules.block.list.exec(src);
38289           if (cap) {
38290             let bull = cap[1].trim();
38291             const isordered = bull.length > 1;
38292             const list2 = {
38293               type: "list",
38294               raw: "",
38295               ordered: isordered,
38296               start: isordered ? +bull.slice(0, -1) : "",
38297               loose: false,
38298               items: []
38299             };
38300             bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
38301             if (this.options.pedantic) {
38302               bull = isordered ? bull : "[*+-]";
38303             }
38304             const itemRegex = this.rules.other.listItemRegex(bull);
38305             let endsWithBlankLine = false;
38306             while (src) {
38307               let endEarly = false;
38308               let raw = "";
38309               let itemContents = "";
38310               if (!(cap = itemRegex.exec(src))) {
38311                 break;
38312               }
38313               if (this.rules.block.hr.test(src)) {
38314                 break;
38315               }
38316               raw = cap[0];
38317               src = src.substring(raw.length);
38318               let line = cap[2].split("\n", 1)[0].replace(this.rules.other.listReplaceTabs, (t2) => " ".repeat(3 * t2.length));
38319               let nextLine = src.split("\n", 1)[0];
38320               let blankLine = !line.trim();
38321               let indent = 0;
38322               if (this.options.pedantic) {
38323                 indent = 2;
38324                 itemContents = line.trimStart();
38325               } else if (blankLine) {
38326                 indent = cap[1].length + 1;
38327               } else {
38328                 indent = cap[2].search(this.rules.other.nonSpaceChar);
38329                 indent = indent > 4 ? 1 : indent;
38330                 itemContents = line.slice(indent);
38331                 indent += cap[1].length;
38332               }
38333               if (blankLine && this.rules.other.blankLine.test(nextLine)) {
38334                 raw += nextLine + "\n";
38335                 src = src.substring(nextLine.length + 1);
38336                 endEarly = true;
38337               }
38338               if (!endEarly) {
38339                 const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
38340                 const hrRegex = this.rules.other.hrRegex(indent);
38341                 const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
38342                 const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
38343                 const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
38344                 while (src) {
38345                   const rawLine = src.split("\n", 1)[0];
38346                   let nextLineWithoutTabs;
38347                   nextLine = rawLine;
38348                   if (this.options.pedantic) {
38349                     nextLine = nextLine.replace(this.rules.other.listReplaceNesting, "  ");
38350                     nextLineWithoutTabs = nextLine;
38351                   } else {
38352                     nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, "    ");
38353                   }
38354                   if (fencesBeginRegex.test(nextLine)) {
38355                     break;
38356                   }
38357                   if (headingBeginRegex.test(nextLine)) {
38358                     break;
38359                   }
38360                   if (htmlBeginRegex.test(nextLine)) {
38361                     break;
38362                   }
38363                   if (nextBulletRegex.test(nextLine)) {
38364                     break;
38365                   }
38366                   if (hrRegex.test(nextLine)) {
38367                     break;
38368                   }
38369                   if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
38370                     itemContents += "\n" + nextLineWithoutTabs.slice(indent);
38371                   } else {
38372                     if (blankLine) {
38373                       break;
38374                     }
38375                     if (line.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4) {
38376                       break;
38377                     }
38378                     if (fencesBeginRegex.test(line)) {
38379                       break;
38380                     }
38381                     if (headingBeginRegex.test(line)) {
38382                       break;
38383                     }
38384                     if (hrRegex.test(line)) {
38385                       break;
38386                     }
38387                     itemContents += "\n" + nextLine;
38388                   }
38389                   if (!blankLine && !nextLine.trim()) {
38390                     blankLine = true;
38391                   }
38392                   raw += rawLine + "\n";
38393                   src = src.substring(rawLine.length + 1);
38394                   line = nextLineWithoutTabs.slice(indent);
38395                 }
38396               }
38397               if (!list2.loose) {
38398                 if (endsWithBlankLine) {
38399                   list2.loose = true;
38400                 } else if (this.rules.other.doubleBlankLine.test(raw)) {
38401                   endsWithBlankLine = true;
38402                 }
38403               }
38404               let istask = null;
38405               let ischecked;
38406               if (this.options.gfm) {
38407                 istask = this.rules.other.listIsTask.exec(itemContents);
38408                 if (istask) {
38409                   ischecked = istask[0] !== "[ ] ";
38410                   itemContents = itemContents.replace(this.rules.other.listReplaceTask, "");
38411                 }
38412               }
38413               list2.items.push({
38414                 type: "list_item",
38415                 raw,
38416                 task: !!istask,
38417                 checked: ischecked,
38418                 loose: false,
38419                 text: itemContents,
38420                 tokens: []
38421               });
38422               list2.raw += raw;
38423             }
38424             const lastItem = list2.items.at(-1);
38425             if (lastItem) {
38426               lastItem.raw = lastItem.raw.trimEnd();
38427               lastItem.text = lastItem.text.trimEnd();
38428             } else {
38429               return;
38430             }
38431             list2.raw = list2.raw.trimEnd();
38432             for (let i3 = 0; i3 < list2.items.length; i3++) {
38433               this.lexer.state.top = false;
38434               list2.items[i3].tokens = this.lexer.blockTokens(list2.items[i3].text, []);
38435               if (!list2.loose) {
38436                 const spacers = list2.items[i3].tokens.filter((t2) => t2.type === "space");
38437                 const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => this.rules.other.anyLine.test(t2.raw));
38438                 list2.loose = hasMultipleLineBreaks;
38439               }
38440             }
38441             if (list2.loose) {
38442               for (let i3 = 0; i3 < list2.items.length; i3++) {
38443                 list2.items[i3].loose = true;
38444               }
38445             }
38446             return list2;
38447           }
38448         }
38449         html(src) {
38450           const cap = this.rules.block.html.exec(src);
38451           if (cap) {
38452             const token = {
38453               type: "html",
38454               block: true,
38455               raw: cap[0],
38456               pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
38457               text: cap[0]
38458             };
38459             return token;
38460           }
38461         }
38462         def(src) {
38463           const cap = this.rules.block.def.exec(src);
38464           if (cap) {
38465             const tag2 = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " ");
38466             const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
38467             const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
38468             return {
38469               type: "def",
38470               tag: tag2,
38471               raw: cap[0],
38472               href,
38473               title
38474             };
38475           }
38476         }
38477         table(src) {
38478           var _a3;
38479           const cap = this.rules.block.table.exec(src);
38480           if (!cap) {
38481             return;
38482           }
38483           if (!this.rules.other.tableDelimiter.test(cap[2])) {
38484             return;
38485           }
38486           const headers = splitCells(cap[1]);
38487           const aligns = cap[2].replace(this.rules.other.tableAlignChars, "").split("|");
38488           const rows = ((_a3 = cap[3]) == null ? void 0 : _a3.trim()) ? cap[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [];
38489           const item = {
38490             type: "table",
38491             raw: cap[0],
38492             header: [],
38493             align: [],
38494             rows: []
38495           };
38496           if (headers.length !== aligns.length) {
38497             return;
38498           }
38499           for (const align of aligns) {
38500             if (this.rules.other.tableAlignRight.test(align)) {
38501               item.align.push("right");
38502             } else if (this.rules.other.tableAlignCenter.test(align)) {
38503               item.align.push("center");
38504             } else if (this.rules.other.tableAlignLeft.test(align)) {
38505               item.align.push("left");
38506             } else {
38507               item.align.push(null);
38508             }
38509           }
38510           for (let i3 = 0; i3 < headers.length; i3++) {
38511             item.header.push({
38512               text: headers[i3],
38513               tokens: this.lexer.inline(headers[i3]),
38514               header: true,
38515               align: item.align[i3]
38516             });
38517           }
38518           for (const row of rows) {
38519             item.rows.push(splitCells(row, item.header.length).map((cell, i3) => {
38520               return {
38521                 text: cell,
38522                 tokens: this.lexer.inline(cell),
38523                 header: false,
38524                 align: item.align[i3]
38525               };
38526             }));
38527           }
38528           return item;
38529         }
38530         lheading(src) {
38531           const cap = this.rules.block.lheading.exec(src);
38532           if (cap) {
38533             return {
38534               type: "heading",
38535               raw: cap[0],
38536               depth: cap[2].charAt(0) === "=" ? 1 : 2,
38537               text: cap[1],
38538               tokens: this.lexer.inline(cap[1])
38539             };
38540           }
38541         }
38542         paragraph(src) {
38543           const cap = this.rules.block.paragraph.exec(src);
38544           if (cap) {
38545             const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
38546             return {
38547               type: "paragraph",
38548               raw: cap[0],
38549               text,
38550               tokens: this.lexer.inline(text)
38551             };
38552           }
38553         }
38554         text(src) {
38555           const cap = this.rules.block.text.exec(src);
38556           if (cap) {
38557             return {
38558               type: "text",
38559               raw: cap[0],
38560               text: cap[0],
38561               tokens: this.lexer.inline(cap[0])
38562             };
38563           }
38564         }
38565         escape(src) {
38566           const cap = this.rules.inline.escape.exec(src);
38567           if (cap) {
38568             return {
38569               type: "escape",
38570               raw: cap[0],
38571               text: cap[1]
38572             };
38573           }
38574         }
38575         tag(src) {
38576           const cap = this.rules.inline.tag.exec(src);
38577           if (cap) {
38578             if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
38579               this.lexer.state.inLink = true;
38580             } else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
38581               this.lexer.state.inLink = false;
38582             }
38583             if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
38584               this.lexer.state.inRawBlock = true;
38585             } else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
38586               this.lexer.state.inRawBlock = false;
38587             }
38588             return {
38589               type: "html",
38590               raw: cap[0],
38591               inLink: this.lexer.state.inLink,
38592               inRawBlock: this.lexer.state.inRawBlock,
38593               block: false,
38594               text: cap[0]
38595             };
38596           }
38597         }
38598         link(src) {
38599           const cap = this.rules.inline.link.exec(src);
38600           if (cap) {
38601             const trimmedUrl = cap[2].trim();
38602             if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
38603               if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
38604                 return;
38605               }
38606               const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
38607               if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
38608                 return;
38609               }
38610             } else {
38611               const lastParenIndex = findClosingBracket(cap[2], "()");
38612               if (lastParenIndex === -2) {
38613                 return;
38614               }
38615               if (lastParenIndex > -1) {
38616                 const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
38617                 const linkLen = start2 + cap[1].length + lastParenIndex;
38618                 cap[2] = cap[2].substring(0, lastParenIndex);
38619                 cap[0] = cap[0].substring(0, linkLen).trim();
38620                 cap[3] = "";
38621               }
38622             }
38623             let href = cap[2];
38624             let title = "";
38625             if (this.options.pedantic) {
38626               const link3 = this.rules.other.pedanticHrefTitle.exec(href);
38627               if (link3) {
38628                 href = link3[1];
38629                 title = link3[3];
38630               }
38631             } else {
38632               title = cap[3] ? cap[3].slice(1, -1) : "";
38633             }
38634             href = href.trim();
38635             if (this.rules.other.startAngleBracket.test(href)) {
38636               if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
38637                 href = href.slice(1);
38638               } else {
38639                 href = href.slice(1, -1);
38640               }
38641             }
38642             return outputLink(cap, {
38643               href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
38644               title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
38645             }, cap[0], this.lexer, this.rules);
38646           }
38647         }
38648         reflink(src, links) {
38649           let cap;
38650           if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
38651             const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, " ");
38652             const link3 = links[linkString.toLowerCase()];
38653             if (!link3) {
38654               const text = cap[0].charAt(0);
38655               return {
38656                 type: "text",
38657                 raw: text,
38658                 text
38659               };
38660             }
38661             return outputLink(cap, link3, cap[0], this.lexer, this.rules);
38662           }
38663         }
38664         emStrong(src, maskedSrc, prevChar = "") {
38665           let match = this.rules.inline.emStrongLDelim.exec(src);
38666           if (!match)
38667             return;
38668           if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric))
38669             return;
38670           const nextChar = match[1] || match[2] || "";
38671           if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
38672             const lLength = [...match[0]].length - 1;
38673             let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
38674             const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
38675             endReg.lastIndex = 0;
38676             maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
38677             while ((match = endReg.exec(maskedSrc)) != null) {
38678               rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
38679               if (!rDelim)
38680                 continue;
38681               rLength = [...rDelim].length;
38682               if (match[3] || match[4]) {
38683                 delimTotal += rLength;
38684                 continue;
38685               } else if (match[5] || match[6]) {
38686                 if (lLength % 3 && !((lLength + rLength) % 3)) {
38687                   midDelimTotal += rLength;
38688                   continue;
38689                 }
38690               }
38691               delimTotal -= rLength;
38692               if (delimTotal > 0)
38693                 continue;
38694               rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
38695               const lastCharLength = [...match[0]][0].length;
38696               const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
38697               if (Math.min(lLength, rLength) % 2) {
38698                 const text2 = raw.slice(1, -1);
38699                 return {
38700                   type: "em",
38701                   raw,
38702                   text: text2,
38703                   tokens: this.lexer.inlineTokens(text2)
38704                 };
38705               }
38706               const text = raw.slice(2, -2);
38707               return {
38708                 type: "strong",
38709                 raw,
38710                 text,
38711                 tokens: this.lexer.inlineTokens(text)
38712               };
38713             }
38714           }
38715         }
38716         codespan(src) {
38717           const cap = this.rules.inline.code.exec(src);
38718           if (cap) {
38719             let text = cap[2].replace(this.rules.other.newLineCharGlobal, " ");
38720             const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
38721             const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
38722             if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
38723               text = text.substring(1, text.length - 1);
38724             }
38725             return {
38726               type: "codespan",
38727               raw: cap[0],
38728               text
38729             };
38730           }
38731         }
38732         br(src) {
38733           const cap = this.rules.inline.br.exec(src);
38734           if (cap) {
38735             return {
38736               type: "br",
38737               raw: cap[0]
38738             };
38739           }
38740         }
38741         del(src) {
38742           const cap = this.rules.inline.del.exec(src);
38743           if (cap) {
38744             return {
38745               type: "del",
38746               raw: cap[0],
38747               text: cap[2],
38748               tokens: this.lexer.inlineTokens(cap[2])
38749             };
38750           }
38751         }
38752         autolink(src) {
38753           const cap = this.rules.inline.autolink.exec(src);
38754           if (cap) {
38755             let text, href;
38756             if (cap[2] === "@") {
38757               text = cap[1];
38758               href = "mailto:" + text;
38759             } else {
38760               text = cap[1];
38761               href = text;
38762             }
38763             return {
38764               type: "link",
38765               raw: cap[0],
38766               text,
38767               href,
38768               tokens: [
38769                 {
38770                   type: "text",
38771                   raw: text,
38772                   text
38773                 }
38774               ]
38775             };
38776           }
38777         }
38778         url(src) {
38779           var _a3, _b2;
38780           let cap;
38781           if (cap = this.rules.inline.url.exec(src)) {
38782             let text, href;
38783             if (cap[2] === "@") {
38784               text = cap[0];
38785               href = "mailto:" + text;
38786             } else {
38787               let prevCapZero;
38788               do {
38789                 prevCapZero = cap[0];
38790                 cap[0] = (_b2 = (_a3 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a3[0]) != null ? _b2 : "";
38791               } while (prevCapZero !== cap[0]);
38792               text = cap[0];
38793               if (cap[1] === "www.") {
38794                 href = "http://" + cap[0];
38795               } else {
38796                 href = cap[0];
38797               }
38798             }
38799             return {
38800               type: "link",
38801               raw: cap[0],
38802               text,
38803               href,
38804               tokens: [
38805                 {
38806                   type: "text",
38807                   raw: text,
38808                   text
38809                 }
38810               ]
38811             };
38812           }
38813         }
38814         inlineText(src) {
38815           const cap = this.rules.inline.text.exec(src);
38816           if (cap) {
38817             const escaped = this.lexer.state.inRawBlock;
38818             return {
38819               type: "text",
38820               raw: cap[0],
38821               text: cap[0],
38822               escaped
38823             };
38824           }
38825         }
38826       };
38827       _Lexer = class __Lexer {
38828         constructor(options2) {
38829           __publicField(this, "tokens");
38830           __publicField(this, "options");
38831           __publicField(this, "state");
38832           __publicField(this, "tokenizer");
38833           __publicField(this, "inlineQueue");
38834           this.tokens = [];
38835           this.tokens.links = /* @__PURE__ */ Object.create(null);
38836           this.options = options2 || _defaults;
38837           this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
38838           this.tokenizer = this.options.tokenizer;
38839           this.tokenizer.options = this.options;
38840           this.tokenizer.lexer = this;
38841           this.inlineQueue = [];
38842           this.state = {
38843             inLink: false,
38844             inRawBlock: false,
38845             top: true
38846           };
38847           const rules = {
38848             other,
38849             block: block.normal,
38850             inline: inline.normal
38851           };
38852           if (this.options.pedantic) {
38853             rules.block = block.pedantic;
38854             rules.inline = inline.pedantic;
38855           } else if (this.options.gfm) {
38856             rules.block = block.gfm;
38857             if (this.options.breaks) {
38858               rules.inline = inline.breaks;
38859             } else {
38860               rules.inline = inline.gfm;
38861             }
38862           }
38863           this.tokenizer.rules = rules;
38864         }
38865         /**
38866          * Expose Rules
38867          */
38868         static get rules() {
38869           return {
38870             block,
38871             inline
38872           };
38873         }
38874         /**
38875          * Static Lex Method
38876          */
38877         static lex(src, options2) {
38878           const lexer2 = new __Lexer(options2);
38879           return lexer2.lex(src);
38880         }
38881         /**
38882          * Static Lex Inline Method
38883          */
38884         static lexInline(src, options2) {
38885           const lexer2 = new __Lexer(options2);
38886           return lexer2.inlineTokens(src);
38887         }
38888         /**
38889          * Preprocessing
38890          */
38891         lex(src) {
38892           src = src.replace(other.carriageReturn, "\n");
38893           this.blockTokens(src, this.tokens);
38894           for (let i3 = 0; i3 < this.inlineQueue.length; i3++) {
38895             const next = this.inlineQueue[i3];
38896             this.inlineTokens(next.src, next.tokens);
38897           }
38898           this.inlineQueue = [];
38899           return this.tokens;
38900         }
38901         blockTokens(src, tokens = [], lastParagraphClipped = false) {
38902           var _a3, _b2, _c;
38903           if (this.options.pedantic) {
38904             src = src.replace(other.tabCharGlobal, "    ").replace(other.spaceLine, "");
38905           }
38906           while (src) {
38907             let token;
38908             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.block) == null ? void 0 : _b2.some((extTokenizer) => {
38909               if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38910                 src = src.substring(token.raw.length);
38911                 tokens.push(token);
38912                 return true;
38913               }
38914               return false;
38915             })) {
38916               continue;
38917             }
38918             if (token = this.tokenizer.space(src)) {
38919               src = src.substring(token.raw.length);
38920               const lastToken = tokens.at(-1);
38921               if (token.raw.length === 1 && lastToken !== void 0) {
38922                 lastToken.raw += "\n";
38923               } else {
38924                 tokens.push(token);
38925               }
38926               continue;
38927             }
38928             if (token = this.tokenizer.code(src)) {
38929               src = src.substring(token.raw.length);
38930               const lastToken = tokens.at(-1);
38931               if ((lastToken == null ? void 0 : lastToken.type) === "paragraph" || (lastToken == null ? void 0 : lastToken.type) === "text") {
38932                 lastToken.raw += "\n" + token.raw;
38933                 lastToken.text += "\n" + token.text;
38934                 this.inlineQueue.at(-1).src = lastToken.text;
38935               } else {
38936                 tokens.push(token);
38937               }
38938               continue;
38939             }
38940             if (token = this.tokenizer.fences(src)) {
38941               src = src.substring(token.raw.length);
38942               tokens.push(token);
38943               continue;
38944             }
38945             if (token = this.tokenizer.heading(src)) {
38946               src = src.substring(token.raw.length);
38947               tokens.push(token);
38948               continue;
38949             }
38950             if (token = this.tokenizer.hr(src)) {
38951               src = src.substring(token.raw.length);
38952               tokens.push(token);
38953               continue;
38954             }
38955             if (token = this.tokenizer.blockquote(src)) {
38956               src = src.substring(token.raw.length);
38957               tokens.push(token);
38958               continue;
38959             }
38960             if (token = this.tokenizer.list(src)) {
38961               src = src.substring(token.raw.length);
38962               tokens.push(token);
38963               continue;
38964             }
38965             if (token = this.tokenizer.html(src)) {
38966               src = src.substring(token.raw.length);
38967               tokens.push(token);
38968               continue;
38969             }
38970             if (token = this.tokenizer.def(src)) {
38971               src = src.substring(token.raw.length);
38972               const lastToken = tokens.at(-1);
38973               if ((lastToken == null ? void 0 : lastToken.type) === "paragraph" || (lastToken == null ? void 0 : lastToken.type) === "text") {
38974                 lastToken.raw += "\n" + token.raw;
38975                 lastToken.text += "\n" + token.raw;
38976                 this.inlineQueue.at(-1).src = lastToken.text;
38977               } else if (!this.tokens.links[token.tag]) {
38978                 this.tokens.links[token.tag] = {
38979                   href: token.href,
38980                   title: token.title
38981                 };
38982               }
38983               continue;
38984             }
38985             if (token = this.tokenizer.table(src)) {
38986               src = src.substring(token.raw.length);
38987               tokens.push(token);
38988               continue;
38989             }
38990             if (token = this.tokenizer.lheading(src)) {
38991               src = src.substring(token.raw.length);
38992               tokens.push(token);
38993               continue;
38994             }
38995             let cutSrc = src;
38996             if ((_c = this.options.extensions) == null ? void 0 : _c.startBlock) {
38997               let startIndex = Infinity;
38998               const tempSrc = src.slice(1);
38999               let tempStart;
39000               this.options.extensions.startBlock.forEach((getStartIndex) => {
39001                 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
39002                 if (typeof tempStart === "number" && tempStart >= 0) {
39003                   startIndex = Math.min(startIndex, tempStart);
39004                 }
39005               });
39006               if (startIndex < Infinity && startIndex >= 0) {
39007                 cutSrc = src.substring(0, startIndex + 1);
39008               }
39009             }
39010             if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
39011               const lastToken = tokens.at(-1);
39012               if (lastParagraphClipped && (lastToken == null ? void 0 : lastToken.type) === "paragraph") {
39013                 lastToken.raw += "\n" + token.raw;
39014                 lastToken.text += "\n" + token.text;
39015                 this.inlineQueue.pop();
39016                 this.inlineQueue.at(-1).src = lastToken.text;
39017               } else {
39018                 tokens.push(token);
39019               }
39020               lastParagraphClipped = cutSrc.length !== src.length;
39021               src = src.substring(token.raw.length);
39022               continue;
39023             }
39024             if (token = this.tokenizer.text(src)) {
39025               src = src.substring(token.raw.length);
39026               const lastToken = tokens.at(-1);
39027               if ((lastToken == null ? void 0 : lastToken.type) === "text") {
39028                 lastToken.raw += "\n" + token.raw;
39029                 lastToken.text += "\n" + token.text;
39030                 this.inlineQueue.pop();
39031                 this.inlineQueue.at(-1).src = lastToken.text;
39032               } else {
39033                 tokens.push(token);
39034               }
39035               continue;
39036             }
39037             if (src) {
39038               const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
39039               if (this.options.silent) {
39040                 console.error(errMsg);
39041                 break;
39042               } else {
39043                 throw new Error(errMsg);
39044               }
39045             }
39046           }
39047           this.state.top = true;
39048           return tokens;
39049         }
39050         inline(src, tokens = []) {
39051           this.inlineQueue.push({ src, tokens });
39052           return tokens;
39053         }
39054         /**
39055          * Lexing/Compiling
39056          */
39057         inlineTokens(src, tokens = []) {
39058           var _a3, _b2, _c;
39059           let maskedSrc = src;
39060           let match = null;
39061           if (this.tokens.links) {
39062             const links = Object.keys(this.tokens.links);
39063             if (links.length > 0) {
39064               while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
39065                 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
39066                   maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
39067                 }
39068               }
39069             }
39070           }
39071           while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
39072             maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
39073           }
39074           while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
39075             maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
39076           }
39077           let keepPrevChar = false;
39078           let prevChar = "";
39079           while (src) {
39080             if (!keepPrevChar) {
39081               prevChar = "";
39082             }
39083             keepPrevChar = false;
39084             let token;
39085             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.inline) == null ? void 0 : _b2.some((extTokenizer) => {
39086               if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
39087                 src = src.substring(token.raw.length);
39088                 tokens.push(token);
39089                 return true;
39090               }
39091               return false;
39092             })) {
39093               continue;
39094             }
39095             if (token = this.tokenizer.escape(src)) {
39096               src = src.substring(token.raw.length);
39097               tokens.push(token);
39098               continue;
39099             }
39100             if (token = this.tokenizer.tag(src)) {
39101               src = src.substring(token.raw.length);
39102               tokens.push(token);
39103               continue;
39104             }
39105             if (token = this.tokenizer.link(src)) {
39106               src = src.substring(token.raw.length);
39107               tokens.push(token);
39108               continue;
39109             }
39110             if (token = this.tokenizer.reflink(src, this.tokens.links)) {
39111               src = src.substring(token.raw.length);
39112               const lastToken = tokens.at(-1);
39113               if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
39114                 lastToken.raw += token.raw;
39115                 lastToken.text += token.text;
39116               } else {
39117                 tokens.push(token);
39118               }
39119               continue;
39120             }
39121             if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
39122               src = src.substring(token.raw.length);
39123               tokens.push(token);
39124               continue;
39125             }
39126             if (token = this.tokenizer.codespan(src)) {
39127               src = src.substring(token.raw.length);
39128               tokens.push(token);
39129               continue;
39130             }
39131             if (token = this.tokenizer.br(src)) {
39132               src = src.substring(token.raw.length);
39133               tokens.push(token);
39134               continue;
39135             }
39136             if (token = this.tokenizer.del(src)) {
39137               src = src.substring(token.raw.length);
39138               tokens.push(token);
39139               continue;
39140             }
39141             if (token = this.tokenizer.autolink(src)) {
39142               src = src.substring(token.raw.length);
39143               tokens.push(token);
39144               continue;
39145             }
39146             if (!this.state.inLink && (token = this.tokenizer.url(src))) {
39147               src = src.substring(token.raw.length);
39148               tokens.push(token);
39149               continue;
39150             }
39151             let cutSrc = src;
39152             if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) {
39153               let startIndex = Infinity;
39154               const tempSrc = src.slice(1);
39155               let tempStart;
39156               this.options.extensions.startInline.forEach((getStartIndex) => {
39157                 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
39158                 if (typeof tempStart === "number" && tempStart >= 0) {
39159                   startIndex = Math.min(startIndex, tempStart);
39160                 }
39161               });
39162               if (startIndex < Infinity && startIndex >= 0) {
39163                 cutSrc = src.substring(0, startIndex + 1);
39164               }
39165             }
39166             if (token = this.tokenizer.inlineText(cutSrc)) {
39167               src = src.substring(token.raw.length);
39168               if (token.raw.slice(-1) !== "_") {
39169                 prevChar = token.raw.slice(-1);
39170               }
39171               keepPrevChar = true;
39172               const lastToken = tokens.at(-1);
39173               if ((lastToken == null ? void 0 : lastToken.type) === "text") {
39174                 lastToken.raw += token.raw;
39175                 lastToken.text += token.text;
39176               } else {
39177                 tokens.push(token);
39178               }
39179               continue;
39180             }
39181             if (src) {
39182               const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
39183               if (this.options.silent) {
39184                 console.error(errMsg);
39185                 break;
39186               } else {
39187                 throw new Error(errMsg);
39188               }
39189             }
39190           }
39191           return tokens;
39192         }
39193       };
39194       _Renderer = class {
39195         // set by the parser
39196         constructor(options2) {
39197           __publicField(this, "options");
39198           __publicField(this, "parser");
39199           this.options = options2 || _defaults;
39200         }
39201         space(token) {
39202           return "";
39203         }
39204         code({ text, lang, escaped }) {
39205           var _a3;
39206           const langString = (_a3 = (lang || "").match(other.notSpaceStart)) == null ? void 0 : _a3[0];
39207           const code = text.replace(other.endingNewline, "") + "\n";
39208           if (!langString) {
39209             return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
39210           }
39211           return '<pre><code class="language-' + escape4(langString) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
39212         }
39213         blockquote({ tokens }) {
39214           const body = this.parser.parse(tokens);
39215           return `<blockquote>
39216 ${body}</blockquote>
39217 `;
39218         }
39219         html({ text }) {
39220           return text;
39221         }
39222         heading({ tokens, depth }) {
39223           return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
39224 `;
39225         }
39226         hr(token) {
39227           return "<hr>\n";
39228         }
39229         list(token) {
39230           const ordered = token.ordered;
39231           const start2 = token.start;
39232           let body = "";
39233           for (let j2 = 0; j2 < token.items.length; j2++) {
39234             const item = token.items[j2];
39235             body += this.listitem(item);
39236           }
39237           const type2 = ordered ? "ol" : "ul";
39238           const startAttr = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
39239           return "<" + type2 + startAttr + ">\n" + body + "</" + type2 + ">\n";
39240         }
39241         listitem(item) {
39242           var _a3;
39243           let itemBody = "";
39244           if (item.task) {
39245             const checkbox = this.checkbox({ checked: !!item.checked });
39246             if (item.loose) {
39247               if (((_a3 = item.tokens[0]) == null ? void 0 : _a3.type) === "paragraph") {
39248                 item.tokens[0].text = checkbox + " " + item.tokens[0].text;
39249                 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
39250                   item.tokens[0].tokens[0].text = checkbox + " " + escape4(item.tokens[0].tokens[0].text);
39251                   item.tokens[0].tokens[0].escaped = true;
39252                 }
39253               } else {
39254                 item.tokens.unshift({
39255                   type: "text",
39256                   raw: checkbox + " ",
39257                   text: checkbox + " ",
39258                   escaped: true
39259                 });
39260               }
39261             } else {
39262               itemBody += checkbox + " ";
39263             }
39264           }
39265           itemBody += this.parser.parse(item.tokens, !!item.loose);
39266           return `<li>${itemBody}</li>
39267 `;
39268         }
39269         checkbox({ checked }) {
39270           return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
39271         }
39272         paragraph({ tokens }) {
39273           return `<p>${this.parser.parseInline(tokens)}</p>
39274 `;
39275         }
39276         table(token) {
39277           let header = "";
39278           let cell = "";
39279           for (let j2 = 0; j2 < token.header.length; j2++) {
39280             cell += this.tablecell(token.header[j2]);
39281           }
39282           header += this.tablerow({ text: cell });
39283           let body = "";
39284           for (let j2 = 0; j2 < token.rows.length; j2++) {
39285             const row = token.rows[j2];
39286             cell = "";
39287             for (let k2 = 0; k2 < row.length; k2++) {
39288               cell += this.tablecell(row[k2]);
39289             }
39290             body += this.tablerow({ text: cell });
39291           }
39292           if (body)
39293             body = `<tbody>${body}</tbody>`;
39294           return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
39295         }
39296         tablerow({ text }) {
39297           return `<tr>
39298 ${text}</tr>
39299 `;
39300         }
39301         tablecell(token) {
39302           const content = this.parser.parseInline(token.tokens);
39303           const type2 = token.header ? "th" : "td";
39304           const tag2 = token.align ? `<${type2} align="${token.align}">` : `<${type2}>`;
39305           return tag2 + content + `</${type2}>
39306 `;
39307         }
39308         /**
39309          * span level renderer
39310          */
39311         strong({ tokens }) {
39312           return `<strong>${this.parser.parseInline(tokens)}</strong>`;
39313         }
39314         em({ tokens }) {
39315           return `<em>${this.parser.parseInline(tokens)}</em>`;
39316         }
39317         codespan({ text }) {
39318           return `<code>${escape4(text, true)}</code>`;
39319         }
39320         br(token) {
39321           return "<br>";
39322         }
39323         del({ tokens }) {
39324           return `<del>${this.parser.parseInline(tokens)}</del>`;
39325         }
39326         link({ href, title, tokens }) {
39327           const text = this.parser.parseInline(tokens);
39328           const cleanHref = cleanUrl(href);
39329           if (cleanHref === null) {
39330             return text;
39331           }
39332           href = cleanHref;
39333           let out = '<a href="' + href + '"';
39334           if (title) {
39335             out += ' title="' + escape4(title) + '"';
39336           }
39337           out += ">" + text + "</a>";
39338           return out;
39339         }
39340         image({ href, title, text, tokens }) {
39341           if (tokens) {
39342             text = this.parser.parseInline(tokens, this.parser.textRenderer);
39343           }
39344           const cleanHref = cleanUrl(href);
39345           if (cleanHref === null) {
39346             return escape4(text);
39347           }
39348           href = cleanHref;
39349           let out = `<img src="${href}" alt="${text}"`;
39350           if (title) {
39351             out += ` title="${escape4(title)}"`;
39352           }
39353           out += ">";
39354           return out;
39355         }
39356         text(token) {
39357           return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : "escaped" in token && token.escaped ? token.text : escape4(token.text);
39358         }
39359       };
39360       _TextRenderer = class {
39361         // no need for block level renderers
39362         strong({ text }) {
39363           return text;
39364         }
39365         em({ text }) {
39366           return text;
39367         }
39368         codespan({ text }) {
39369           return text;
39370         }
39371         del({ text }) {
39372           return text;
39373         }
39374         html({ text }) {
39375           return text;
39376         }
39377         text({ text }) {
39378           return text;
39379         }
39380         link({ text }) {
39381           return "" + text;
39382         }
39383         image({ text }) {
39384           return "" + text;
39385         }
39386         br() {
39387           return "";
39388         }
39389       };
39390       _Parser = class __Parser {
39391         constructor(options2) {
39392           __publicField(this, "options");
39393           __publicField(this, "renderer");
39394           __publicField(this, "textRenderer");
39395           this.options = options2 || _defaults;
39396           this.options.renderer = this.options.renderer || new _Renderer();
39397           this.renderer = this.options.renderer;
39398           this.renderer.options = this.options;
39399           this.renderer.parser = this;
39400           this.textRenderer = new _TextRenderer();
39401         }
39402         /**
39403          * Static Parse Method
39404          */
39405         static parse(tokens, options2) {
39406           const parser3 = new __Parser(options2);
39407           return parser3.parse(tokens);
39408         }
39409         /**
39410          * Static Parse Inline Method
39411          */
39412         static parseInline(tokens, options2) {
39413           const parser3 = new __Parser(options2);
39414           return parser3.parseInline(tokens);
39415         }
39416         /**
39417          * Parse Loop
39418          */
39419         parse(tokens, top = true) {
39420           var _a3, _b2;
39421           let out = "";
39422           for (let i3 = 0; i3 < tokens.length; i3++) {
39423             const anyToken = tokens[i3];
39424             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.renderers) == null ? void 0 : _b2[anyToken.type]) {
39425               const genericToken = anyToken;
39426               const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
39427               if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
39428                 out += ret || "";
39429                 continue;
39430               }
39431             }
39432             const token = anyToken;
39433             switch (token.type) {
39434               case "space": {
39435                 out += this.renderer.space(token);
39436                 continue;
39437               }
39438               case "hr": {
39439                 out += this.renderer.hr(token);
39440                 continue;
39441               }
39442               case "heading": {
39443                 out += this.renderer.heading(token);
39444                 continue;
39445               }
39446               case "code": {
39447                 out += this.renderer.code(token);
39448                 continue;
39449               }
39450               case "table": {
39451                 out += this.renderer.table(token);
39452                 continue;
39453               }
39454               case "blockquote": {
39455                 out += this.renderer.blockquote(token);
39456                 continue;
39457               }
39458               case "list": {
39459                 out += this.renderer.list(token);
39460                 continue;
39461               }
39462               case "html": {
39463                 out += this.renderer.html(token);
39464                 continue;
39465               }
39466               case "paragraph": {
39467                 out += this.renderer.paragraph(token);
39468                 continue;
39469               }
39470               case "text": {
39471                 let textToken = token;
39472                 let body = this.renderer.text(textToken);
39473                 while (i3 + 1 < tokens.length && tokens[i3 + 1].type === "text") {
39474                   textToken = tokens[++i3];
39475                   body += "\n" + this.renderer.text(textToken);
39476                 }
39477                 if (top) {
39478                   out += this.renderer.paragraph({
39479                     type: "paragraph",
39480                     raw: body,
39481                     text: body,
39482                     tokens: [{ type: "text", raw: body, text: body, escaped: true }]
39483                   });
39484                 } else {
39485                   out += body;
39486                 }
39487                 continue;
39488               }
39489               default: {
39490                 const errMsg = 'Token with "' + token.type + '" type was not found.';
39491                 if (this.options.silent) {
39492                   console.error(errMsg);
39493                   return "";
39494                 } else {
39495                   throw new Error(errMsg);
39496                 }
39497               }
39498             }
39499           }
39500           return out;
39501         }
39502         /**
39503          * Parse Inline Tokens
39504          */
39505         parseInline(tokens, renderer = this.renderer) {
39506           var _a3, _b2;
39507           let out = "";
39508           for (let i3 = 0; i3 < tokens.length; i3++) {
39509             const anyToken = tokens[i3];
39510             if ((_b2 = (_a3 = this.options.extensions) == null ? void 0 : _a3.renderers) == null ? void 0 : _b2[anyToken.type]) {
39511               const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
39512               if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
39513                 out += ret || "";
39514                 continue;
39515               }
39516             }
39517             const token = anyToken;
39518             switch (token.type) {
39519               case "escape": {
39520                 out += renderer.text(token);
39521                 break;
39522               }
39523               case "html": {
39524                 out += renderer.html(token);
39525                 break;
39526               }
39527               case "link": {
39528                 out += renderer.link(token);
39529                 break;
39530               }
39531               case "image": {
39532                 out += renderer.image(token);
39533                 break;
39534               }
39535               case "strong": {
39536                 out += renderer.strong(token);
39537                 break;
39538               }
39539               case "em": {
39540                 out += renderer.em(token);
39541                 break;
39542               }
39543               case "codespan": {
39544                 out += renderer.codespan(token);
39545                 break;
39546               }
39547               case "br": {
39548                 out += renderer.br(token);
39549                 break;
39550               }
39551               case "del": {
39552                 out += renderer.del(token);
39553                 break;
39554               }
39555               case "text": {
39556                 out += renderer.text(token);
39557                 break;
39558               }
39559               default: {
39560                 const errMsg = 'Token with "' + token.type + '" type was not found.';
39561                 if (this.options.silent) {
39562                   console.error(errMsg);
39563                   return "";
39564                 } else {
39565                   throw new Error(errMsg);
39566                 }
39567               }
39568             }
39569           }
39570           return out;
39571         }
39572       };
39573       _Hooks = class {
39574         constructor(options2) {
39575           __publicField(this, "options");
39576           __publicField(this, "block");
39577           this.options = options2 || _defaults;
39578         }
39579         /**
39580          * Process markdown before marked
39581          */
39582         preprocess(markdown) {
39583           return markdown;
39584         }
39585         /**
39586          * Process HTML after marked is finished
39587          */
39588         postprocess(html3) {
39589           return html3;
39590         }
39591         /**
39592          * Process all tokens before walk tokens
39593          */
39594         processAllTokens(tokens) {
39595           return tokens;
39596         }
39597         /**
39598          * Provide function to tokenize markdown
39599          */
39600         provideLexer() {
39601           return this.block ? _Lexer.lex : _Lexer.lexInline;
39602         }
39603         /**
39604          * Provide function to parse tokens
39605          */
39606         provideParser() {
39607           return this.block ? _Parser.parse : _Parser.parseInline;
39608         }
39609       };
39610       __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
39611         "preprocess",
39612         "postprocess",
39613         "processAllTokens"
39614       ]));
39615       Marked = class {
39616         constructor(...args) {
39617           __publicField(this, "defaults", _getDefaults());
39618           __publicField(this, "options", this.setOptions);
39619           __publicField(this, "parse", this.parseMarkdown(true));
39620           __publicField(this, "parseInline", this.parseMarkdown(false));
39621           __publicField(this, "Parser", _Parser);
39622           __publicField(this, "Renderer", _Renderer);
39623           __publicField(this, "TextRenderer", _TextRenderer);
39624           __publicField(this, "Lexer", _Lexer);
39625           __publicField(this, "Tokenizer", _Tokenizer);
39626           __publicField(this, "Hooks", _Hooks);
39627           this.use(...args);
39628         }
39629         /**
39630          * Run callback for every token
39631          */
39632         walkTokens(tokens, callback) {
39633           var _a3, _b2;
39634           let values = [];
39635           for (const token of tokens) {
39636             values = values.concat(callback.call(this, token));
39637             switch (token.type) {
39638               case "table": {
39639                 const tableToken = token;
39640                 for (const cell of tableToken.header) {
39641                   values = values.concat(this.walkTokens(cell.tokens, callback));
39642                 }
39643                 for (const row of tableToken.rows) {
39644                   for (const cell of row) {
39645                     values = values.concat(this.walkTokens(cell.tokens, callback));
39646                   }
39647                 }
39648                 break;
39649               }
39650               case "list": {
39651                 const listToken = token;
39652                 values = values.concat(this.walkTokens(listToken.items, callback));
39653                 break;
39654               }
39655               default: {
39656                 const genericToken = token;
39657                 if ((_b2 = (_a3 = this.defaults.extensions) == null ? void 0 : _a3.childTokens) == null ? void 0 : _b2[genericToken.type]) {
39658                   this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
39659                     const tokens2 = genericToken[childTokens].flat(Infinity);
39660                     values = values.concat(this.walkTokens(tokens2, callback));
39661                   });
39662                 } else if (genericToken.tokens) {
39663                   values = values.concat(this.walkTokens(genericToken.tokens, callback));
39664                 }
39665               }
39666             }
39667           }
39668           return values;
39669         }
39670         use(...args) {
39671           const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
39672           args.forEach((pack) => {
39673             const opts = { ...pack };
39674             opts.async = this.defaults.async || opts.async || false;
39675             if (pack.extensions) {
39676               pack.extensions.forEach((ext) => {
39677                 if (!ext.name) {
39678                   throw new Error("extension name required");
39679                 }
39680                 if ("renderer" in ext) {
39681                   const prevRenderer = extensions.renderers[ext.name];
39682                   if (prevRenderer) {
39683                     extensions.renderers[ext.name] = function(...args2) {
39684                       let ret = ext.renderer.apply(this, args2);
39685                       if (ret === false) {
39686                         ret = prevRenderer.apply(this, args2);
39687                       }
39688                       return ret;
39689                     };
39690                   } else {
39691                     extensions.renderers[ext.name] = ext.renderer;
39692                   }
39693                 }
39694                 if ("tokenizer" in ext) {
39695                   if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
39696                     throw new Error("extension level must be 'block' or 'inline'");
39697                   }
39698                   const extLevel = extensions[ext.level];
39699                   if (extLevel) {
39700                     extLevel.unshift(ext.tokenizer);
39701                   } else {
39702                     extensions[ext.level] = [ext.tokenizer];
39703                   }
39704                   if (ext.start) {
39705                     if (ext.level === "block") {
39706                       if (extensions.startBlock) {
39707                         extensions.startBlock.push(ext.start);
39708                       } else {
39709                         extensions.startBlock = [ext.start];
39710                       }
39711                     } else if (ext.level === "inline") {
39712                       if (extensions.startInline) {
39713                         extensions.startInline.push(ext.start);
39714                       } else {
39715                         extensions.startInline = [ext.start];
39716                       }
39717                     }
39718                   }
39719                 }
39720                 if ("childTokens" in ext && ext.childTokens) {
39721                   extensions.childTokens[ext.name] = ext.childTokens;
39722                 }
39723               });
39724               opts.extensions = extensions;
39725             }
39726             if (pack.renderer) {
39727               const renderer = this.defaults.renderer || new _Renderer(this.defaults);
39728               for (const prop in pack.renderer) {
39729                 if (!(prop in renderer)) {
39730                   throw new Error(`renderer '${prop}' does not exist`);
39731                 }
39732                 if (["options", "parser"].includes(prop)) {
39733                   continue;
39734                 }
39735                 const rendererProp = prop;
39736                 const rendererFunc = pack.renderer[rendererProp];
39737                 const prevRenderer = renderer[rendererProp];
39738                 renderer[rendererProp] = (...args2) => {
39739                   let ret = rendererFunc.apply(renderer, args2);
39740                   if (ret === false) {
39741                     ret = prevRenderer.apply(renderer, args2);
39742                   }
39743                   return ret || "";
39744                 };
39745               }
39746               opts.renderer = renderer;
39747             }
39748             if (pack.tokenizer) {
39749               const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
39750               for (const prop in pack.tokenizer) {
39751                 if (!(prop in tokenizer)) {
39752                   throw new Error(`tokenizer '${prop}' does not exist`);
39753                 }
39754                 if (["options", "rules", "lexer"].includes(prop)) {
39755                   continue;
39756                 }
39757                 const tokenizerProp = prop;
39758                 const tokenizerFunc = pack.tokenizer[tokenizerProp];
39759                 const prevTokenizer = tokenizer[tokenizerProp];
39760                 tokenizer[tokenizerProp] = (...args2) => {
39761                   let ret = tokenizerFunc.apply(tokenizer, args2);
39762                   if (ret === false) {
39763                     ret = prevTokenizer.apply(tokenizer, args2);
39764                   }
39765                   return ret;
39766                 };
39767               }
39768               opts.tokenizer = tokenizer;
39769             }
39770             if (pack.hooks) {
39771               const hooks = this.defaults.hooks || new _Hooks();
39772               for (const prop in pack.hooks) {
39773                 if (!(prop in hooks)) {
39774                   throw new Error(`hook '${prop}' does not exist`);
39775                 }
39776                 if (["options", "block"].includes(prop)) {
39777                   continue;
39778                 }
39779                 const hooksProp = prop;
39780                 const hooksFunc = pack.hooks[hooksProp];
39781                 const prevHook = hooks[hooksProp];
39782                 if (_Hooks.passThroughHooks.has(prop)) {
39783                   hooks[hooksProp] = (arg) => {
39784                     if (this.defaults.async) {
39785                       return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
39786                         return prevHook.call(hooks, ret2);
39787                       });
39788                     }
39789                     const ret = hooksFunc.call(hooks, arg);
39790                     return prevHook.call(hooks, ret);
39791                   };
39792                 } else {
39793                   hooks[hooksProp] = (...args2) => {
39794                     let ret = hooksFunc.apply(hooks, args2);
39795                     if (ret === false) {
39796                       ret = prevHook.apply(hooks, args2);
39797                     }
39798                     return ret;
39799                   };
39800                 }
39801               }
39802               opts.hooks = hooks;
39803             }
39804             if (pack.walkTokens) {
39805               const walkTokens2 = this.defaults.walkTokens;
39806               const packWalktokens = pack.walkTokens;
39807               opts.walkTokens = function(token) {
39808                 let values = [];
39809                 values.push(packWalktokens.call(this, token));
39810                 if (walkTokens2) {
39811                   values = values.concat(walkTokens2.call(this, token));
39812                 }
39813                 return values;
39814               };
39815             }
39816             this.defaults = { ...this.defaults, ...opts };
39817           });
39818           return this;
39819         }
39820         setOptions(opt) {
39821           this.defaults = { ...this.defaults, ...opt };
39822           return this;
39823         }
39824         lexer(src, options2) {
39825           return _Lexer.lex(src, options2 != null ? options2 : this.defaults);
39826         }
39827         parser(tokens, options2) {
39828           return _Parser.parse(tokens, options2 != null ? options2 : this.defaults);
39829         }
39830         parseMarkdown(blockType) {
39831           const parse = (src, options2) => {
39832             const origOpt = { ...options2 };
39833             const opt = { ...this.defaults, ...origOpt };
39834             const throwError = this.onError(!!opt.silent, !!opt.async);
39835             if (this.defaults.async === true && origOpt.async === false) {
39836               return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
39837             }
39838             if (typeof src === "undefined" || src === null) {
39839               return throwError(new Error("marked(): input parameter is undefined or null"));
39840             }
39841             if (typeof src !== "string") {
39842               return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
39843             }
39844             if (opt.hooks) {
39845               opt.hooks.options = opt;
39846               opt.hooks.block = blockType;
39847             }
39848             const lexer2 = opt.hooks ? opt.hooks.provideLexer() : blockType ? _Lexer.lex : _Lexer.lexInline;
39849             const parser3 = opt.hooks ? opt.hooks.provideParser() : blockType ? _Parser.parse : _Parser.parseInline;
39850             if (opt.async) {
39851               return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html3) => opt.hooks ? opt.hooks.postprocess(html3) : html3).catch(throwError);
39852             }
39853             try {
39854               if (opt.hooks) {
39855                 src = opt.hooks.preprocess(src);
39856               }
39857               let tokens = lexer2(src, opt);
39858               if (opt.hooks) {
39859                 tokens = opt.hooks.processAllTokens(tokens);
39860               }
39861               if (opt.walkTokens) {
39862                 this.walkTokens(tokens, opt.walkTokens);
39863               }
39864               let html3 = parser3(tokens, opt);
39865               if (opt.hooks) {
39866                 html3 = opt.hooks.postprocess(html3);
39867               }
39868               return html3;
39869             } catch (e3) {
39870               return throwError(e3);
39871             }
39872           };
39873           return parse;
39874         }
39875         onError(silent, async) {
39876           return (e3) => {
39877             e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39878             if (silent) {
39879               const msg = "<p>An error occurred:</p><pre>" + escape4(e3.message + "", true) + "</pre>";
39880               if (async) {
39881                 return Promise.resolve(msg);
39882               }
39883               return msg;
39884             }
39885             if (async) {
39886               return Promise.reject(e3);
39887             }
39888             throw e3;
39889           };
39890         }
39891       };
39892       markedInstance = new Marked();
39893       marked.options = marked.setOptions = function(options2) {
39894         markedInstance.setOptions(options2);
39895         marked.defaults = markedInstance.defaults;
39896         changeDefaults(marked.defaults);
39897         return marked;
39898       };
39899       marked.getDefaults = _getDefaults;
39900       marked.defaults = _defaults;
39901       marked.use = function(...args) {
39902         markedInstance.use(...args);
39903         marked.defaults = markedInstance.defaults;
39904         changeDefaults(marked.defaults);
39905         return marked;
39906       };
39907       marked.walkTokens = function(tokens, callback) {
39908         return markedInstance.walkTokens(tokens, callback);
39909       };
39910       marked.parseInline = markedInstance.parseInline;
39911       marked.Parser = _Parser;
39912       marked.parser = _Parser.parse;
39913       marked.Renderer = _Renderer;
39914       marked.TextRenderer = _TextRenderer;
39915       marked.Lexer = _Lexer;
39916       marked.lexer = _Lexer.lex;
39917       marked.Tokenizer = _Tokenizer;
39918       marked.Hooks = _Hooks;
39919       marked.parse = marked;
39920       options = marked.options;
39921       setOptions = marked.setOptions;
39922       use = marked.use;
39923       walkTokens = marked.walkTokens;
39924       parseInline = marked.parseInline;
39925       parser2 = _Parser.parse;
39926       lexer = _Lexer.lex;
39927     }
39928   });
39929
39930   // modules/services/osmose.js
39931   var osmose_exports = {};
39932   __export(osmose_exports, {
39933     default: () => osmose_default
39934   });
39935   function abortRequest2(controller) {
39936     if (controller) {
39937       controller.abort();
39938     }
39939   }
39940   function abortUnwantedRequests2(cache, tiles) {
39941     Object.keys(cache.inflightTile).forEach((k2) => {
39942       let wanted = tiles.find((tile) => k2 === tile.id);
39943       if (!wanted) {
39944         abortRequest2(cache.inflightTile[k2]);
39945         delete cache.inflightTile[k2];
39946       }
39947     });
39948   }
39949   function encodeIssueRtree2(d2) {
39950     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39951   }
39952   function updateRtree2(item, replace) {
39953     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39954     if (replace) {
39955       _cache2.rtree.insert(item);
39956     }
39957   }
39958   function preventCoincident(loc) {
39959     let coincident = false;
39960     do {
39961       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39962       loc = geoVecAdd(loc, delta);
39963       let bbox2 = geoExtent(loc).bbox();
39964       coincident = _cache2.rtree.search(bbox2).length;
39965     } while (coincident);
39966     return loc;
39967   }
39968   var tiler2, dispatch3, _tileZoom2, _osmoseUrlRoot, _osmoseData, _cache2, osmose_default;
39969   var init_osmose = __esm({
39970     "modules/services/osmose.js"() {
39971       "use strict";
39972       init_rbush();
39973       init_src4();
39974       init_src18();
39975       init_marked_esm();
39976       init_file_fetcher();
39977       init_localizer();
39978       init_geo2();
39979       init_osm();
39980       init_util();
39981       tiler2 = utilTiler();
39982       dispatch3 = dispatch_default("loaded");
39983       _tileZoom2 = 14;
39984       _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39985       _osmoseData = { icons: {}, items: [] };
39986       osmose_default = {
39987         title: "osmose",
39988         init() {
39989           _mainFileFetcher.get("qa_data").then((d2) => {
39990             _osmoseData = d2.osmose;
39991             _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39992           });
39993           if (!_cache2) {
39994             this.reset();
39995           }
39996           this.event = utilRebind(this, dispatch3, "on");
39997         },
39998         reset() {
39999           let _strings = {};
40000           let _colors = {};
40001           if (_cache2) {
40002             Object.values(_cache2.inflightTile).forEach(abortRequest2);
40003             _strings = _cache2.strings;
40004             _colors = _cache2.colors;
40005           }
40006           _cache2 = {
40007             data: {},
40008             loadedTile: {},
40009             inflightTile: {},
40010             inflightPost: {},
40011             closed: {},
40012             rtree: new RBush(),
40013             strings: _strings,
40014             colors: _colors
40015           };
40016         },
40017         loadIssues(projection2) {
40018           let params = {
40019             // Tiles return a maximum # of issues
40020             // So we want to filter our request for only types iD supports
40021             item: _osmoseData.items
40022           };
40023           let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
40024           abortUnwantedRequests2(_cache2, tiles);
40025           tiles.forEach((tile) => {
40026             if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
40027             let [x2, y2, z2] = tile.xyz;
40028             let url = `${_osmoseUrlRoot}/issues/${z2}/${x2}/${y2}.geojson?` + utilQsString(params);
40029             let controller = new AbortController();
40030             _cache2.inflightTile[tile.id] = controller;
40031             json_default(url, { signal: controller.signal }).then((data) => {
40032               delete _cache2.inflightTile[tile.id];
40033               _cache2.loadedTile[tile.id] = true;
40034               if (data.features) {
40035                 data.features.forEach((issue) => {
40036                   const { item, class: cl, uuid: id2 } = issue.properties;
40037                   const itemType = `${item}-${cl}`;
40038                   if (itemType in _osmoseData.icons) {
40039                     let loc = issue.geometry.coordinates;
40040                     loc = preventCoincident(loc);
40041                     let d2 = new QAItem(loc, this, itemType, id2, { item });
40042                     if (item === 8300 || item === 8360) {
40043                       d2.elems = [];
40044                     }
40045                     _cache2.data[d2.id] = d2;
40046                     _cache2.rtree.insert(encodeIssueRtree2(d2));
40047                   }
40048                 });
40049               }
40050               dispatch3.call("loaded");
40051             }).catch(() => {
40052               delete _cache2.inflightTile[tile.id];
40053               _cache2.loadedTile[tile.id] = true;
40054             });
40055           });
40056         },
40057         loadIssueDetail(issue) {
40058           if (issue.elems !== void 0) {
40059             return Promise.resolve(issue);
40060           }
40061           const url = `${_osmoseUrlRoot}/issue/${issue.id}?langs=${_mainLocalizer.localeCode()}`;
40062           const cacheDetails = (data) => {
40063             issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
40064             issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
40065             this.replaceItem(issue);
40066           };
40067           return json_default(url).then(cacheDetails).then(() => issue);
40068         },
40069         loadStrings(locale3 = _mainLocalizer.localeCode()) {
40070           const items = Object.keys(_osmoseData.icons);
40071           if (locale3 in _cache2.strings && Object.keys(_cache2.strings[locale3]).length === items.length) {
40072             return Promise.resolve(_cache2.strings[locale3]);
40073           }
40074           if (!(locale3 in _cache2.strings)) {
40075             _cache2.strings[locale3] = {};
40076           }
40077           const allRequests = items.map((itemType) => {
40078             if (itemType in _cache2.strings[locale3]) return null;
40079             const cacheData = (data) => {
40080               const [cat = { items: [] }] = data.categories;
40081               const [item2 = { class: [] }] = cat.items;
40082               const [cl2 = null] = item2.class;
40083               if (!cl2) {
40084                 console.log(`Osmose strings request (${itemType}) had unexpected data`);
40085                 return;
40086               }
40087               const { item: itemInt, color: color2 } = item2;
40088               if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
40089                 _cache2.colors[itemInt] = color2;
40090               }
40091               const { title, detail, fix, trap } = cl2;
40092               let issueStrings = {};
40093               if (title) issueStrings.title = title.auto;
40094               if (detail) issueStrings.detail = marked(detail.auto);
40095               if (trap) issueStrings.trap = marked(trap.auto);
40096               if (fix) issueStrings.fix = marked(fix.auto);
40097               _cache2.strings[locale3][itemType] = issueStrings;
40098             };
40099             const [item, cl] = itemType.split("-");
40100             const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale3}`;
40101             return json_default(url).then(cacheData);
40102           }).filter(Boolean);
40103           return Promise.all(allRequests).then(() => _cache2.strings[locale3]);
40104         },
40105         getStrings(itemType, locale3 = _mainLocalizer.localeCode()) {
40106           return locale3 in _cache2.strings ? _cache2.strings[locale3][itemType] : {};
40107         },
40108         getColor(itemType) {
40109           return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
40110         },
40111         postUpdate(issue, callback) {
40112           if (_cache2.inflightPost[issue.id]) {
40113             return callback({ message: "Issue update already inflight", status: -2 }, issue);
40114           }
40115           const url = `${_osmoseUrlRoot}/issue/${issue.id}/${issue.newStatus}`;
40116           const controller = new AbortController();
40117           const after = () => {
40118             delete _cache2.inflightPost[issue.id];
40119             this.removeItem(issue);
40120             if (issue.newStatus === "done") {
40121               if (!(issue.item in _cache2.closed)) {
40122                 _cache2.closed[issue.item] = 0;
40123               }
40124               _cache2.closed[issue.item] += 1;
40125             }
40126             if (callback) callback(null, issue);
40127           };
40128           _cache2.inflightPost[issue.id] = controller;
40129           fetch(url, { signal: controller.signal }).then(after).catch((err) => {
40130             delete _cache2.inflightPost[issue.id];
40131             if (callback) callback(err.message);
40132           });
40133         },
40134         // Get all cached QAItems covering the viewport
40135         getItems(projection2) {
40136           const viewport = projection2.clipExtent();
40137           const min3 = [viewport[0][0], viewport[1][1]];
40138           const max3 = [viewport[1][0], viewport[0][1]];
40139           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
40140           return _cache2.rtree.search(bbox2).map((d2) => d2.data);
40141         },
40142         // Get a QAItem from cache
40143         // NOTE: Don't change method name until UI v3 is merged
40144         getError(id2) {
40145           return _cache2.data[id2];
40146         },
40147         // get the name of the icon to display for this item
40148         getIcon(itemType) {
40149           return _osmoseData.icons[itemType];
40150         },
40151         // Replace a single QAItem in the cache
40152         replaceItem(item) {
40153           if (!(item instanceof QAItem) || !item.id) return;
40154           _cache2.data[item.id] = item;
40155           updateRtree2(encodeIssueRtree2(item), true);
40156           return item;
40157         },
40158         // Remove a single QAItem from the cache
40159         removeItem(item) {
40160           if (!(item instanceof QAItem) || !item.id) return;
40161           delete _cache2.data[item.id];
40162           updateRtree2(encodeIssueRtree2(item), false);
40163         },
40164         // Used to populate `closed:osmose:*` changeset tags
40165         getClosedCounts() {
40166           return _cache2.closed;
40167         },
40168         itemURL(item) {
40169           return `https://osmose.openstreetmap.fr/en/error/${item.id}`;
40170         }
40171       };
40172     }
40173   });
40174
40175   // node_modules/pbf/index.js
40176   function readVarintRemainder(l2, s2, p2) {
40177     const buf = p2.buf;
40178     let h2, b2;
40179     b2 = buf[p2.pos++];
40180     h2 = (b2 & 112) >> 4;
40181     if (b2 < 128) return toNum(l2, h2, s2);
40182     b2 = buf[p2.pos++];
40183     h2 |= (b2 & 127) << 3;
40184     if (b2 < 128) return toNum(l2, h2, s2);
40185     b2 = buf[p2.pos++];
40186     h2 |= (b2 & 127) << 10;
40187     if (b2 < 128) return toNum(l2, h2, s2);
40188     b2 = buf[p2.pos++];
40189     h2 |= (b2 & 127) << 17;
40190     if (b2 < 128) return toNum(l2, h2, s2);
40191     b2 = buf[p2.pos++];
40192     h2 |= (b2 & 127) << 24;
40193     if (b2 < 128) return toNum(l2, h2, s2);
40194     b2 = buf[p2.pos++];
40195     h2 |= (b2 & 1) << 31;
40196     if (b2 < 128) return toNum(l2, h2, s2);
40197     throw new Error("Expected varint not more than 10 bytes");
40198   }
40199   function toNum(low, high, isSigned) {
40200     return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
40201   }
40202   function writeBigVarint(val, pbf) {
40203     let low, high;
40204     if (val >= 0) {
40205       low = val % 4294967296 | 0;
40206       high = val / 4294967296 | 0;
40207     } else {
40208       low = ~(-val % 4294967296);
40209       high = ~(-val / 4294967296);
40210       if (low ^ 4294967295) {
40211         low = low + 1 | 0;
40212       } else {
40213         low = 0;
40214         high = high + 1 | 0;
40215       }
40216     }
40217     if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
40218       throw new Error("Given varint doesn't fit into 10 bytes");
40219     }
40220     pbf.realloc(10);
40221     writeBigVarintLow(low, high, pbf);
40222     writeBigVarintHigh(high, pbf);
40223   }
40224   function writeBigVarintLow(low, high, pbf) {
40225     pbf.buf[pbf.pos++] = low & 127 | 128;
40226     low >>>= 7;
40227     pbf.buf[pbf.pos++] = low & 127 | 128;
40228     low >>>= 7;
40229     pbf.buf[pbf.pos++] = low & 127 | 128;
40230     low >>>= 7;
40231     pbf.buf[pbf.pos++] = low & 127 | 128;
40232     low >>>= 7;
40233     pbf.buf[pbf.pos] = low & 127;
40234   }
40235   function writeBigVarintHigh(high, pbf) {
40236     const lsb = (high & 7) << 4;
40237     pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
40238     if (!high) return;
40239     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40240     if (!high) return;
40241     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40242     if (!high) return;
40243     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40244     if (!high) return;
40245     pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40246     if (!high) return;
40247     pbf.buf[pbf.pos++] = high & 127;
40248   }
40249   function makeRoomForExtraLength(startPos, len, pbf) {
40250     const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
40251     pbf.realloc(extraLen);
40252     for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
40253   }
40254   function writePackedVarint(arr, pbf) {
40255     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
40256   }
40257   function writePackedSVarint(arr, pbf) {
40258     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
40259   }
40260   function writePackedFloat(arr, pbf) {
40261     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
40262   }
40263   function writePackedDouble(arr, pbf) {
40264     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
40265   }
40266   function writePackedBoolean(arr, pbf) {
40267     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
40268   }
40269   function writePackedFixed32(arr, pbf) {
40270     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
40271   }
40272   function writePackedSFixed32(arr, pbf) {
40273     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
40274   }
40275   function writePackedFixed64(arr, pbf) {
40276     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
40277   }
40278   function writePackedSFixed64(arr, pbf) {
40279     for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
40280   }
40281   function readUtf8(buf, pos, end) {
40282     let str = "";
40283     let i3 = pos;
40284     while (i3 < end) {
40285       const b0 = buf[i3];
40286       let c2 = null;
40287       let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
40288       if (i3 + bytesPerSequence > end) break;
40289       let b1, b2, b3;
40290       if (bytesPerSequence === 1) {
40291         if (b0 < 128) {
40292           c2 = b0;
40293         }
40294       } else if (bytesPerSequence === 2) {
40295         b1 = buf[i3 + 1];
40296         if ((b1 & 192) === 128) {
40297           c2 = (b0 & 31) << 6 | b1 & 63;
40298           if (c2 <= 127) {
40299             c2 = null;
40300           }
40301         }
40302       } else if (bytesPerSequence === 3) {
40303         b1 = buf[i3 + 1];
40304         b2 = buf[i3 + 2];
40305         if ((b1 & 192) === 128 && (b2 & 192) === 128) {
40306           c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
40307           if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
40308             c2 = null;
40309           }
40310         }
40311       } else if (bytesPerSequence === 4) {
40312         b1 = buf[i3 + 1];
40313         b2 = buf[i3 + 2];
40314         b3 = buf[i3 + 3];
40315         if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
40316           c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
40317           if (c2 <= 65535 || c2 >= 1114112) {
40318             c2 = null;
40319           }
40320         }
40321       }
40322       if (c2 === null) {
40323         c2 = 65533;
40324         bytesPerSequence = 1;
40325       } else if (c2 > 65535) {
40326         c2 -= 65536;
40327         str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
40328         c2 = 56320 | c2 & 1023;
40329       }
40330       str += String.fromCharCode(c2);
40331       i3 += bytesPerSequence;
40332     }
40333     return str;
40334   }
40335   function writeUtf8(buf, str, pos) {
40336     for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
40337       c2 = str.charCodeAt(i3);
40338       if (c2 > 55295 && c2 < 57344) {
40339         if (lead) {
40340           if (c2 < 56320) {
40341             buf[pos++] = 239;
40342             buf[pos++] = 191;
40343             buf[pos++] = 189;
40344             lead = c2;
40345             continue;
40346           } else {
40347             c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
40348             lead = null;
40349           }
40350         } else {
40351           if (c2 > 56319 || i3 + 1 === str.length) {
40352             buf[pos++] = 239;
40353             buf[pos++] = 191;
40354             buf[pos++] = 189;
40355           } else {
40356             lead = c2;
40357           }
40358           continue;
40359         }
40360       } else if (lead) {
40361         buf[pos++] = 239;
40362         buf[pos++] = 191;
40363         buf[pos++] = 189;
40364         lead = null;
40365       }
40366       if (c2 < 128) {
40367         buf[pos++] = c2;
40368       } else {
40369         if (c2 < 2048) {
40370           buf[pos++] = c2 >> 6 | 192;
40371         } else {
40372           if (c2 < 65536) {
40373             buf[pos++] = c2 >> 12 | 224;
40374           } else {
40375             buf[pos++] = c2 >> 18 | 240;
40376             buf[pos++] = c2 >> 12 & 63 | 128;
40377           }
40378           buf[pos++] = c2 >> 6 & 63 | 128;
40379         }
40380         buf[pos++] = c2 & 63 | 128;
40381       }
40382     }
40383     return pos;
40384   }
40385   var SHIFT_LEFT_32, SHIFT_RIGHT_32, TEXT_DECODER_MIN_LENGTH, utf8TextDecoder, PBF_VARINT, PBF_FIXED64, PBF_BYTES, PBF_FIXED32, Pbf;
40386   var init_pbf = __esm({
40387     "node_modules/pbf/index.js"() {
40388       SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
40389       SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
40390       TEXT_DECODER_MIN_LENGTH = 12;
40391       utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
40392       PBF_VARINT = 0;
40393       PBF_FIXED64 = 1;
40394       PBF_BYTES = 2;
40395       PBF_FIXED32 = 5;
40396       Pbf = class {
40397         /**
40398          * @param {Uint8Array | ArrayBuffer} [buf]
40399          */
40400         constructor(buf = new Uint8Array(16)) {
40401           this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
40402           this.dataView = new DataView(this.buf.buffer);
40403           this.pos = 0;
40404           this.type = 0;
40405           this.length = this.buf.length;
40406         }
40407         // === READING =================================================================
40408         /**
40409          * @template T
40410          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
40411          * @param {T} result
40412          * @param {number} [end]
40413          */
40414         readFields(readField, result, end = this.length) {
40415           while (this.pos < end) {
40416             const val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
40417             this.type = val & 7;
40418             readField(tag2, result, this);
40419             if (this.pos === startPos) this.skip(val);
40420           }
40421           return result;
40422         }
40423         /**
40424          * @template T
40425          * @param {(tag: number, result: T, pbf: Pbf) => void} readField
40426          * @param {T} result
40427          */
40428         readMessage(readField, result) {
40429           return this.readFields(readField, result, this.readVarint() + this.pos);
40430         }
40431         readFixed32() {
40432           const val = this.dataView.getUint32(this.pos, true);
40433           this.pos += 4;
40434           return val;
40435         }
40436         readSFixed32() {
40437           const val = this.dataView.getInt32(this.pos, true);
40438           this.pos += 4;
40439           return val;
40440         }
40441         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
40442         readFixed64() {
40443           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
40444           this.pos += 8;
40445           return val;
40446         }
40447         readSFixed64() {
40448           const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
40449           this.pos += 8;
40450           return val;
40451         }
40452         readFloat() {
40453           const val = this.dataView.getFloat32(this.pos, true);
40454           this.pos += 4;
40455           return val;
40456         }
40457         readDouble() {
40458           const val = this.dataView.getFloat64(this.pos, true);
40459           this.pos += 8;
40460           return val;
40461         }
40462         /**
40463          * @param {boolean} [isSigned]
40464          */
40465         readVarint(isSigned) {
40466           const buf = this.buf;
40467           let val, b2;
40468           b2 = buf[this.pos++];
40469           val = b2 & 127;
40470           if (b2 < 128) return val;
40471           b2 = buf[this.pos++];
40472           val |= (b2 & 127) << 7;
40473           if (b2 < 128) return val;
40474           b2 = buf[this.pos++];
40475           val |= (b2 & 127) << 14;
40476           if (b2 < 128) return val;
40477           b2 = buf[this.pos++];
40478           val |= (b2 & 127) << 21;
40479           if (b2 < 128) return val;
40480           b2 = buf[this.pos];
40481           val |= (b2 & 15) << 28;
40482           return readVarintRemainder(val, isSigned, this);
40483         }
40484         readVarint64() {
40485           return this.readVarint(true);
40486         }
40487         readSVarint() {
40488           const num = this.readVarint();
40489           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
40490         }
40491         readBoolean() {
40492           return Boolean(this.readVarint());
40493         }
40494         readString() {
40495           const end = this.readVarint() + this.pos;
40496           const pos = this.pos;
40497           this.pos = end;
40498           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
40499             return utf8TextDecoder.decode(this.buf.subarray(pos, end));
40500           }
40501           return readUtf8(this.buf, pos, end);
40502         }
40503         readBytes() {
40504           const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
40505           this.pos = end;
40506           return buffer;
40507         }
40508         // verbose for performance reasons; doesn't affect gzipped size
40509         /**
40510          * @param {number[]} [arr]
40511          * @param {boolean} [isSigned]
40512          */
40513         readPackedVarint(arr = [], isSigned) {
40514           const end = this.readPackedEnd();
40515           while (this.pos < end) arr.push(this.readVarint(isSigned));
40516           return arr;
40517         }
40518         /** @param {number[]} [arr] */
40519         readPackedSVarint(arr = []) {
40520           const end = this.readPackedEnd();
40521           while (this.pos < end) arr.push(this.readSVarint());
40522           return arr;
40523         }
40524         /** @param {boolean[]} [arr] */
40525         readPackedBoolean(arr = []) {
40526           const end = this.readPackedEnd();
40527           while (this.pos < end) arr.push(this.readBoolean());
40528           return arr;
40529         }
40530         /** @param {number[]} [arr] */
40531         readPackedFloat(arr = []) {
40532           const end = this.readPackedEnd();
40533           while (this.pos < end) arr.push(this.readFloat());
40534           return arr;
40535         }
40536         /** @param {number[]} [arr] */
40537         readPackedDouble(arr = []) {
40538           const end = this.readPackedEnd();
40539           while (this.pos < end) arr.push(this.readDouble());
40540           return arr;
40541         }
40542         /** @param {number[]} [arr] */
40543         readPackedFixed32(arr = []) {
40544           const end = this.readPackedEnd();
40545           while (this.pos < end) arr.push(this.readFixed32());
40546           return arr;
40547         }
40548         /** @param {number[]} [arr] */
40549         readPackedSFixed32(arr = []) {
40550           const end = this.readPackedEnd();
40551           while (this.pos < end) arr.push(this.readSFixed32());
40552           return arr;
40553         }
40554         /** @param {number[]} [arr] */
40555         readPackedFixed64(arr = []) {
40556           const end = this.readPackedEnd();
40557           while (this.pos < end) arr.push(this.readFixed64());
40558           return arr;
40559         }
40560         /** @param {number[]} [arr] */
40561         readPackedSFixed64(arr = []) {
40562           const end = this.readPackedEnd();
40563           while (this.pos < end) arr.push(this.readSFixed64());
40564           return arr;
40565         }
40566         readPackedEnd() {
40567           return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
40568         }
40569         /** @param {number} val */
40570         skip(val) {
40571           const type2 = val & 7;
40572           if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
40573           }
40574           else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
40575           else if (type2 === PBF_FIXED32) this.pos += 4;
40576           else if (type2 === PBF_FIXED64) this.pos += 8;
40577           else throw new Error(`Unimplemented type: ${type2}`);
40578         }
40579         // === WRITING =================================================================
40580         /**
40581          * @param {number} tag
40582          * @param {number} type
40583          */
40584         writeTag(tag2, type2) {
40585           this.writeVarint(tag2 << 3 | type2);
40586         }
40587         /** @param {number} min */
40588         realloc(min3) {
40589           let length2 = this.length || 16;
40590           while (length2 < this.pos + min3) length2 *= 2;
40591           if (length2 !== this.length) {
40592             const buf = new Uint8Array(length2);
40593             buf.set(this.buf);
40594             this.buf = buf;
40595             this.dataView = new DataView(buf.buffer);
40596             this.length = length2;
40597           }
40598         }
40599         finish() {
40600           this.length = this.pos;
40601           this.pos = 0;
40602           return this.buf.subarray(0, this.length);
40603         }
40604         /** @param {number} val */
40605         writeFixed32(val) {
40606           this.realloc(4);
40607           this.dataView.setInt32(this.pos, val, true);
40608           this.pos += 4;
40609         }
40610         /** @param {number} val */
40611         writeSFixed32(val) {
40612           this.realloc(4);
40613           this.dataView.setInt32(this.pos, val, true);
40614           this.pos += 4;
40615         }
40616         /** @param {number} val */
40617         writeFixed64(val) {
40618           this.realloc(8);
40619           this.dataView.setInt32(this.pos, val & -1, true);
40620           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
40621           this.pos += 8;
40622         }
40623         /** @param {number} val */
40624         writeSFixed64(val) {
40625           this.realloc(8);
40626           this.dataView.setInt32(this.pos, val & -1, true);
40627           this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
40628           this.pos += 8;
40629         }
40630         /** @param {number} val */
40631         writeVarint(val) {
40632           val = +val || 0;
40633           if (val > 268435455 || val < 0) {
40634             writeBigVarint(val, this);
40635             return;
40636           }
40637           this.realloc(4);
40638           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
40639           if (val <= 127) return;
40640           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
40641           if (val <= 127) return;
40642           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
40643           if (val <= 127) return;
40644           this.buf[this.pos++] = val >>> 7 & 127;
40645         }
40646         /** @param {number} val */
40647         writeSVarint(val) {
40648           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
40649         }
40650         /** @param {boolean} val */
40651         writeBoolean(val) {
40652           this.writeVarint(+val);
40653         }
40654         /** @param {string} str */
40655         writeString(str) {
40656           str = String(str);
40657           this.realloc(str.length * 4);
40658           this.pos++;
40659           const startPos = this.pos;
40660           this.pos = writeUtf8(this.buf, str, this.pos);
40661           const len = this.pos - startPos;
40662           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
40663           this.pos = startPos - 1;
40664           this.writeVarint(len);
40665           this.pos += len;
40666         }
40667         /** @param {number} val */
40668         writeFloat(val) {
40669           this.realloc(4);
40670           this.dataView.setFloat32(this.pos, val, true);
40671           this.pos += 4;
40672         }
40673         /** @param {number} val */
40674         writeDouble(val) {
40675           this.realloc(8);
40676           this.dataView.setFloat64(this.pos, val, true);
40677           this.pos += 8;
40678         }
40679         /** @param {Uint8Array} buffer */
40680         writeBytes(buffer) {
40681           const len = buffer.length;
40682           this.writeVarint(len);
40683           this.realloc(len);
40684           for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
40685         }
40686         /**
40687          * @template T
40688          * @param {(obj: T, pbf: Pbf) => void} fn
40689          * @param {T} obj
40690          */
40691         writeRawMessage(fn, obj) {
40692           this.pos++;
40693           const startPos = this.pos;
40694           fn(obj, this);
40695           const len = this.pos - startPos;
40696           if (len >= 128) makeRoomForExtraLength(startPos, len, this);
40697           this.pos = startPos - 1;
40698           this.writeVarint(len);
40699           this.pos += len;
40700         }
40701         /**
40702          * @template T
40703          * @param {number} tag
40704          * @param {(obj: T, pbf: Pbf) => void} fn
40705          * @param {T} obj
40706          */
40707         writeMessage(tag2, fn, obj) {
40708           this.writeTag(tag2, PBF_BYTES);
40709           this.writeRawMessage(fn, obj);
40710         }
40711         /**
40712          * @param {number} tag
40713          * @param {number[]} arr
40714          */
40715         writePackedVarint(tag2, arr) {
40716           if (arr.length) this.writeMessage(tag2, writePackedVarint, arr);
40717         }
40718         /**
40719          * @param {number} tag
40720          * @param {number[]} arr
40721          */
40722         writePackedSVarint(tag2, arr) {
40723           if (arr.length) this.writeMessage(tag2, writePackedSVarint, arr);
40724         }
40725         /**
40726          * @param {number} tag
40727          * @param {boolean[]} arr
40728          */
40729         writePackedBoolean(tag2, arr) {
40730           if (arr.length) this.writeMessage(tag2, writePackedBoolean, arr);
40731         }
40732         /**
40733          * @param {number} tag
40734          * @param {number[]} arr
40735          */
40736         writePackedFloat(tag2, arr) {
40737           if (arr.length) this.writeMessage(tag2, writePackedFloat, arr);
40738         }
40739         /**
40740          * @param {number} tag
40741          * @param {number[]} arr
40742          */
40743         writePackedDouble(tag2, arr) {
40744           if (arr.length) this.writeMessage(tag2, writePackedDouble, arr);
40745         }
40746         /**
40747          * @param {number} tag
40748          * @param {number[]} arr
40749          */
40750         writePackedFixed32(tag2, arr) {
40751           if (arr.length) this.writeMessage(tag2, writePackedFixed32, arr);
40752         }
40753         /**
40754          * @param {number} tag
40755          * @param {number[]} arr
40756          */
40757         writePackedSFixed32(tag2, arr) {
40758           if (arr.length) this.writeMessage(tag2, writePackedSFixed32, arr);
40759         }
40760         /**
40761          * @param {number} tag
40762          * @param {number[]} arr
40763          */
40764         writePackedFixed64(tag2, arr) {
40765           if (arr.length) this.writeMessage(tag2, writePackedFixed64, arr);
40766         }
40767         /**
40768          * @param {number} tag
40769          * @param {number[]} arr
40770          */
40771         writePackedSFixed64(tag2, arr) {
40772           if (arr.length) this.writeMessage(tag2, writePackedSFixed64, arr);
40773         }
40774         /**
40775          * @param {number} tag
40776          * @param {Uint8Array} buffer
40777          */
40778         writeBytesField(tag2, buffer) {
40779           this.writeTag(tag2, PBF_BYTES);
40780           this.writeBytes(buffer);
40781         }
40782         /**
40783          * @param {number} tag
40784          * @param {number} val
40785          */
40786         writeFixed32Field(tag2, val) {
40787           this.writeTag(tag2, PBF_FIXED32);
40788           this.writeFixed32(val);
40789         }
40790         /**
40791          * @param {number} tag
40792          * @param {number} val
40793          */
40794         writeSFixed32Field(tag2, val) {
40795           this.writeTag(tag2, PBF_FIXED32);
40796           this.writeSFixed32(val);
40797         }
40798         /**
40799          * @param {number} tag
40800          * @param {number} val
40801          */
40802         writeFixed64Field(tag2, val) {
40803           this.writeTag(tag2, PBF_FIXED64);
40804           this.writeFixed64(val);
40805         }
40806         /**
40807          * @param {number} tag
40808          * @param {number} val
40809          */
40810         writeSFixed64Field(tag2, val) {
40811           this.writeTag(tag2, PBF_FIXED64);
40812           this.writeSFixed64(val);
40813         }
40814         /**
40815          * @param {number} tag
40816          * @param {number} val
40817          */
40818         writeVarintField(tag2, val) {
40819           this.writeTag(tag2, PBF_VARINT);
40820           this.writeVarint(val);
40821         }
40822         /**
40823          * @param {number} tag
40824          * @param {number} val
40825          */
40826         writeSVarintField(tag2, val) {
40827           this.writeTag(tag2, PBF_VARINT);
40828           this.writeSVarint(val);
40829         }
40830         /**
40831          * @param {number} tag
40832          * @param {string} str
40833          */
40834         writeStringField(tag2, str) {
40835           this.writeTag(tag2, PBF_BYTES);
40836           this.writeString(str);
40837         }
40838         /**
40839          * @param {number} tag
40840          * @param {number} val
40841          */
40842         writeFloatField(tag2, val) {
40843           this.writeTag(tag2, PBF_FIXED32);
40844           this.writeFloat(val);
40845         }
40846         /**
40847          * @param {number} tag
40848          * @param {number} val
40849          */
40850         writeDoubleField(tag2, val) {
40851           this.writeTag(tag2, PBF_FIXED64);
40852           this.writeDouble(val);
40853         }
40854         /**
40855          * @param {number} tag
40856          * @param {boolean} val
40857          */
40858         writeBooleanField(tag2, val) {
40859           this.writeVarintField(tag2, +val);
40860         }
40861       };
40862     }
40863   });
40864
40865   // node_modules/@mapbox/point-geometry/index.js
40866   function Point(x2, y2) {
40867     this.x = x2;
40868     this.y = y2;
40869   }
40870   var init_point_geometry = __esm({
40871     "node_modules/@mapbox/point-geometry/index.js"() {
40872       Point.prototype = {
40873         /**
40874          * Clone this point, returning a new point that can be modified
40875          * without affecting the old one.
40876          * @return {Point} the clone
40877          */
40878         clone() {
40879           return new Point(this.x, this.y);
40880         },
40881         /**
40882          * Add this point's x & y coordinates to another point,
40883          * yielding a new point.
40884          * @param {Point} p the other point
40885          * @return {Point} output point
40886          */
40887         add(p2) {
40888           return this.clone()._add(p2);
40889         },
40890         /**
40891          * Subtract this point's x & y coordinates to from point,
40892          * yielding a new point.
40893          * @param {Point} p the other point
40894          * @return {Point} output point
40895          */
40896         sub(p2) {
40897           return this.clone()._sub(p2);
40898         },
40899         /**
40900          * Multiply this point's x & y coordinates by point,
40901          * yielding a new point.
40902          * @param {Point} p the other point
40903          * @return {Point} output point
40904          */
40905         multByPoint(p2) {
40906           return this.clone()._multByPoint(p2);
40907         },
40908         /**
40909          * Divide this point's x & y coordinates by point,
40910          * yielding a new point.
40911          * @param {Point} p the other point
40912          * @return {Point} output point
40913          */
40914         divByPoint(p2) {
40915           return this.clone()._divByPoint(p2);
40916         },
40917         /**
40918          * Multiply this point's x & y coordinates by a factor,
40919          * yielding a new point.
40920          * @param {number} k factor
40921          * @return {Point} output point
40922          */
40923         mult(k2) {
40924           return this.clone()._mult(k2);
40925         },
40926         /**
40927          * Divide this point's x & y coordinates by a factor,
40928          * yielding a new point.
40929          * @param {number} k factor
40930          * @return {Point} output point
40931          */
40932         div(k2) {
40933           return this.clone()._div(k2);
40934         },
40935         /**
40936          * Rotate this point around the 0, 0 origin by an angle a,
40937          * given in radians
40938          * @param {number} a angle to rotate around, in radians
40939          * @return {Point} output point
40940          */
40941         rotate(a2) {
40942           return this.clone()._rotate(a2);
40943         },
40944         /**
40945          * Rotate this point around p point by an angle a,
40946          * given in radians
40947          * @param {number} a angle to rotate around, in radians
40948          * @param {Point} p Point to rotate around
40949          * @return {Point} output point
40950          */
40951         rotateAround(a2, p2) {
40952           return this.clone()._rotateAround(a2, p2);
40953         },
40954         /**
40955          * Multiply this point by a 4x1 transformation matrix
40956          * @param {[number, number, number, number]} m transformation matrix
40957          * @return {Point} output point
40958          */
40959         matMult(m2) {
40960           return this.clone()._matMult(m2);
40961         },
40962         /**
40963          * Calculate this point but as a unit vector from 0, 0, meaning
40964          * that the distance from the resulting point to the 0, 0
40965          * coordinate will be equal to 1 and the angle from the resulting
40966          * point to the 0, 0 coordinate will be the same as before.
40967          * @return {Point} unit vector point
40968          */
40969         unit() {
40970           return this.clone()._unit();
40971         },
40972         /**
40973          * Compute a perpendicular point, where the new y coordinate
40974          * is the old x coordinate and the new x coordinate is the old y
40975          * coordinate multiplied by -1
40976          * @return {Point} perpendicular point
40977          */
40978         perp() {
40979           return this.clone()._perp();
40980         },
40981         /**
40982          * Return a version of this point with the x & y coordinates
40983          * rounded to integers.
40984          * @return {Point} rounded point
40985          */
40986         round() {
40987           return this.clone()._round();
40988         },
40989         /**
40990          * Return the magnitude of this point: this is the Euclidean
40991          * distance from the 0, 0 coordinate to this point's x and y
40992          * coordinates.
40993          * @return {number} magnitude
40994          */
40995         mag() {
40996           return Math.sqrt(this.x * this.x + this.y * this.y);
40997         },
40998         /**
40999          * Judge whether this point is equal to another point, returning
41000          * true or false.
41001          * @param {Point} other the other point
41002          * @return {boolean} whether the points are equal
41003          */
41004         equals(other2) {
41005           return this.x === other2.x && this.y === other2.y;
41006         },
41007         /**
41008          * Calculate the distance from this point to another point
41009          * @param {Point} p the other point
41010          * @return {number} distance
41011          */
41012         dist(p2) {
41013           return Math.sqrt(this.distSqr(p2));
41014         },
41015         /**
41016          * Calculate the distance from this point to another point,
41017          * without the square root step. Useful if you're comparing
41018          * relative distances.
41019          * @param {Point} p the other point
41020          * @return {number} distance
41021          */
41022         distSqr(p2) {
41023           const dx = p2.x - this.x, dy = p2.y - this.y;
41024           return dx * dx + dy * dy;
41025         },
41026         /**
41027          * Get the angle from the 0, 0 coordinate to this point, in radians
41028          * coordinates.
41029          * @return {number} angle
41030          */
41031         angle() {
41032           return Math.atan2(this.y, this.x);
41033         },
41034         /**
41035          * Get the angle from this point to another point, in radians
41036          * @param {Point} b the other point
41037          * @return {number} angle
41038          */
41039         angleTo(b2) {
41040           return Math.atan2(this.y - b2.y, this.x - b2.x);
41041         },
41042         /**
41043          * Get the angle between this point and another point, in radians
41044          * @param {Point} b the other point
41045          * @return {number} angle
41046          */
41047         angleWith(b2) {
41048           return this.angleWithSep(b2.x, b2.y);
41049         },
41050         /**
41051          * Find the angle of the two vectors, solving the formula for
41052          * the cross product a x b = |a||b|sin(θ) for θ.
41053          * @param {number} x the x-coordinate
41054          * @param {number} y the y-coordinate
41055          * @return {number} the angle in radians
41056          */
41057         angleWithSep(x2, y2) {
41058           return Math.atan2(
41059             this.x * y2 - this.y * x2,
41060             this.x * x2 + this.y * y2
41061           );
41062         },
41063         /** @param {[number, number, number, number]} m */
41064         _matMult(m2) {
41065           const x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
41066           this.x = x2;
41067           this.y = y2;
41068           return this;
41069         },
41070         /** @param {Point} p */
41071         _add(p2) {
41072           this.x += p2.x;
41073           this.y += p2.y;
41074           return this;
41075         },
41076         /** @param {Point} p */
41077         _sub(p2) {
41078           this.x -= p2.x;
41079           this.y -= p2.y;
41080           return this;
41081         },
41082         /** @param {number} k */
41083         _mult(k2) {
41084           this.x *= k2;
41085           this.y *= k2;
41086           return this;
41087         },
41088         /** @param {number} k */
41089         _div(k2) {
41090           this.x /= k2;
41091           this.y /= k2;
41092           return this;
41093         },
41094         /** @param {Point} p */
41095         _multByPoint(p2) {
41096           this.x *= p2.x;
41097           this.y *= p2.y;
41098           return this;
41099         },
41100         /** @param {Point} p */
41101         _divByPoint(p2) {
41102           this.x /= p2.x;
41103           this.y /= p2.y;
41104           return this;
41105         },
41106         _unit() {
41107           this._div(this.mag());
41108           return this;
41109         },
41110         _perp() {
41111           const y2 = this.y;
41112           this.y = this.x;
41113           this.x = -y2;
41114           return this;
41115         },
41116         /** @param {number} angle */
41117         _rotate(angle2) {
41118           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
41119           this.x = x2;
41120           this.y = y2;
41121           return this;
41122         },
41123         /**
41124          * @param {number} angle
41125          * @param {Point} p
41126          */
41127         _rotateAround(angle2, p2) {
41128           const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
41129           this.x = x2;
41130           this.y = y2;
41131           return this;
41132         },
41133         _round() {
41134           this.x = Math.round(this.x);
41135           this.y = Math.round(this.y);
41136           return this;
41137         },
41138         constructor: Point
41139       };
41140       Point.convert = function(p2) {
41141         if (p2 instanceof Point) {
41142           return (
41143             /** @type {Point} */
41144             p2
41145           );
41146         }
41147         if (Array.isArray(p2)) {
41148           return new Point(+p2[0], +p2[1]);
41149         }
41150         if (p2.x !== void 0 && p2.y !== void 0) {
41151           return new Point(+p2.x, +p2.y);
41152         }
41153         throw new Error("Expected [x, y] or {x, y} point format");
41154       };
41155     }
41156   });
41157
41158   // node_modules/@mapbox/vector-tile/index.js
41159   function readFeature(tag2, feature3, pbf) {
41160     if (tag2 === 1) feature3.id = pbf.readVarint();
41161     else if (tag2 === 2) readTag(pbf, feature3);
41162     else if (tag2 === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
41163     pbf.readVarint();
41164     else if (tag2 === 4) feature3._geometry = pbf.pos;
41165   }
41166   function readTag(pbf, feature3) {
41167     const end = pbf.readVarint() + pbf.pos;
41168     while (pbf.pos < end) {
41169       const key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
41170       feature3.properties[key] = value;
41171     }
41172   }
41173   function classifyRings(rings) {
41174     const len = rings.length;
41175     if (len <= 1) return [rings];
41176     const polygons = [];
41177     let polygon2, ccw;
41178     for (let i3 = 0; i3 < len; i3++) {
41179       const area = signedArea(rings[i3]);
41180       if (area === 0) continue;
41181       if (ccw === void 0) ccw = area < 0;
41182       if (ccw === area < 0) {
41183         if (polygon2) polygons.push(polygon2);
41184         polygon2 = [rings[i3]];
41185       } else if (polygon2) {
41186         polygon2.push(rings[i3]);
41187       }
41188     }
41189     if (polygon2) polygons.push(polygon2);
41190     return polygons;
41191   }
41192   function signedArea(ring) {
41193     let sum = 0;
41194     for (let i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
41195       p1 = ring[i3];
41196       p2 = ring[j2];
41197       sum += (p2.x - p1.x) * (p1.y + p2.y);
41198     }
41199     return sum;
41200   }
41201   function readLayer(tag2, layer, pbf) {
41202     if (tag2 === 15) layer.version = pbf.readVarint();
41203     else if (tag2 === 1) layer.name = pbf.readString();
41204     else if (tag2 === 5) layer.extent = pbf.readVarint();
41205     else if (tag2 === 2) layer._features.push(pbf.pos);
41206     else if (tag2 === 3) layer._keys.push(pbf.readString());
41207     else if (tag2 === 4) layer._values.push(readValueMessage(pbf));
41208   }
41209   function readValueMessage(pbf) {
41210     let value = null;
41211     const end = pbf.readVarint() + pbf.pos;
41212     while (pbf.pos < end) {
41213       const tag2 = pbf.readVarint() >> 3;
41214       value = tag2 === 1 ? pbf.readString() : tag2 === 2 ? pbf.readFloat() : tag2 === 3 ? pbf.readDouble() : tag2 === 4 ? pbf.readVarint64() : tag2 === 5 ? pbf.readVarint() : tag2 === 6 ? pbf.readSVarint() : tag2 === 7 ? pbf.readBoolean() : null;
41215     }
41216     return value;
41217   }
41218   function readTile(tag2, layers, pbf) {
41219     if (tag2 === 3) {
41220       const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
41221       if (layer.length) layers[layer.name] = layer;
41222     }
41223   }
41224   var VectorTileFeature, VectorTileLayer, VectorTile;
41225   var init_vector_tile = __esm({
41226     "node_modules/@mapbox/vector-tile/index.js"() {
41227       init_point_geometry();
41228       VectorTileFeature = class {
41229         /**
41230          * @param {Pbf} pbf
41231          * @param {number} end
41232          * @param {number} extent
41233          * @param {string[]} keys
41234          * @param {unknown[]} values
41235          */
41236         constructor(pbf, end, extent, keys2, values) {
41237           this.properties = {};
41238           this.extent = extent;
41239           this.type = 0;
41240           this.id = void 0;
41241           this._pbf = pbf;
41242           this._geometry = -1;
41243           this._keys = keys2;
41244           this._values = values;
41245           pbf.readFields(readFeature, this, end);
41246         }
41247         loadGeometry() {
41248           const pbf = this._pbf;
41249           pbf.pos = this._geometry;
41250           const end = pbf.readVarint() + pbf.pos;
41251           const lines = [];
41252           let line;
41253           let cmd = 1;
41254           let length2 = 0;
41255           let x2 = 0;
41256           let y2 = 0;
41257           while (pbf.pos < end) {
41258             if (length2 <= 0) {
41259               const cmdLen = pbf.readVarint();
41260               cmd = cmdLen & 7;
41261               length2 = cmdLen >> 3;
41262             }
41263             length2--;
41264             if (cmd === 1 || cmd === 2) {
41265               x2 += pbf.readSVarint();
41266               y2 += pbf.readSVarint();
41267               if (cmd === 1) {
41268                 if (line) lines.push(line);
41269                 line = [];
41270               }
41271               if (line) line.push(new Point(x2, y2));
41272             } else if (cmd === 7) {
41273               if (line) {
41274                 line.push(line[0].clone());
41275               }
41276             } else {
41277               throw new Error(`unknown command ${cmd}`);
41278             }
41279           }
41280           if (line) lines.push(line);
41281           return lines;
41282         }
41283         bbox() {
41284           const pbf = this._pbf;
41285           pbf.pos = this._geometry;
41286           const end = pbf.readVarint() + pbf.pos;
41287           let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
41288           while (pbf.pos < end) {
41289             if (length2 <= 0) {
41290               const cmdLen = pbf.readVarint();
41291               cmd = cmdLen & 7;
41292               length2 = cmdLen >> 3;
41293             }
41294             length2--;
41295             if (cmd === 1 || cmd === 2) {
41296               x2 += pbf.readSVarint();
41297               y2 += pbf.readSVarint();
41298               if (x2 < x12) x12 = x2;
41299               if (x2 > x22) x22 = x2;
41300               if (y2 < y12) y12 = y2;
41301               if (y2 > y22) y22 = y2;
41302             } else if (cmd !== 7) {
41303               throw new Error(`unknown command ${cmd}`);
41304             }
41305           }
41306           return [x12, y12, x22, y22];
41307         }
41308         /**
41309          * @param {number} x
41310          * @param {number} y
41311          * @param {number} z
41312          * @return {Feature}
41313          */
41314         toGeoJSON(x2, y2, z2) {
41315           const size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
41316           function projectPoint(p2) {
41317             return [
41318               (p2.x + x05) * 360 / size - 180,
41319               360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
41320             ];
41321           }
41322           function projectLine(line) {
41323             return line.map(projectPoint);
41324           }
41325           let geometry;
41326           if (this.type === 1) {
41327             const points = [];
41328             for (const line of vtCoords) {
41329               points.push(line[0]);
41330             }
41331             const coordinates = projectLine(points);
41332             geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
41333           } else if (this.type === 2) {
41334             const coordinates = vtCoords.map(projectLine);
41335             geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
41336           } else if (this.type === 3) {
41337             const polygons = classifyRings(vtCoords);
41338             const coordinates = [];
41339             for (const polygon2 of polygons) {
41340               coordinates.push(polygon2.map(projectLine));
41341             }
41342             geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
41343           } else {
41344             throw new Error("unknown feature type");
41345           }
41346           const result = {
41347             type: "Feature",
41348             geometry,
41349             properties: this.properties
41350           };
41351           if (this.id != null) {
41352             result.id = this.id;
41353           }
41354           return result;
41355         }
41356       };
41357       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
41358       VectorTileLayer = class {
41359         /**
41360          * @param {Pbf} pbf
41361          * @param {number} [end]
41362          */
41363         constructor(pbf, end) {
41364           this.version = 1;
41365           this.name = "";
41366           this.extent = 4096;
41367           this.length = 0;
41368           this._pbf = pbf;
41369           this._keys = [];
41370           this._values = [];
41371           this._features = [];
41372           pbf.readFields(readLayer, this, end);
41373           this.length = this._features.length;
41374         }
41375         /** return feature `i` from this layer as a `VectorTileFeature`
41376          * @param {number} i
41377          */
41378         feature(i3) {
41379           if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
41380           this._pbf.pos = this._features[i3];
41381           const end = this._pbf.readVarint() + this._pbf.pos;
41382           return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
41383         }
41384       };
41385       VectorTile = class {
41386         /**
41387          * @param {Pbf} pbf
41388          * @param {number} [end]
41389          */
41390         constructor(pbf, end) {
41391           this.layers = pbf.readFields(readTile, {}, end);
41392         }
41393       };
41394     }
41395   });
41396
41397   // modules/services/mapillary.js
41398   var mapillary_exports = {};
41399   __export(mapillary_exports, {
41400     default: () => mapillary_default
41401   });
41402   function loadTiles(which, url, maxZoom2, projection2) {
41403     const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
41404     const tiles = tiler8.getTiles(projection2);
41405     tiles.forEach(function(tile) {
41406       loadTile(which, url, tile);
41407     });
41408   }
41409   function loadTile(which, url, tile) {
41410     const cache = _mlyCache.requests;
41411     const tileId = `${tile.id}-${which}`;
41412     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
41413     const controller = new AbortController();
41414     cache.inflight[tileId] = controller;
41415     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
41416     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
41417       if (!response.ok) {
41418         throw new Error(response.status + " " + response.statusText);
41419       }
41420       cache.loaded[tileId] = true;
41421       delete cache.inflight[tileId];
41422       return response.arrayBuffer();
41423     }).then(function(data) {
41424       if (!data) {
41425         throw new Error("No Data");
41426       }
41427       loadTileDataToCache(data, tile, which);
41428       if (which === "images") {
41429         dispatch4.call("loadedImages");
41430       } else if (which === "signs") {
41431         dispatch4.call("loadedSigns");
41432       } else if (which === "points") {
41433         dispatch4.call("loadedMapFeatures");
41434       }
41435     }).catch(function() {
41436       cache.loaded[tileId] = true;
41437       delete cache.inflight[tileId];
41438     });
41439   }
41440   function loadTileDataToCache(data, tile, which) {
41441     const vectorTile = new VectorTile(new Pbf(data));
41442     let features, cache, layer, i3, feature3, loc, d2;
41443     if (vectorTile.layers.hasOwnProperty("image")) {
41444       features = [];
41445       cache = _mlyCache.images;
41446       layer = vectorTile.layers.image;
41447       for (i3 = 0; i3 < layer.length; i3++) {
41448         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41449         loc = feature3.geometry.coordinates;
41450         d2 = {
41451           service: "photo",
41452           loc,
41453           captured_at: feature3.properties.captured_at,
41454           ca: feature3.properties.compass_angle,
41455           id: feature3.properties.id,
41456           is_pano: feature3.properties.is_pano,
41457           sequence_id: feature3.properties.sequence_id
41458         };
41459         cache.forImageId[d2.id] = d2;
41460         features.push({
41461           minX: loc[0],
41462           minY: loc[1],
41463           maxX: loc[0],
41464           maxY: loc[1],
41465           data: d2
41466         });
41467       }
41468       if (cache.rtree) {
41469         cache.rtree.load(features);
41470       }
41471     }
41472     if (vectorTile.layers.hasOwnProperty("sequence")) {
41473       features = [];
41474       cache = _mlyCache.sequences;
41475       layer = vectorTile.layers.sequence;
41476       for (i3 = 0; i3 < layer.length; i3++) {
41477         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41478         if (cache.lineString[feature3.properties.id]) {
41479           cache.lineString[feature3.properties.id].push(feature3);
41480         } else {
41481           cache.lineString[feature3.properties.id] = [feature3];
41482         }
41483       }
41484     }
41485     if (vectorTile.layers.hasOwnProperty("point")) {
41486       features = [];
41487       cache = _mlyCache[which];
41488       layer = vectorTile.layers.point;
41489       for (i3 = 0; i3 < layer.length; i3++) {
41490         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41491         loc = feature3.geometry.coordinates;
41492         d2 = {
41493           service: "photo",
41494           loc,
41495           id: feature3.properties.id,
41496           first_seen_at: feature3.properties.first_seen_at,
41497           last_seen_at: feature3.properties.last_seen_at,
41498           value: feature3.properties.value
41499         };
41500         features.push({
41501           minX: loc[0],
41502           minY: loc[1],
41503           maxX: loc[0],
41504           maxY: loc[1],
41505           data: d2
41506         });
41507       }
41508       if (cache.rtree) {
41509         cache.rtree.load(features);
41510       }
41511     }
41512     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
41513       features = [];
41514       cache = _mlyCache[which];
41515       layer = vectorTile.layers.traffic_sign;
41516       for (i3 = 0; i3 < layer.length; i3++) {
41517         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
41518         loc = feature3.geometry.coordinates;
41519         d2 = {
41520           service: "photo",
41521           loc,
41522           id: feature3.properties.id,
41523           first_seen_at: feature3.properties.first_seen_at,
41524           last_seen_at: feature3.properties.last_seen_at,
41525           value: feature3.properties.value
41526         };
41527         features.push({
41528           minX: loc[0],
41529           minY: loc[1],
41530           maxX: loc[0],
41531           maxY: loc[1],
41532           data: d2
41533         });
41534       }
41535       if (cache.rtree) {
41536         cache.rtree.load(features);
41537       }
41538     }
41539   }
41540   function loadData(url) {
41541     return fetch(url).then(function(response) {
41542       if (!response.ok) {
41543         throw new Error(response.status + " " + response.statusText);
41544       }
41545       return response.json();
41546     }).then(function(result) {
41547       if (!result) {
41548         return [];
41549       }
41550       return result.data || [];
41551     });
41552   }
41553   function partitionViewport(projection2) {
41554     const z2 = geoScaleToZoom(projection2.scale());
41555     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
41556     const tiler8 = utilTiler().zoomExtent([z22, z22]);
41557     return tiler8.getTiles(projection2).map(function(tile) {
41558       return tile.extent;
41559     });
41560   }
41561   function searchLimited(limit, projection2, rtree) {
41562     limit = limit || 5;
41563     return partitionViewport(projection2).reduce(function(result, extent) {
41564       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
41565         return d2.data;
41566       });
41567       return found.length ? result.concat(found) : result;
41568     }, []);
41569   }
41570   var accessToken, apiUrl, baseTileUrl, mapFeatureTileUrl, tileUrl, trafficSignTileUrl, viewercss, viewerjs, minZoom, dispatch4, _loadViewerPromise, _mlyActiveImage, _mlyCache, _mlyFallback, _mlyHighlightedDetection, _mlyShowFeatureDetections, _mlyShowSignDetections, _mlyViewer, _mlyViewerFilter, _isViewerOpen, mapillary_default;
41571   var init_mapillary = __esm({
41572     "modules/services/mapillary.js"() {
41573       "use strict";
41574       init_src4();
41575       init_src5();
41576       init_pbf();
41577       init_rbush();
41578       init_vector_tile();
41579       init_geo2();
41580       init_util();
41581       init_services();
41582       accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
41583       apiUrl = "https://graph.mapillary.com/";
41584       baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
41585       mapFeatureTileUrl = `${baseTileUrl}/mly_map_feature_point/2/{z}/{x}/{y}?access_token=${accessToken}`;
41586       tileUrl = `${baseTileUrl}/mly1_public/2/{z}/{x}/{y}?access_token=${accessToken}`;
41587       trafficSignTileUrl = `${baseTileUrl}/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=${accessToken}`;
41588       viewercss = "mapillary-js/mapillary.css";
41589       viewerjs = "mapillary-js/mapillary.js";
41590       minZoom = 14;
41591       dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
41592       _mlyFallback = false;
41593       _mlyShowFeatureDetections = false;
41594       _mlyShowSignDetections = false;
41595       _mlyViewerFilter = ["all"];
41596       _isViewerOpen = false;
41597       mapillary_default = {
41598         // Initialize Mapillary
41599         init: function() {
41600           if (!_mlyCache) {
41601             this.reset();
41602           }
41603           this.event = utilRebind(this, dispatch4, "on");
41604         },
41605         // Reset cache and state
41606         reset: function() {
41607           if (_mlyCache) {
41608             Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
41609               request3.abort();
41610             });
41611           }
41612           _mlyCache = {
41613             images: { rtree: new RBush(), forImageId: {} },
41614             image_detections: { forImageId: {} },
41615             signs: { rtree: new RBush() },
41616             points: { rtree: new RBush() },
41617             sequences: { rtree: new RBush(), lineString: {} },
41618             requests: { loaded: {}, inflight: {} }
41619           };
41620           _mlyActiveImage = null;
41621         },
41622         // Get visible images
41623         images: function(projection2) {
41624           const limit = 5;
41625           return searchLimited(limit, projection2, _mlyCache.images.rtree);
41626         },
41627         // Get visible traffic signs
41628         signs: function(projection2) {
41629           const limit = 5;
41630           return searchLimited(limit, projection2, _mlyCache.signs.rtree);
41631         },
41632         // Get visible map (point) features
41633         mapFeatures: function(projection2) {
41634           const limit = 5;
41635           return searchLimited(limit, projection2, _mlyCache.points.rtree);
41636         },
41637         // Get cached image by id
41638         cachedImage: function(imageId) {
41639           return _mlyCache.images.forImageId[imageId];
41640         },
41641         // Get visible sequences
41642         sequences: function(projection2) {
41643           const viewport = projection2.clipExtent();
41644           const min3 = [viewport[0][0], viewport[1][1]];
41645           const max3 = [viewport[1][0], viewport[0][1]];
41646           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41647           const sequenceIds = {};
41648           let lineStrings = [];
41649           _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
41650             if (d2.data.sequence_id) {
41651               sequenceIds[d2.data.sequence_id] = true;
41652             }
41653           });
41654           Object.keys(sequenceIds).forEach(function(sequenceId) {
41655             if (_mlyCache.sequences.lineString[sequenceId]) {
41656               lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
41657             }
41658           });
41659           return lineStrings;
41660         },
41661         // Load images in the visible area
41662         loadImages: function(projection2) {
41663           loadTiles("images", tileUrl, 14, projection2);
41664         },
41665         // Load traffic signs in the visible area
41666         loadSigns: function(projection2) {
41667           loadTiles("signs", trafficSignTileUrl, 14, projection2);
41668         },
41669         // Load map (point) features in the visible area
41670         loadMapFeatures: function(projection2) {
41671           loadTiles("points", mapFeatureTileUrl, 14, projection2);
41672         },
41673         // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
41674         ensureViewerLoaded: function(context) {
41675           if (_loadViewerPromise) return _loadViewerPromise;
41676           const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
41677           wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
41678           const that = this;
41679           _loadViewerPromise = new Promise((resolve, reject) => {
41680             let loadedCount = 0;
41681             function loaded() {
41682               loadedCount += 1;
41683               if (loadedCount === 2) resolve();
41684             }
41685             const head = select_default2("head");
41686             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() {
41687               reject();
41688             });
41689             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() {
41690               reject();
41691             });
41692           }).catch(function() {
41693             _loadViewerPromise = null;
41694           }).then(function() {
41695             that.initViewer(context);
41696           });
41697           return _loadViewerPromise;
41698         },
41699         // Load traffic sign image sprites
41700         loadSignResources: function(context) {
41701           context.ui().svgDefs.addSprites(
41702             ["mapillary-sprite"],
41703             false
41704             /* don't override colors */
41705           );
41706           return this;
41707         },
41708         // Load map (point) feature image sprites
41709         loadObjectResources: function(context) {
41710           context.ui().svgDefs.addSprites(
41711             ["mapillary-object-sprite"],
41712             false
41713             /* don't override colors */
41714           );
41715           return this;
41716         },
41717         // Remove previous detections in image viewer
41718         resetTags: function() {
41719           if (_mlyViewer && !_mlyFallback) {
41720             _mlyViewer.getComponent("tag").removeAll();
41721           }
41722         },
41723         // Show map feature detections in image viewer
41724         showFeatureDetections: function(value) {
41725           _mlyShowFeatureDetections = value;
41726           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41727             this.resetTags();
41728           }
41729         },
41730         // Show traffic sign detections in image viewer
41731         showSignDetections: function(value) {
41732           _mlyShowSignDetections = value;
41733           if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41734             this.resetTags();
41735           }
41736         },
41737         // Apply filter to image viewer
41738         filterViewer: function(context) {
41739           const showsPano = context.photos().showsPanoramic();
41740           const showsFlat = context.photos().showsFlat();
41741           const fromDate = context.photos().fromDate();
41742           const toDate = context.photos().toDate();
41743           const filter2 = ["all"];
41744           if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
41745           if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
41746           if (fromDate) {
41747             filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
41748           }
41749           if (toDate) {
41750             filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
41751           }
41752           if (_mlyViewer) {
41753             _mlyViewer.setFilter(filter2);
41754           }
41755           _mlyViewerFilter = filter2;
41756           return filter2;
41757         },
41758         // Make the image viewer visible
41759         showViewer: function(context) {
41760           const wrap2 = context.container().select(".photoviewer");
41761           const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
41762           if (isHidden && _mlyViewer) {
41763             for (const service of Object.values(services)) {
41764               if (service === this) continue;
41765               if (typeof service.hideViewer === "function") {
41766                 service.hideViewer(context);
41767               }
41768             }
41769             wrap2.classed("hide", false).selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
41770             _mlyViewer.resize();
41771           }
41772           _isViewerOpen = true;
41773           return this;
41774         },
41775         // Hide the image viewer and resets map markers
41776         hideViewer: function(context) {
41777           _mlyActiveImage = null;
41778           if (!_mlyFallback && _mlyViewer) {
41779             _mlyViewer.getComponent("sequence").stop();
41780           }
41781           const viewer = context.container().select(".photoviewer");
41782           if (!viewer.empty()) viewer.datum(null);
41783           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41784           this.updateUrlImage(null);
41785           dispatch4.call("imageChanged");
41786           dispatch4.call("loadedMapFeatures");
41787           dispatch4.call("loadedSigns");
41788           _isViewerOpen = false;
41789           return this.setStyles(context, null);
41790         },
41791         // Get viewer status
41792         isViewerOpen: function() {
41793           return _isViewerOpen;
41794         },
41795         // Update the URL with current image id
41796         updateUrlImage: function(imageId) {
41797           const hash2 = utilStringQs(window.location.hash);
41798           if (imageId) {
41799             hash2.photo = "mapillary/" + imageId;
41800           } else {
41801             delete hash2.photo;
41802           }
41803           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
41804         },
41805         // Highlight the detection in the viewer that is related to the clicked map feature
41806         highlightDetection: function(detection) {
41807           if (detection) {
41808             _mlyHighlightedDetection = detection.id;
41809           }
41810           return this;
41811         },
41812         // Initialize image viewer (Mapillar JS)
41813         initViewer: function(context) {
41814           if (!window.mapillary) return;
41815           const opts = {
41816             accessToken,
41817             component: {
41818               cover: false,
41819               keyboard: false,
41820               tag: true
41821             },
41822             container: "ideditor-mly"
41823           };
41824           if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
41825             _mlyFallback = true;
41826             opts.component = {
41827               cover: false,
41828               direction: false,
41829               imagePlane: false,
41830               keyboard: false,
41831               mouse: false,
41832               sequence: false,
41833               tag: false,
41834               image: true,
41835               // fallback
41836               navigation: true
41837               // fallback
41838             };
41839           }
41840           _mlyViewer = new mapillary.Viewer(opts);
41841           _mlyViewer.on("image", imageChanged.bind(this));
41842           _mlyViewer.on("bearing", bearingChanged);
41843           if (_mlyViewerFilter) {
41844             _mlyViewer.setFilter(_mlyViewerFilter);
41845           }
41846           context.ui().photoviewer.on("resize.mapillary", function() {
41847             if (_mlyViewer) _mlyViewer.resize();
41848           });
41849           function imageChanged(photo) {
41850             this.resetTags();
41851             const image = photo.image;
41852             this.setActiveImage(image);
41853             this.setStyles(context, null);
41854             const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
41855             context.map().centerEase(loc);
41856             this.updateUrlImage(image.id);
41857             if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
41858               this.updateDetections(image.id, `${apiUrl}/${image.id}/detections?access_token=${accessToken}&fields=id,image,geometry,value`);
41859             }
41860             dispatch4.call("imageChanged");
41861           }
41862           function bearingChanged(e3) {
41863             dispatch4.call("bearingChanged", void 0, e3);
41864           }
41865         },
41866         // Move to an image
41867         selectImage: function(context, imageId) {
41868           if (_mlyViewer && imageId) {
41869             _mlyViewer.moveTo(imageId).then((image) => this.setActiveImage(image)).catch(function(e3) {
41870               console.error("mly3", e3);
41871             });
41872           }
41873           return this;
41874         },
41875         // Return the currently displayed image
41876         getActiveImage: function() {
41877           return _mlyActiveImage;
41878         },
41879         // Return a list of detection objects for the given id
41880         getDetections: function(id2) {
41881           return loadData(`${apiUrl}/${id2}/detections?access_token=${accessToken}&fields=id,value,image`);
41882         },
41883         // Set the currently visible image
41884         setActiveImage: function(image) {
41885           if (image) {
41886             _mlyActiveImage = {
41887               ca: image.originalCompassAngle,
41888               id: image.id,
41889               loc: [image.originalLngLat.lng, image.originalLngLat.lat],
41890               is_pano: image.cameraType === "spherical",
41891               sequence_id: image.sequenceId
41892             };
41893           } else {
41894             _mlyActiveImage = null;
41895           }
41896         },
41897         // Update the currently highlighted sequence and selected bubble.
41898         setStyles: function(context, hovered) {
41899           const hoveredImageId = hovered && hovered.id;
41900           const hoveredSequenceId = hovered && hovered.sequence_id;
41901           const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
41902           context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
41903             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
41904           }).classed("hovered", function(d2) {
41905             return d2.id === hoveredImageId;
41906           });
41907           context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
41908             return d2.properties.id === hoveredSequenceId;
41909           }).classed("currentView", function(d2) {
41910             return d2.properties.id === selectedSequenceId;
41911           });
41912           return this;
41913         },
41914         // Get detections for the current image and shows them in the image viewer
41915         updateDetections: function(imageId, url) {
41916           if (!_mlyViewer || _mlyFallback) return;
41917           if (!imageId) return;
41918           const cache = _mlyCache.image_detections;
41919           if (cache.forImageId[imageId]) {
41920             showDetections(_mlyCache.image_detections.forImageId[imageId]);
41921           } else {
41922             loadData(url).then((detections) => {
41923               detections.forEach(function(detection) {
41924                 if (!cache.forImageId[imageId]) {
41925                   cache.forImageId[imageId] = [];
41926                 }
41927                 cache.forImageId[imageId].push({
41928                   geometry: detection.geometry,
41929                   id: detection.id,
41930                   image_id: imageId,
41931                   value: detection.value
41932                 });
41933               });
41934               showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
41935             });
41936           }
41937           function showDetections(detections) {
41938             const tagComponent = _mlyViewer.getComponent("tag");
41939             detections.forEach(function(data) {
41940               const tag2 = makeTag(data);
41941               if (tag2) {
41942                 tagComponent.add([tag2]);
41943               }
41944             });
41945           }
41946           function makeTag(data) {
41947             const valueParts = data.value.split("--");
41948             if (!valueParts.length) return;
41949             let tag2;
41950             let text;
41951             let color2 = 16777215;
41952             if (_mlyHighlightedDetection === data.id) {
41953               color2 = 16776960;
41954               text = valueParts[1];
41955               if (text === "flat" || text === "discrete" || text === "sign") {
41956                 text = valueParts[2];
41957               }
41958               text = text.replace(/-/g, " ");
41959               text = text.charAt(0).toUpperCase() + text.slice(1);
41960               _mlyHighlightedDetection = null;
41961             }
41962             var decodedGeometry = window.atob(data.geometry);
41963             var uintArray = new Uint8Array(decodedGeometry.length);
41964             for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
41965               uintArray[i3] = decodedGeometry.charCodeAt(i3);
41966             }
41967             const tile = new VectorTile(new Pbf(uintArray.buffer));
41968             const layer = tile.layers["mpy-or"];
41969             const geometries = layer.feature(0).loadGeometry();
41970             const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
41971             tag2 = new mapillary.OutlineTag(
41972               data.id,
41973               new mapillary.PolygonGeometry(polygon2[0]),
41974               {
41975                 text,
41976                 textColor: color2,
41977                 lineColor: color2,
41978                 lineWidth: 2,
41979                 fillColor: color2,
41980                 fillOpacity: 0.3
41981               }
41982             );
41983             return tag2;
41984           }
41985         },
41986         // Return the current cache
41987         cache: function() {
41988           return _mlyCache;
41989         }
41990       };
41991     }
41992   });
41993
41994   // modules/core/validation/models.js
41995   var models_exports = {};
41996   __export(models_exports, {
41997     validationIssue: () => validationIssue,
41998     validationIssueFix: () => validationIssueFix
41999   });
42000   function validationIssue(attrs) {
42001     this.type = attrs.type;
42002     this.subtype = attrs.subtype;
42003     this.severity = attrs.severity;
42004     this.message = attrs.message;
42005     this.reference = attrs.reference;
42006     this.entityIds = attrs.entityIds;
42007     this.loc = attrs.loc;
42008     this.data = attrs.data;
42009     this.dynamicFixes = attrs.dynamicFixes;
42010     this.hash = attrs.hash;
42011     this.id = generateID.apply(this);
42012     this.key = generateKey.apply(this);
42013     this.autoFix = null;
42014     function generateID() {
42015       var parts = [this.type];
42016       if (this.hash) {
42017         parts.push(this.hash);
42018       }
42019       if (this.subtype) {
42020         parts.push(this.subtype);
42021       }
42022       if (this.entityIds) {
42023         var entityKeys = this.entityIds.slice().sort();
42024         parts.push.apply(parts, entityKeys);
42025       }
42026       return parts.join(":");
42027     }
42028     function generateKey() {
42029       return this.id + ":" + Date.now().toString();
42030     }
42031     this.extent = function(resolver) {
42032       if (this.loc) {
42033         return geoExtent(this.loc);
42034       }
42035       if (this.entityIds && this.entityIds.length) {
42036         return this.entityIds.reduce(function(extent, entityId) {
42037           return extent.extend(resolver.entity(entityId).extent(resolver));
42038         }, geoExtent());
42039       }
42040       return null;
42041     };
42042     this.fixes = function(context) {
42043       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
42044       var issue = this;
42045       if (issue.severity === "warning") {
42046         fixes.push(new validationIssueFix({
42047           title: _t.append("issues.fix.ignore_issue.title"),
42048           icon: "iD-icon-close",
42049           onClick: function() {
42050             context.validator().ignoreIssue(this.issue.id);
42051           }
42052         }));
42053       }
42054       fixes.forEach(function(fix) {
42055         fix.id = fix.title.stringId;
42056         fix.issue = issue;
42057         if (fix.autoArgs) {
42058           issue.autoFix = fix;
42059         }
42060       });
42061       return fixes;
42062     };
42063   }
42064   function validationIssueFix(attrs) {
42065     this.title = attrs.title;
42066     this.onClick = attrs.onClick;
42067     this.disabledReason = attrs.disabledReason;
42068     this.icon = attrs.icon;
42069     this.entityIds = attrs.entityIds || [];
42070     this.autoArgs = attrs.autoArgs;
42071     this.issue = null;
42072   }
42073   var init_models = __esm({
42074     "modules/core/validation/models.js"() {
42075       "use strict";
42076       init_geo2();
42077       init_localizer();
42078     }
42079   });
42080
42081   // modules/core/validation/index.js
42082   var validation_exports = {};
42083   __export(validation_exports, {
42084     validationIssue: () => validationIssue,
42085     validationIssueFix: () => validationIssueFix
42086   });
42087   var init_validation = __esm({
42088     "modules/core/validation/index.js"() {
42089       "use strict";
42090       init_models();
42091     }
42092   });
42093
42094   // modules/services/maprules.js
42095   var maprules_exports = {};
42096   __export(maprules_exports, {
42097     default: () => maprules_default
42098   });
42099   var buildRuleChecks, buildLineKeys, maprules_default;
42100   var init_maprules = __esm({
42101     "modules/services/maprules.js"() {
42102       "use strict";
42103       init_tags();
42104       init_util();
42105       init_validation();
42106       buildRuleChecks = function() {
42107         return {
42108           equals: function(equals) {
42109             return function(tags) {
42110               return Object.keys(equals).every(function(k2) {
42111                 return equals[k2] === tags[k2];
42112               });
42113             };
42114           },
42115           notEquals: function(notEquals) {
42116             return function(tags) {
42117               return Object.keys(notEquals).some(function(k2) {
42118                 return notEquals[k2] !== tags[k2];
42119               });
42120             };
42121           },
42122           absence: function(absence) {
42123             return function(tags) {
42124               return Object.keys(tags).indexOf(absence) === -1;
42125             };
42126           },
42127           presence: function(presence) {
42128             return function(tags) {
42129               return Object.keys(tags).indexOf(presence) > -1;
42130             };
42131           },
42132           greaterThan: function(greaterThan) {
42133             var key = Object.keys(greaterThan)[0];
42134             var value = greaterThan[key];
42135             return function(tags) {
42136               return tags[key] > value;
42137             };
42138           },
42139           greaterThanEqual: function(greaterThanEqual) {
42140             var key = Object.keys(greaterThanEqual)[0];
42141             var value = greaterThanEqual[key];
42142             return function(tags) {
42143               return tags[key] >= value;
42144             };
42145           },
42146           lessThan: function(lessThan) {
42147             var key = Object.keys(lessThan)[0];
42148             var value = lessThan[key];
42149             return function(tags) {
42150               return tags[key] < value;
42151             };
42152           },
42153           lessThanEqual: function(lessThanEqual) {
42154             var key = Object.keys(lessThanEqual)[0];
42155             var value = lessThanEqual[key];
42156             return function(tags) {
42157               return tags[key] <= value;
42158             };
42159           },
42160           positiveRegex: function(positiveRegex) {
42161             var tagKey = Object.keys(positiveRegex)[0];
42162             var expression = positiveRegex[tagKey].join("|");
42163             var regex = new RegExp(expression);
42164             return function(tags) {
42165               return regex.test(tags[tagKey]);
42166             };
42167           },
42168           negativeRegex: function(negativeRegex) {
42169             var tagKey = Object.keys(negativeRegex)[0];
42170             var expression = negativeRegex[tagKey].join("|");
42171             var regex = new RegExp(expression);
42172             return function(tags) {
42173               return !regex.test(tags[tagKey]);
42174             };
42175           }
42176         };
42177       };
42178       buildLineKeys = function() {
42179         return {
42180           highway: {
42181             rest_area: true,
42182             services: true
42183           },
42184           railway: {
42185             roundhouse: true,
42186             station: true,
42187             traverser: true,
42188             turntable: true,
42189             wash: true
42190           }
42191         };
42192       };
42193       maprules_default = {
42194         init: function() {
42195           this._ruleChecks = buildRuleChecks();
42196           this._validationRules = [];
42197           this._areaKeys = osmAreaKeys;
42198           this._lineKeys = buildLineKeys();
42199         },
42200         // list of rules only relevant to tag checks...
42201         filterRuleChecks: function(selector) {
42202           var _ruleChecks = this._ruleChecks;
42203           return Object.keys(selector).reduce(function(rules, key) {
42204             if (["geometry", "error", "warning"].indexOf(key) === -1) {
42205               rules.push(_ruleChecks[key](selector[key]));
42206             }
42207             return rules;
42208           }, []);
42209         },
42210         // builds tagMap from mapcss-parse selector object...
42211         buildTagMap: function(selector) {
42212           var getRegexValues = function(regexes) {
42213             return regexes.map(function(regex) {
42214               return regex.replace(/\$|\^/g, "");
42215             });
42216           };
42217           var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
42218             var values;
42219             var isRegex = /regex/gi.test(key);
42220             var isEqual5 = /equals/gi.test(key);
42221             if (isRegex || isEqual5) {
42222               Object.keys(selector[key]).forEach(function(selectorKey) {
42223                 values = isEqual5 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
42224                 if (expectedTags.hasOwnProperty(selectorKey)) {
42225                   values = values.concat(expectedTags[selectorKey]);
42226                 }
42227                 expectedTags[selectorKey] = values;
42228               });
42229             } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
42230               var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
42231               values = [selector[key][tagKey]];
42232               if (expectedTags.hasOwnProperty(tagKey)) {
42233                 values = values.concat(expectedTags[tagKey]);
42234               }
42235               expectedTags[tagKey] = values;
42236             }
42237             return expectedTags;
42238           }, {});
42239           return tagMap;
42240         },
42241         // inspired by osmWay#isArea()
42242         inferGeometry: function(tagMap) {
42243           var _lineKeys = this._lineKeys;
42244           var _areaKeys = this._areaKeys;
42245           var keyValueDoesNotImplyArea = function(key2) {
42246             return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
42247           };
42248           var keyValueImpliesLine = function(key2) {
42249             return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
42250           };
42251           if (tagMap.hasOwnProperty("area")) {
42252             if (tagMap.area.indexOf("yes") > -1) {
42253               return "area";
42254             }
42255             if (tagMap.area.indexOf("no") > -1) {
42256               return "line";
42257             }
42258           }
42259           for (var key in tagMap) {
42260             if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
42261               return "area";
42262             }
42263             if (key in _lineKeys && keyValueImpliesLine(key)) {
42264               return "area";
42265             }
42266           }
42267           return "line";
42268         },
42269         // adds from mapcss-parse selector check...
42270         addRule: function(selector) {
42271           var rule = {
42272             // checks relevant to mapcss-selector
42273             checks: this.filterRuleChecks(selector),
42274             // true if all conditions for a tag error are true..
42275             matches: function(entity) {
42276               return this.checks.every(function(check) {
42277                 return check(entity.tags);
42278               });
42279             },
42280             // borrowed from Way#isArea()
42281             inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
42282             geometryMatches: function(entity, graph) {
42283               if (entity.type === "node" || entity.type === "relation") {
42284                 return selector.geometry === entity.type;
42285               } else if (entity.type === "way") {
42286                 return this.inferredGeometry === entity.geometry(graph);
42287               }
42288             },
42289             // when geometries match and tag matches are present, return a warning...
42290             findIssues: function(entity, graph, issues) {
42291               if (this.geometryMatches(entity, graph) && this.matches(entity)) {
42292                 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
42293                 var message = selector[severity];
42294                 issues.push(new validationIssue({
42295                   type: "maprules",
42296                   severity,
42297                   message: function() {
42298                     return message;
42299                   },
42300                   entityIds: [entity.id]
42301                 }));
42302               }
42303             }
42304           };
42305           this._validationRules.push(rule);
42306         },
42307         clearRules: function() {
42308           this._validationRules = [];
42309         },
42310         // returns validationRules...
42311         validationRules: function() {
42312           return this._validationRules;
42313         },
42314         // returns ruleChecks
42315         ruleChecks: function() {
42316           return this._ruleChecks;
42317         }
42318       };
42319     }
42320   });
42321
42322   // modules/core/difference.js
42323   var difference_exports = {};
42324   __export(difference_exports, {
42325     coreDifference: () => coreDifference
42326   });
42327   function coreDifference(base, head) {
42328     var _changes = {};
42329     var _didChange = {};
42330     var _diff = {};
42331     function checkEntityID(id2) {
42332       var h2 = head.entities[id2];
42333       var b2 = base.entities[id2];
42334       if (h2 === b2) return;
42335       if (_changes[id2]) return;
42336       if (!h2 && b2) {
42337         _changes[id2] = { base: b2, head: h2 };
42338         _didChange.deletion = true;
42339         return;
42340       }
42341       if (h2 && !b2) {
42342         _changes[id2] = { base: b2, head: h2 };
42343         _didChange.addition = true;
42344         return;
42345       }
42346       if (h2 && b2) {
42347         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
42348           _changes[id2] = { base: b2, head: h2 };
42349           _didChange.geometry = true;
42350           _didChange.properties = true;
42351           return;
42352         }
42353         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
42354           _changes[id2] = { base: b2, head: h2 };
42355           _didChange.geometry = true;
42356         }
42357         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
42358           _changes[id2] = { base: b2, head: h2 };
42359           _didChange.geometry = true;
42360         }
42361         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
42362           _changes[id2] = { base: b2, head: h2 };
42363           _didChange.properties = true;
42364         }
42365       }
42366     }
42367     function load() {
42368       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
42369       for (var i3 = 0; i3 < ids.length; i3++) {
42370         checkEntityID(ids[i3]);
42371       }
42372     }
42373     load();
42374     _diff.length = function length2() {
42375       return Object.keys(_changes).length;
42376     };
42377     _diff.changes = function changes() {
42378       return _changes;
42379     };
42380     _diff.didChange = _didChange;
42381     _diff.extantIDs = function extantIDs(includeRelMembers) {
42382       var result = /* @__PURE__ */ new Set();
42383       Object.keys(_changes).forEach(function(id2) {
42384         if (_changes[id2].head) {
42385           result.add(id2);
42386         }
42387         var h2 = _changes[id2].head;
42388         var b2 = _changes[id2].base;
42389         var entity = h2 || b2;
42390         if (includeRelMembers && entity.type === "relation") {
42391           var mh = h2 ? h2.members.map(function(m2) {
42392             return m2.id;
42393           }) : [];
42394           var mb = b2 ? b2.members.map(function(m2) {
42395             return m2.id;
42396           }) : [];
42397           utilArrayUnion(mh, mb).forEach(function(memberID) {
42398             if (head.hasEntity(memberID)) {
42399               result.add(memberID);
42400             }
42401           });
42402         }
42403       });
42404       return Array.from(result);
42405     };
42406     _diff.modified = function modified() {
42407       var result = [];
42408       Object.values(_changes).forEach(function(change) {
42409         if (change.base && change.head) {
42410           result.push(change.head);
42411         }
42412       });
42413       return result;
42414     };
42415     _diff.created = function created() {
42416       var result = [];
42417       Object.values(_changes).forEach(function(change) {
42418         if (!change.base && change.head) {
42419           result.push(change.head);
42420         }
42421       });
42422       return result;
42423     };
42424     _diff.deleted = function deleted() {
42425       var result = [];
42426       Object.values(_changes).forEach(function(change) {
42427         if (change.base && !change.head) {
42428           result.push(change.base);
42429         }
42430       });
42431       return result;
42432     };
42433     _diff.summary = function summary() {
42434       var relevant = {};
42435       var keys2 = Object.keys(_changes);
42436       for (var i3 = 0; i3 < keys2.length; i3++) {
42437         var change = _changes[keys2[i3]];
42438         if (change.head && change.head.geometry(head) !== "vertex") {
42439           addEntity(change.head, head, change.base ? "modified" : "created");
42440         } else if (change.base && change.base.geometry(base) !== "vertex") {
42441           addEntity(change.base, base, "deleted");
42442         } else if (change.base && change.head) {
42443           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
42444           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
42445           if (moved) {
42446             addParents(change.head);
42447           }
42448           if (retagged || moved && change.head.hasInterestingTags()) {
42449             addEntity(change.head, head, "modified");
42450           }
42451         } else if (change.head && change.head.hasInterestingTags()) {
42452           addEntity(change.head, head, "created");
42453         } else if (change.base && change.base.hasInterestingTags()) {
42454           addEntity(change.base, base, "deleted");
42455         }
42456       }
42457       return Object.values(relevant);
42458       function addEntity(entity, graph, changeType) {
42459         relevant[entity.id] = {
42460           entity,
42461           graph,
42462           changeType
42463         };
42464       }
42465       function addParents(entity) {
42466         var parents = head.parentWays(entity);
42467         for (var j2 = parents.length - 1; j2 >= 0; j2--) {
42468           var parent = parents[j2];
42469           if (!(parent.id in relevant)) {
42470             addEntity(parent, head, "modified");
42471           }
42472         }
42473       }
42474     };
42475     _diff.complete = function complete(extent) {
42476       var result = {};
42477       var id2, change;
42478       for (id2 in _changes) {
42479         change = _changes[id2];
42480         var h2 = change.head;
42481         var b2 = change.base;
42482         var entity = h2 || b2;
42483         var i3;
42484         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
42485           continue;
42486         }
42487         result[id2] = h2;
42488         if (entity.type === "way") {
42489           var nh = h2 ? h2.nodes : [];
42490           var nb = b2 ? b2.nodes : [];
42491           var diff;
42492           diff = utilArrayDifference(nh, nb);
42493           for (i3 = 0; i3 < diff.length; i3++) {
42494             result[diff[i3]] = head.hasEntity(diff[i3]);
42495           }
42496           diff = utilArrayDifference(nb, nh);
42497           for (i3 = 0; i3 < diff.length; i3++) {
42498             result[diff[i3]] = head.hasEntity(diff[i3]);
42499           }
42500         }
42501         if (entity.type === "relation" && entity.isMultipolygon()) {
42502           var mh = h2 ? h2.members.map(function(m2) {
42503             return m2.id;
42504           }) : [];
42505           var mb = b2 ? b2.members.map(function(m2) {
42506             return m2.id;
42507           }) : [];
42508           var ids = utilArrayUnion(mh, mb);
42509           for (i3 = 0; i3 < ids.length; i3++) {
42510             var member = head.hasEntity(ids[i3]);
42511             if (!member) continue;
42512             if (extent && !member.intersects(extent, head)) continue;
42513             result[ids[i3]] = member;
42514           }
42515         }
42516         addParents(head.parentWays(entity), result);
42517         addParents(head.parentRelations(entity), result);
42518       }
42519       return result;
42520       function addParents(parents, result2) {
42521         for (var i4 = 0; i4 < parents.length; i4++) {
42522           var parent = parents[i4];
42523           if (parent.id in result2) continue;
42524           result2[parent.id] = parent;
42525           addParents(head.parentRelations(parent), result2);
42526         }
42527       }
42528     };
42529     return _diff;
42530   }
42531   var import_fast_deep_equal3;
42532   var init_difference = __esm({
42533     "modules/core/difference.js"() {
42534       "use strict";
42535       import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
42536       init_geo2();
42537       init_array3();
42538     }
42539   });
42540
42541   // modules/core/tree.js
42542   var tree_exports = {};
42543   __export(tree_exports, {
42544     coreTree: () => coreTree
42545   });
42546   function coreTree(head) {
42547     var _rtree = new RBush();
42548     var _bboxes = {};
42549     var _segmentsRTree = new RBush();
42550     var _segmentsBBoxes = {};
42551     var _segmentsByWayId = {};
42552     var tree = {};
42553     function entityBBox(entity) {
42554       var bbox2 = entity.extent(head).bbox();
42555       bbox2.id = entity.id;
42556       _bboxes[entity.id] = bbox2;
42557       return bbox2;
42558     }
42559     function segmentBBox(segment) {
42560       var extent = segment.extent(head);
42561       if (!extent) return null;
42562       var bbox2 = extent.bbox();
42563       bbox2.segment = segment;
42564       _segmentsBBoxes[segment.id] = bbox2;
42565       return bbox2;
42566     }
42567     function removeEntity(entity) {
42568       _rtree.remove(_bboxes[entity.id]);
42569       delete _bboxes[entity.id];
42570       if (_segmentsByWayId[entity.id]) {
42571         _segmentsByWayId[entity.id].forEach(function(segment) {
42572           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
42573           delete _segmentsBBoxes[segment.id];
42574         });
42575         delete _segmentsByWayId[entity.id];
42576       }
42577     }
42578     function loadEntities(entities) {
42579       _rtree.load(entities.map(entityBBox));
42580       var segments = [];
42581       entities.forEach(function(entity) {
42582         if (entity.segments) {
42583           var entitySegments = entity.segments(head);
42584           _segmentsByWayId[entity.id] = entitySegments;
42585           segments = segments.concat(entitySegments);
42586         }
42587       });
42588       if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
42589     }
42590     function updateParents(entity, insertions, memo) {
42591       head.parentWays(entity).forEach(function(way) {
42592         if (_bboxes[way.id]) {
42593           removeEntity(way);
42594           insertions[way.id] = way;
42595         }
42596         updateParents(way, insertions, memo);
42597       });
42598       head.parentRelations(entity).forEach(function(relation) {
42599         if (memo[relation.id]) return;
42600         memo[relation.id] = true;
42601         if (_bboxes[relation.id]) {
42602           removeEntity(relation);
42603           insertions[relation.id] = relation;
42604         }
42605         updateParents(relation, insertions, memo);
42606       });
42607     }
42608     tree.rebase = function(entities, force) {
42609       var insertions = {};
42610       for (var i3 = 0; i3 < entities.length; i3++) {
42611         var entity = entities[i3];
42612         if (!entity.visible) continue;
42613         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
42614           if (!force) {
42615             continue;
42616           } else if (_bboxes[entity.id]) {
42617             removeEntity(entity);
42618           }
42619         }
42620         insertions[entity.id] = entity;
42621         updateParents(entity, insertions, {});
42622       }
42623       loadEntities(Object.values(insertions));
42624       return tree;
42625     };
42626     function updateToGraph(graph) {
42627       if (graph === head) return;
42628       var diff = coreDifference(head, graph);
42629       head = graph;
42630       var changed = diff.didChange;
42631       if (!changed.addition && !changed.deletion && !changed.geometry) return;
42632       var insertions = {};
42633       if (changed.deletion) {
42634         diff.deleted().forEach(function(entity) {
42635           removeEntity(entity);
42636         });
42637       }
42638       if (changed.geometry) {
42639         diff.modified().forEach(function(entity) {
42640           removeEntity(entity);
42641           insertions[entity.id] = entity;
42642           updateParents(entity, insertions, {});
42643         });
42644       }
42645       if (changed.addition) {
42646         diff.created().forEach(function(entity) {
42647           insertions[entity.id] = entity;
42648         });
42649       }
42650       loadEntities(Object.values(insertions));
42651     }
42652     tree.intersects = function(extent, graph) {
42653       updateToGraph(graph);
42654       return _rtree.search(extent.bbox()).map(function(bbox2) {
42655         return graph.entity(bbox2.id);
42656       });
42657     };
42658     tree.waySegments = function(extent, graph) {
42659       updateToGraph(graph);
42660       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
42661         return bbox2.segment;
42662       });
42663     };
42664     return tree;
42665   }
42666   var init_tree = __esm({
42667     "modules/core/tree.js"() {
42668       "use strict";
42669       init_rbush();
42670       init_difference();
42671     }
42672   });
42673
42674   // modules/svg/icon.js
42675   var icon_exports = {};
42676   __export(icon_exports, {
42677     svgIcon: () => svgIcon
42678   });
42679   function svgIcon(name, svgklass, useklass) {
42680     return function drawIcon(selection2) {
42681       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);
42682     };
42683   }
42684   var init_icon = __esm({
42685     "modules/svg/icon.js"() {
42686       "use strict";
42687     }
42688   });
42689
42690   // modules/ui/modal.js
42691   var modal_exports = {};
42692   __export(modal_exports, {
42693     uiModal: () => uiModal
42694   });
42695   function uiModal(selection2, blocking) {
42696     let keybinding = utilKeybinding("modal");
42697     let previous = selection2.select("div.modal");
42698     let animate = previous.empty();
42699     previous.transition().duration(200).style("opacity", 0).remove();
42700     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
42701     shaded.close = () => {
42702       shaded.transition().duration(200).style("opacity", 0).remove();
42703       modal.transition().duration(200).style("top", "0px");
42704       select_default2(document).call(keybinding.unbind);
42705     };
42706     let modal = shaded.append("div").attr("class", "modal fillL");
42707     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
42708     if (!blocking) {
42709       shaded.on("click.remove-modal", (d3_event) => {
42710         if (d3_event.target === this) {
42711           shaded.close();
42712         }
42713       });
42714       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
42715       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
42716       select_default2(document).call(keybinding);
42717     }
42718     modal.append("div").attr("class", "content");
42719     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
42720     if (animate) {
42721       shaded.transition().style("opacity", 1);
42722     } else {
42723       shaded.style("opacity", 1);
42724     }
42725     return shaded;
42726     function moveFocusToFirst() {
42727       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
42728       if (node) {
42729         node.focus();
42730       } else {
42731         select_default2(this).node().blur();
42732       }
42733     }
42734     function moveFocusToLast() {
42735       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
42736       if (nodes.length) {
42737         nodes[nodes.length - 1].focus();
42738       } else {
42739         select_default2(this).node().blur();
42740       }
42741     }
42742   }
42743   var init_modal = __esm({
42744     "modules/ui/modal.js"() {
42745       "use strict";
42746       init_src5();
42747       init_localizer();
42748       init_icon();
42749       init_util();
42750     }
42751   });
42752
42753   // modules/ui/loading.js
42754   var loading_exports = {};
42755   __export(loading_exports, {
42756     uiLoading: () => uiLoading
42757   });
42758   function uiLoading(context) {
42759     let _modalSelection = select_default2(null);
42760     let _message = "";
42761     let _blocking = false;
42762     let loading = (selection2) => {
42763       _modalSelection = uiModal(selection2, _blocking);
42764       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
42765       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
42766       loadertext.append("h3").html(_message);
42767       _modalSelection.select("button.close").attr("class", "hide");
42768       return loading;
42769     };
42770     loading.message = function(val) {
42771       if (!arguments.length) return _message;
42772       _message = val;
42773       return loading;
42774     };
42775     loading.blocking = function(val) {
42776       if (!arguments.length) return _blocking;
42777       _blocking = val;
42778       return loading;
42779     };
42780     loading.close = () => {
42781       _modalSelection.remove();
42782     };
42783     loading.isShown = () => {
42784       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
42785     };
42786     return loading;
42787   }
42788   var init_loading = __esm({
42789     "modules/ui/loading.js"() {
42790       "use strict";
42791       init_src5();
42792       init_modal();
42793     }
42794   });
42795
42796   // modules/core/history.js
42797   var history_exports = {};
42798   __export(history_exports, {
42799     coreHistory: () => coreHistory
42800   });
42801   function coreHistory(context) {
42802     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
42803     var lock = utilSessionMutex("lock");
42804     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
42805     var duration = 150;
42806     var _imageryUsed = [];
42807     var _photoOverlaysUsed = [];
42808     var _checkpoints = {};
42809     var _pausedGraph;
42810     var _stack;
42811     var _index;
42812     var _tree;
42813     function _act(actions, t2) {
42814       actions = Array.prototype.slice.call(actions);
42815       var annotation;
42816       if (typeof actions[actions.length - 1] !== "function") {
42817         annotation = actions.pop();
42818       }
42819       var graph = _stack[_index].graph;
42820       for (var i3 = 0; i3 < actions.length; i3++) {
42821         graph = actions[i3](graph, t2);
42822       }
42823       return {
42824         graph,
42825         annotation,
42826         imageryUsed: _imageryUsed,
42827         photoOverlaysUsed: _photoOverlaysUsed,
42828         transform: context.projection.transform(),
42829         selectedIDs: context.selectedIDs()
42830       };
42831     }
42832     function _perform(args, t2) {
42833       var previous = _stack[_index].graph;
42834       _stack = _stack.slice(0, _index + 1);
42835       var actionResult = _act(args, t2);
42836       _stack.push(actionResult);
42837       _index++;
42838       return change(previous);
42839     }
42840     function _replace(args, t2) {
42841       var previous = _stack[_index].graph;
42842       var actionResult = _act(args, t2);
42843       _stack[_index] = actionResult;
42844       return change(previous);
42845     }
42846     function _overwrite(args, t2) {
42847       var previous = _stack[_index].graph;
42848       if (_index > 0) {
42849         _index--;
42850         _stack.pop();
42851       }
42852       _stack = _stack.slice(0, _index + 1);
42853       var actionResult = _act(args, t2);
42854       _stack.push(actionResult);
42855       _index++;
42856       return change(previous);
42857     }
42858     function change(previous) {
42859       var difference2 = coreDifference(previous, history.graph());
42860       if (!_pausedGraph) {
42861         dispatch14.call("change", this, difference2);
42862       }
42863       return difference2;
42864     }
42865     function getKey(n3) {
42866       return "iD_" + window.location.origin + "_" + n3;
42867     }
42868     var history = {
42869       graph: function() {
42870         return _stack[_index].graph;
42871       },
42872       tree: function() {
42873         return _tree;
42874       },
42875       base: function() {
42876         return _stack[0].graph;
42877       },
42878       merge: function(entities) {
42879         var stack = _stack.map(function(state) {
42880           return state.graph;
42881         });
42882         _stack[0].graph.rebase(entities, stack, false);
42883         _tree.rebase(entities, false);
42884         dispatch14.call("merge", this, entities);
42885       },
42886       perform: function() {
42887         select_default2(document).interrupt("history.perform");
42888         var transitionable = false;
42889         var action0 = arguments[0];
42890         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
42891           transitionable = !!action0.transitionable;
42892         }
42893         if (transitionable) {
42894           var origArguments = arguments;
42895           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
42896             return function(t2) {
42897               if (t2 < 1) _overwrite([action0], t2);
42898             };
42899           }).on("start", function() {
42900             _perform([action0], 0);
42901           }).on("end interrupt", function() {
42902             _overwrite(origArguments, 1);
42903           });
42904         } else {
42905           return _perform(arguments);
42906         }
42907       },
42908       replace: function() {
42909         select_default2(document).interrupt("history.perform");
42910         return _replace(arguments, 1);
42911       },
42912       // Same as calling pop and then perform
42913       overwrite: function() {
42914         select_default2(document).interrupt("history.perform");
42915         return _overwrite(arguments, 1);
42916       },
42917       pop: function(n3) {
42918         select_default2(document).interrupt("history.perform");
42919         var previous = _stack[_index].graph;
42920         if (isNaN(+n3) || +n3 < 0) {
42921           n3 = 1;
42922         }
42923         while (n3-- > 0 && _index > 0) {
42924           _index--;
42925           _stack.pop();
42926         }
42927         return change(previous);
42928       },
42929       // Back to the previous annotated state or _index = 0.
42930       undo: function() {
42931         select_default2(document).interrupt("history.perform");
42932         var previousStack = _stack[_index];
42933         var previous = previousStack.graph;
42934         while (_index > 0) {
42935           _index--;
42936           if (_stack[_index].annotation) break;
42937         }
42938         dispatch14.call("undone", this, _stack[_index], previousStack);
42939         return change(previous);
42940       },
42941       // Forward to the next annotated state.
42942       redo: function() {
42943         select_default2(document).interrupt("history.perform");
42944         var previousStack = _stack[_index];
42945         var previous = previousStack.graph;
42946         var tryIndex = _index;
42947         while (tryIndex < _stack.length - 1) {
42948           tryIndex++;
42949           if (_stack[tryIndex].annotation) {
42950             _index = tryIndex;
42951             dispatch14.call("redone", this, _stack[_index], previousStack);
42952             break;
42953           }
42954         }
42955         return change(previous);
42956       },
42957       pauseChangeDispatch: function() {
42958         if (!_pausedGraph) {
42959           _pausedGraph = _stack[_index].graph;
42960         }
42961       },
42962       resumeChangeDispatch: function() {
42963         if (_pausedGraph) {
42964           var previous = _pausedGraph;
42965           _pausedGraph = null;
42966           return change(previous);
42967         }
42968       },
42969       undoAnnotation: function() {
42970         var i3 = _index;
42971         while (i3 >= 0) {
42972           if (_stack[i3].annotation) return _stack[i3].annotation;
42973           i3--;
42974         }
42975       },
42976       redoAnnotation: function() {
42977         var i3 = _index + 1;
42978         while (i3 <= _stack.length - 1) {
42979           if (_stack[i3].annotation) return _stack[i3].annotation;
42980           i3++;
42981         }
42982       },
42983       // Returns the entities from the active graph with bounding boxes
42984       // overlapping the given `extent`.
42985       intersects: function(extent) {
42986         return _tree.intersects(extent, _stack[_index].graph);
42987       },
42988       difference: function() {
42989         var base = _stack[0].graph;
42990         var head = _stack[_index].graph;
42991         return coreDifference(base, head);
42992       },
42993       changes: function(action) {
42994         var base = _stack[0].graph;
42995         var head = _stack[_index].graph;
42996         if (action) {
42997           head = action(head);
42998         }
42999         var difference2 = coreDifference(base, head);
43000         return {
43001           modified: difference2.modified(),
43002           created: difference2.created(),
43003           deleted: difference2.deleted()
43004         };
43005       },
43006       hasChanges: function() {
43007         return this.difference().length() > 0;
43008       },
43009       imageryUsed: function(sources) {
43010         if (sources) {
43011           _imageryUsed = sources;
43012           return history;
43013         } else {
43014           var s2 = /* @__PURE__ */ new Set();
43015           _stack.slice(1, _index + 1).forEach(function(state) {
43016             state.imageryUsed.forEach(function(source) {
43017               if (source !== "Custom") {
43018                 s2.add(source);
43019               }
43020             });
43021           });
43022           return Array.from(s2);
43023         }
43024       },
43025       photoOverlaysUsed: function(sources) {
43026         if (sources) {
43027           _photoOverlaysUsed = sources;
43028           return history;
43029         } else {
43030           var s2 = /* @__PURE__ */ new Set();
43031           _stack.slice(1, _index + 1).forEach(function(state) {
43032             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
43033               state.photoOverlaysUsed.forEach(function(photoOverlay) {
43034                 s2.add(photoOverlay);
43035               });
43036             }
43037           });
43038           return Array.from(s2);
43039         }
43040       },
43041       // save the current history state
43042       checkpoint: function(key) {
43043         _checkpoints[key] = {
43044           stack: _stack,
43045           index: _index
43046         };
43047         return history;
43048       },
43049       // restore history state to a given checkpoint or reset completely
43050       reset: function(key) {
43051         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
43052           _stack = _checkpoints[key].stack;
43053           _index = _checkpoints[key].index;
43054         } else {
43055           _stack = [{ graph: coreGraph() }];
43056           _index = 0;
43057           _tree = coreTree(_stack[0].graph);
43058           _checkpoints = {};
43059         }
43060         dispatch14.call("reset");
43061         dispatch14.call("change");
43062         return history;
43063       },
43064       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
43065       //
43066       // To use it:
43067       //  1. Start the walkthrough.
43068       //  2. Get to a "free editing" tutorial step
43069       //  3. Make your edits to the walkthrough map
43070       //  4. In your browser dev console run:
43071       //        `id.history().toIntroGraph()`
43072       //  5. This outputs stringified JSON to the browser console
43073       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
43074       toIntroGraph: function() {
43075         var nextID = { n: 0, r: 0, w: 0 };
43076         var permIDs = {};
43077         var graph = this.graph();
43078         var baseEntities = {};
43079         Object.values(graph.base().entities).forEach(function(entity) {
43080           var copy2 = copyIntroEntity(entity);
43081           baseEntities[copy2.id] = copy2;
43082         });
43083         Object.keys(graph.entities).forEach(function(id2) {
43084           var entity = graph.entities[id2];
43085           if (entity) {
43086             var copy2 = copyIntroEntity(entity);
43087             baseEntities[copy2.id] = copy2;
43088           } else {
43089             delete baseEntities[id2];
43090           }
43091         });
43092         Object.values(baseEntities).forEach(function(entity) {
43093           if (Array.isArray(entity.nodes)) {
43094             entity.nodes = entity.nodes.map(function(node) {
43095               return permIDs[node] || node;
43096             });
43097           }
43098           if (Array.isArray(entity.members)) {
43099             entity.members = entity.members.map(function(member) {
43100               member.id = permIDs[member.id] || member.id;
43101               return member;
43102             });
43103           }
43104         });
43105         return JSON.stringify({ dataIntroGraph: baseEntities });
43106         function copyIntroEntity(source) {
43107           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
43108           if (copy2.tags && !Object.keys(copy2.tags)) {
43109             delete copy2.tags;
43110           }
43111           if (Array.isArray(copy2.loc)) {
43112             copy2.loc[0] = +copy2.loc[0].toFixed(6);
43113             copy2.loc[1] = +copy2.loc[1].toFixed(6);
43114           }
43115           var match = source.id.match(/([nrw])-\d*/);
43116           if (match !== null) {
43117             var nrw = match[1];
43118             var permID;
43119             do {
43120               permID = nrw + ++nextID[nrw];
43121             } while (baseEntities.hasOwnProperty(permID));
43122             copy2.id = permIDs[source.id] = permID;
43123           }
43124           return copy2;
43125         }
43126       },
43127       toJSON: function() {
43128         if (!this.hasChanges()) return;
43129         var allEntities = {};
43130         var baseEntities = {};
43131         var base = _stack[0];
43132         var s2 = _stack.map(function(i3) {
43133           var modified = [];
43134           var deleted = [];
43135           Object.keys(i3.graph.entities).forEach(function(id2) {
43136             var entity = i3.graph.entities[id2];
43137             if (entity) {
43138               var key = osmEntity.key(entity);
43139               allEntities[key] = entity;
43140               modified.push(key);
43141             } else {
43142               deleted.push(id2);
43143             }
43144             if (id2 in base.graph.entities) {
43145               baseEntities[id2] = base.graph.entities[id2];
43146             }
43147             if (entity && entity.nodes) {
43148               entity.nodes.forEach(function(nodeID) {
43149                 if (nodeID in base.graph.entities) {
43150                   baseEntities[nodeID] = base.graph.entities[nodeID];
43151                 }
43152               });
43153             }
43154             var baseParents = base.graph._parentWays[id2];
43155             if (baseParents) {
43156               baseParents.forEach(function(parentID) {
43157                 if (parentID in base.graph.entities) {
43158                   baseEntities[parentID] = base.graph.entities[parentID];
43159                 }
43160               });
43161             }
43162           });
43163           var x2 = {};
43164           if (modified.length) x2.modified = modified;
43165           if (deleted.length) x2.deleted = deleted;
43166           if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
43167           if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
43168           if (i3.annotation) x2.annotation = i3.annotation;
43169           if (i3.transform) x2.transform = i3.transform;
43170           if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
43171           return x2;
43172         });
43173         return JSON.stringify({
43174           version: 3,
43175           entities: Object.values(allEntities),
43176           baseEntities: Object.values(baseEntities),
43177           stack: s2,
43178           nextIDs: osmEntity.id.next,
43179           index: _index,
43180           // note the time the changes were saved
43181           timestamp: (/* @__PURE__ */ new Date()).getTime()
43182         });
43183       },
43184       fromJSON: function(json, loadChildNodes) {
43185         var h2 = JSON.parse(json);
43186         var loadComplete = true;
43187         osmEntity.id.next = h2.nextIDs;
43188         _index = h2.index;
43189         if (h2.version === 2 || h2.version === 3) {
43190           var allEntities = {};
43191           h2.entities.forEach(function(entity) {
43192             allEntities[osmEntity.key(entity)] = osmEntity(entity);
43193           });
43194           if (h2.version === 3) {
43195             var baseEntities = h2.baseEntities.map(function(d2) {
43196               return osmEntity(d2);
43197             });
43198             var stack = _stack.map(function(state) {
43199               return state.graph;
43200             });
43201             _stack[0].graph.rebase(baseEntities, stack, true);
43202             _tree.rebase(baseEntities, true);
43203             if (loadChildNodes) {
43204               var osm = context.connection();
43205               var baseWays = baseEntities.filter(function(e3) {
43206                 return e3.type === "way";
43207               });
43208               var nodeIDs = baseWays.reduce(function(acc, way) {
43209                 return utilArrayUnion(acc, way.nodes);
43210               }, []);
43211               var missing = nodeIDs.filter(function(n3) {
43212                 return !_stack[0].graph.hasEntity(n3);
43213               });
43214               if (missing.length && osm) {
43215                 loadComplete = false;
43216                 context.map().redrawEnable(false);
43217                 var loading = uiLoading(context).blocking(true);
43218                 context.container().call(loading);
43219                 var childNodesLoaded = function(err, result) {
43220                   if (!err) {
43221                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
43222                     var visibles = visibleGroups.true || [];
43223                     var invisibles = visibleGroups.false || [];
43224                     if (visibles.length) {
43225                       var visibleIDs = visibles.map(function(entity) {
43226                         return entity.id;
43227                       });
43228                       var stack2 = _stack.map(function(state) {
43229                         return state.graph;
43230                       });
43231                       missing = utilArrayDifference(missing, visibleIDs);
43232                       _stack[0].graph.rebase(visibles, stack2, true);
43233                       _tree.rebase(visibles, true);
43234                     }
43235                     invisibles.forEach(function(entity) {
43236                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
43237                     });
43238                   }
43239                   if (err || !missing.length) {
43240                     loading.close();
43241                     context.map().redrawEnable(true);
43242                     dispatch14.call("change");
43243                     dispatch14.call("restore", this);
43244                   }
43245                 };
43246                 osm.loadMultiple(missing, childNodesLoaded);
43247               }
43248             }
43249           }
43250           _stack = h2.stack.map(function(d2) {
43251             var entities = {}, entity;
43252             if (d2.modified) {
43253               d2.modified.forEach(function(key) {
43254                 entity = allEntities[key];
43255                 entities[entity.id] = entity;
43256               });
43257             }
43258             if (d2.deleted) {
43259               d2.deleted.forEach(function(id2) {
43260                 entities[id2] = void 0;
43261               });
43262             }
43263             return {
43264               graph: coreGraph(_stack[0].graph).load(entities),
43265               annotation: d2.annotation,
43266               imageryUsed: d2.imageryUsed,
43267               photoOverlaysUsed: d2.photoOverlaysUsed,
43268               transform: d2.transform,
43269               selectedIDs: d2.selectedIDs
43270             };
43271           });
43272         } else {
43273           _stack = h2.stack.map(function(d2) {
43274             var entities = {};
43275             for (var i3 in d2.entities) {
43276               var entity = d2.entities[i3];
43277               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
43278             }
43279             d2.graph = coreGraph(_stack[0].graph).load(entities);
43280             return d2;
43281           });
43282         }
43283         var transform2 = _stack[_index].transform;
43284         if (transform2) {
43285           context.map().transformEase(transform2, 0);
43286         }
43287         if (loadComplete) {
43288           dispatch14.call("change");
43289           dispatch14.call("restore", this);
43290         }
43291         return history;
43292       },
43293       lock: function() {
43294         return lock.lock();
43295       },
43296       unlock: function() {
43297         lock.unlock();
43298       },
43299       save: function() {
43300         if (lock.locked() && // don't overwrite existing, unresolved changes
43301         !_hasUnresolvedRestorableChanges) {
43302           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
43303           if (!success) dispatch14.call("storage_error");
43304         }
43305         return history;
43306       },
43307       // delete the history version saved in localStorage
43308       clearSaved: function() {
43309         context.debouncedSave.cancel();
43310         if (lock.locked()) {
43311           _hasUnresolvedRestorableChanges = false;
43312           corePreferences(getKey("saved_history"), null);
43313           corePreferences("comment", null);
43314           corePreferences("hashtags", null);
43315           corePreferences("source", null);
43316         }
43317         return history;
43318       },
43319       savedHistoryJSON: function() {
43320         return corePreferences(getKey("saved_history"));
43321       },
43322       hasRestorableChanges: function() {
43323         return _hasUnresolvedRestorableChanges;
43324       },
43325       // load history from a version stored in localStorage
43326       restore: function() {
43327         if (lock.locked()) {
43328           _hasUnresolvedRestorableChanges = false;
43329           var json = this.savedHistoryJSON();
43330           if (json) history.fromJSON(json, true);
43331         }
43332       },
43333       _getKey: getKey
43334     };
43335     history.reset();
43336     return utilRebind(history, dispatch14, "on");
43337   }
43338   var init_history = __esm({
43339     "modules/core/history.js"() {
43340       "use strict";
43341       init_src4();
43342       init_src10();
43343       init_src5();
43344       init_preferences();
43345       init_difference();
43346       init_graph();
43347       init_tree();
43348       init_entity();
43349       init_loading();
43350       init_util();
43351     }
43352   });
43353
43354   // modules/util/utilDisplayLabel.js
43355   var utilDisplayLabel_exports = {};
43356   __export(utilDisplayLabel_exports, {
43357     utilDisplayLabel: () => utilDisplayLabel
43358   });
43359   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
43360     var result;
43361     var displayName = utilDisplayName(entity);
43362     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
43363     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
43364     if (verbose) {
43365       result = [presetName, displayName].filter(Boolean).join(" ");
43366     } else {
43367       result = displayName || presetName;
43368     }
43369     return result || utilDisplayType(entity.id);
43370   }
43371   var init_utilDisplayLabel = __esm({
43372     "modules/util/utilDisplayLabel.js"() {
43373       "use strict";
43374       init_presets();
43375       init_util2();
43376     }
43377   });
43378
43379   // modules/validations/almost_junction.js
43380   var almost_junction_exports = {};
43381   __export(almost_junction_exports, {
43382     validationAlmostJunction: () => validationAlmostJunction
43383   });
43384   function validationAlmostJunction(context) {
43385     const type2 = "almost_junction";
43386     const EXTEND_TH_METERS = 5;
43387     const WELD_TH_METERS = 0.75;
43388     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
43389     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
43390     function isHighway(entity) {
43391       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
43392     }
43393     function isTaggedAsNotContinuing(node) {
43394       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
43395     }
43396     const validation = function checkAlmostJunction(entity, graph) {
43397       if (!isHighway(entity)) return [];
43398       if (entity.isDegenerate()) return [];
43399       const tree = context.history().tree();
43400       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
43401       let issues = [];
43402       extendableNodeInfos.forEach((extendableNodeInfo) => {
43403         issues.push(new validationIssue({
43404           type: type2,
43405           subtype: "highway-highway",
43406           severity: "warning",
43407           message: function(context2) {
43408             const entity1 = context2.hasEntity(this.entityIds[0]);
43409             if (this.entityIds[0] === this.entityIds[2]) {
43410               return entity1 ? _t.append("issues.almost_junction.self.message", {
43411                 feature: utilDisplayLabel(entity1, context2.graph())
43412               }) : "";
43413             } else {
43414               const entity2 = context2.hasEntity(this.entityIds[2]);
43415               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
43416                 feature: utilDisplayLabel(entity1, context2.graph()),
43417                 feature2: utilDisplayLabel(entity2, context2.graph())
43418               }) : "";
43419             }
43420           },
43421           reference: showReference,
43422           entityIds: [
43423             entity.id,
43424             extendableNodeInfo.node.id,
43425             extendableNodeInfo.wid
43426           ],
43427           loc: extendableNodeInfo.node.loc,
43428           hash: JSON.stringify(extendableNodeInfo.node.loc),
43429           data: {
43430             midId: extendableNodeInfo.mid.id,
43431             edge: extendableNodeInfo.edge,
43432             cross_loc: extendableNodeInfo.cross_loc
43433           },
43434           dynamicFixes: makeFixes
43435         }));
43436       });
43437       return issues;
43438       function makeFixes(context2) {
43439         let fixes = [new validationIssueFix({
43440           icon: "iD-icon-abutment",
43441           title: _t.append("issues.fix.connect_features.title"),
43442           onClick: function(context3) {
43443             const annotation = _t("issues.fix.connect_almost_junction.annotation");
43444             const [, endNodeId, crossWayId] = this.issue.entityIds;
43445             const midNode = context3.entity(this.issue.data.midId);
43446             const endNode = context3.entity(endNodeId);
43447             const crossWay = context3.entity(crossWayId);
43448             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
43449             if (nearEndNodes.length > 0) {
43450               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
43451               if (collinear) {
43452                 context3.perform(
43453                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
43454                   annotation
43455                 );
43456                 return;
43457               }
43458             }
43459             const targetEdge = this.issue.data.edge;
43460             const crossLoc = this.issue.data.cross_loc;
43461             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
43462             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
43463             if (closestNodeInfo.distance < WELD_TH_METERS) {
43464               context3.perform(
43465                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
43466                 annotation
43467               );
43468             } else {
43469               context3.perform(
43470                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
43471                 annotation
43472               );
43473             }
43474           }
43475         })];
43476         const node = context2.hasEntity(this.entityIds[1]);
43477         if (node && !node.hasInterestingTags()) {
43478           fixes.push(new validationIssueFix({
43479             icon: "maki-barrier",
43480             title: _t.append("issues.fix.tag_as_disconnected.title"),
43481             onClick: function(context3) {
43482               const nodeID = this.issue.entityIds[1];
43483               const tags = Object.assign({}, context3.entity(nodeID).tags);
43484               tags.noexit = "yes";
43485               context3.perform(
43486                 actionChangeTags(nodeID, tags),
43487                 _t("issues.fix.tag_as_disconnected.annotation")
43488               );
43489             }
43490           }));
43491         }
43492         return fixes;
43493       }
43494       function showReference(selection2) {
43495         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
43496       }
43497       function isExtendableCandidate(node, way) {
43498         const osm = services.osm;
43499         if (osm && !osm.isDataLoaded(node.loc)) {
43500           return false;
43501         }
43502         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
43503           return false;
43504         }
43505         let occurrences = 0;
43506         for (const index in way.nodes) {
43507           if (way.nodes[index] === node.id) {
43508             occurrences += 1;
43509             if (occurrences > 1) {
43510               return false;
43511             }
43512           }
43513         }
43514         return true;
43515       }
43516       function findConnectableEndNodesByExtension(way) {
43517         let results = [];
43518         if (way.isClosed()) return results;
43519         let testNodes;
43520         const indices = [0, way.nodes.length - 1];
43521         indices.forEach((nodeIndex) => {
43522           const nodeID = way.nodes[nodeIndex];
43523           const node = graph.entity(nodeID);
43524           if (!isExtendableCandidate(node, way)) return;
43525           const connectionInfo = canConnectByExtend(way, nodeIndex);
43526           if (!connectionInfo) return;
43527           testNodes = graph.childNodes(way).slice();
43528           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
43529           if (geoHasSelfIntersections(testNodes, nodeID)) return;
43530           results.push(connectionInfo);
43531         });
43532         return results;
43533       }
43534       function findNearbyEndNodes(node, way) {
43535         return [
43536           way.nodes[0],
43537           way.nodes[way.nodes.length - 1]
43538         ].map((d2) => graph.entity(d2)).filter((d2) => {
43539           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
43540         });
43541       }
43542       function findSmallJoinAngle(midNode, tipNode, endNodes) {
43543         let joinTo;
43544         let minAngle = Infinity;
43545         endNodes.forEach((endNode) => {
43546           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
43547           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
43548           const diff = Math.max(a1, a2) - Math.min(a1, a2);
43549           if (diff < minAngle) {
43550             joinTo = endNode;
43551             minAngle = diff;
43552           }
43553         });
43554         if (minAngle <= SIG_ANGLE_TH) return joinTo;
43555         return null;
43556       }
43557       function hasTag(tags, key) {
43558         return tags[key] !== void 0 && tags[key] !== "no";
43559       }
43560       function canConnectWays(way, way2) {
43561         if (way.id === way2.id) return true;
43562         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
43563         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
43564         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
43565         if (layer1 !== layer2) return false;
43566         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
43567         if (level1 !== level2) return false;
43568         return true;
43569       }
43570       function canConnectByExtend(way, endNodeIdx) {
43571         const tipNid = way.nodes[endNodeIdx];
43572         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
43573         const tipNode = graph.entity(tipNid);
43574         const midNode = graph.entity(midNid);
43575         const lon = tipNode.loc[0];
43576         const lat = tipNode.loc[1];
43577         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
43578         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
43579         const queryExtent = geoExtent([
43580           [lon - lon_range, lat - lat_range],
43581           [lon + lon_range, lat + lat_range]
43582         ]);
43583         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
43584         const t2 = EXTEND_TH_METERS / edgeLen + 1;
43585         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
43586         const segmentInfos = tree.waySegments(queryExtent, graph);
43587         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
43588           let segmentInfo = segmentInfos[i3];
43589           let way2 = graph.entity(segmentInfo.wayId);
43590           if (!isHighway(way2)) continue;
43591           if (!canConnectWays(way, way2)) continue;
43592           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
43593           if (nAid === tipNid || nBid === tipNid) continue;
43594           let nA = graph.entity(nAid), nB = graph.entity(nBid);
43595           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
43596           if (crossLoc) {
43597             return {
43598               mid: midNode,
43599               node: tipNode,
43600               wid: way2.id,
43601               edge: [nA.id, nB.id],
43602               cross_loc: crossLoc
43603             };
43604           }
43605         }
43606         return null;
43607       }
43608     };
43609     validation.type = type2;
43610     return validation;
43611   }
43612   var init_almost_junction = __esm({
43613     "modules/validations/almost_junction.js"() {
43614       "use strict";
43615       init_geo2();
43616       init_add_midpoint();
43617       init_change_tags();
43618       init_merge_nodes();
43619       init_localizer();
43620       init_utilDisplayLabel();
43621       init_tags();
43622       init_validation();
43623       init_services();
43624     }
43625   });
43626
43627   // modules/validations/close_nodes.js
43628   var close_nodes_exports = {};
43629   __export(close_nodes_exports, {
43630     validationCloseNodes: () => validationCloseNodes
43631   });
43632   function validationCloseNodes(context) {
43633     var type2 = "close_nodes";
43634     var pointThresholdMeters = 0.2;
43635     var validation = function(entity, graph) {
43636       if (entity.type === "node") {
43637         return getIssuesForNode(entity);
43638       } else if (entity.type === "way") {
43639         return getIssuesForWay(entity);
43640       }
43641       return [];
43642       function getIssuesForNode(node) {
43643         var parentWays = graph.parentWays(node);
43644         if (parentWays.length) {
43645           return getIssuesForVertex(node, parentWays);
43646         } else {
43647           return getIssuesForDetachedPoint(node);
43648         }
43649       }
43650       function wayTypeFor(way) {
43651         if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
43652         if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
43653         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
43654         if (osmPathHighwayTagValues[way.tags.highway]) return "path";
43655         var parentRelations = graph.parentRelations(way);
43656         for (var i3 in parentRelations) {
43657           var relation = parentRelations[i3];
43658           if (relation.tags.type === "boundary") return "boundary";
43659           if (relation.isMultipolygon()) {
43660             if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
43661             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
43662           }
43663         }
43664         return "other";
43665       }
43666       function shouldCheckWay(way) {
43667         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
43668         var bbox2 = way.extent(graph).bbox();
43669         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
43670         if (hypotenuseMeters < 1.5) return false;
43671         return true;
43672       }
43673       function getIssuesForWay(way) {
43674         if (!shouldCheckWay(way)) return [];
43675         var issues = [], nodes = graph.childNodes(way);
43676         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
43677           var node1 = nodes[i3];
43678           var node2 = nodes[i3 + 1];
43679           var issue = getWayIssueIfAny(node1, node2, way);
43680           if (issue) issues.push(issue);
43681         }
43682         return issues;
43683       }
43684       function getIssuesForVertex(node, parentWays) {
43685         var issues = [];
43686         function checkForCloseness(node1, node2, way) {
43687           var issue = getWayIssueIfAny(node1, node2, way);
43688           if (issue) issues.push(issue);
43689         }
43690         for (var i3 = 0; i3 < parentWays.length; i3++) {
43691           var parentWay = parentWays[i3];
43692           if (!shouldCheckWay(parentWay)) continue;
43693           var lastIndex = parentWay.nodes.length - 1;
43694           for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
43695             if (j2 !== 0) {
43696               if (parentWay.nodes[j2 - 1] === node.id) {
43697                 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
43698               }
43699             }
43700             if (j2 !== lastIndex) {
43701               if (parentWay.nodes[j2 + 1] === node.id) {
43702                 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
43703               }
43704             }
43705           }
43706         }
43707         return issues;
43708       }
43709       function thresholdMetersForWay(way) {
43710         if (!shouldCheckWay(way)) return 0;
43711         var wayType = wayTypeFor(way);
43712         if (wayType === "boundary") return 0;
43713         if (wayType === "indoor") return 0.01;
43714         if (wayType === "building") return 0.05;
43715         if (wayType === "path") return 0.1;
43716         return 0.2;
43717       }
43718       function getIssuesForDetachedPoint(node) {
43719         var issues = [];
43720         var lon = node.loc[0];
43721         var lat = node.loc[1];
43722         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
43723         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
43724         var queryExtent = geoExtent([
43725           [lon - lon_range, lat - lat_range],
43726           [lon + lon_range, lat + lat_range]
43727         ]);
43728         var intersected = context.history().tree().intersects(queryExtent, graph);
43729         for (var j2 = 0; j2 < intersected.length; j2++) {
43730           var nearby = intersected[j2];
43731           if (nearby.id === node.id) continue;
43732           if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
43733           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
43734             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
43735             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
43736             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
43737             var zAxisDifferentiates = false;
43738             for (var key in zAxisKeys) {
43739               var nodeValue = node.tags[key] || "0";
43740               var nearbyValue = nearby.tags[key] || "0";
43741               if (nodeValue !== nearbyValue) {
43742                 zAxisDifferentiates = true;
43743                 break;
43744               }
43745             }
43746             if (zAxisDifferentiates) continue;
43747             issues.push(new validationIssue({
43748               type: type2,
43749               subtype: "detached",
43750               severity: "warning",
43751               message: function(context2) {
43752                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
43753                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
43754                   feature: utilDisplayLabel(entity2, context2.graph()),
43755                   feature2: utilDisplayLabel(entity22, context2.graph())
43756                 }) : "";
43757               },
43758               reference: showReference,
43759               entityIds: [node.id, nearby.id],
43760               dynamicFixes: function() {
43761                 return [
43762                   new validationIssueFix({
43763                     icon: "iD-operation-disconnect",
43764                     title: _t.append("issues.fix.move_points_apart.title")
43765                   }),
43766                   new validationIssueFix({
43767                     icon: "iD-icon-layers",
43768                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
43769                   })
43770                 ];
43771               }
43772             }));
43773           }
43774         }
43775         return issues;
43776         function showReference(selection2) {
43777           var referenceText = _t("issues.close_nodes.detached.reference");
43778           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43779         }
43780       }
43781       function getWayIssueIfAny(node1, node2, way) {
43782         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
43783           return null;
43784         }
43785         if (node1.loc !== node2.loc) {
43786           var parentWays1 = graph.parentWays(node1);
43787           var parentWays2 = new Set(graph.parentWays(node2));
43788           var sharedWays = parentWays1.filter(function(parentWay) {
43789             return parentWays2.has(parentWay);
43790           });
43791           var thresholds = sharedWays.map(function(parentWay) {
43792             return thresholdMetersForWay(parentWay);
43793           });
43794           var threshold = Math.min(...thresholds);
43795           var distance = geoSphericalDistance(node1.loc, node2.loc);
43796           if (distance > threshold) return null;
43797         }
43798         return new validationIssue({
43799           type: type2,
43800           subtype: "vertices",
43801           severity: "warning",
43802           message: function(context2) {
43803             var entity2 = context2.hasEntity(this.entityIds[0]);
43804             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
43805           },
43806           reference: showReference,
43807           entityIds: [way.id, node1.id, node2.id],
43808           loc: node1.loc,
43809           dynamicFixes: function() {
43810             return [
43811               new validationIssueFix({
43812                 icon: "iD-icon-plus",
43813                 title: _t.append("issues.fix.merge_points.title"),
43814                 onClick: function(context2) {
43815                   var entityIds = this.issue.entityIds;
43816                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
43817                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
43818                 }
43819               }),
43820               new validationIssueFix({
43821                 icon: "iD-operation-disconnect",
43822                 title: _t.append("issues.fix.move_points_apart.title")
43823               })
43824             ];
43825           }
43826         });
43827         function showReference(selection2) {
43828           var referenceText = _t("issues.close_nodes.reference");
43829           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43830         }
43831       }
43832     };
43833     validation.type = type2;
43834     return validation;
43835   }
43836   var init_close_nodes = __esm({
43837     "modules/validations/close_nodes.js"() {
43838       "use strict";
43839       init_merge_nodes();
43840       init_utilDisplayLabel();
43841       init_localizer();
43842       init_validation();
43843       init_tags();
43844       init_geo();
43845       init_extent();
43846     }
43847   });
43848
43849   // modules/validations/crossing_ways.js
43850   var crossing_ways_exports = {};
43851   __export(crossing_ways_exports, {
43852     validationCrossingWays: () => validationCrossingWays
43853   });
43854   function validationCrossingWays(context) {
43855     var type2 = "crossing_ways";
43856     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
43857       if (getFeatureType(way, graph) === null) {
43858         var parentRels = graph.parentRelations(way);
43859         for (var i3 = 0; i3 < parentRels.length; i3++) {
43860           var rel = parentRels[i3];
43861           if (getFeatureType(rel, graph) !== null) {
43862             return rel;
43863           }
43864         }
43865       }
43866       return way;
43867     }
43868     function hasTag(tags, key) {
43869       return tags[key] !== void 0 && tags[key] !== "no";
43870     }
43871     function taggedAsIndoor(tags) {
43872       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
43873     }
43874     function allowsBridge(featureType) {
43875       return featureType === "highway" || featureType === "railway" || featureType === "waterway" || featureType === "aeroway";
43876     }
43877     function allowsTunnel(featureType) {
43878       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43879     }
43880     var ignoredBuildings = {
43881       demolished: true,
43882       dismantled: true,
43883       proposed: true,
43884       razed: true
43885     };
43886     function getFeatureType(entity, graph) {
43887       var geometry = entity.geometry(graph);
43888       if (geometry !== "line" && geometry !== "area") return null;
43889       var tags = entity.tags;
43890       if (tags.aeroway in osmRoutableAerowayTags) return "aeroway";
43891       if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
43892       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
43893       if (geometry !== "line") return null;
43894       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
43895       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
43896       return null;
43897     }
43898     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
43899       var level1 = tags1.level || "0";
43900       var level2 = tags2.level || "0";
43901       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
43902         return true;
43903       }
43904       var layer1 = tags1.layer || "0";
43905       var layer2 = tags2.layer || "0";
43906       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
43907         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
43908         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
43909         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
43910       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
43911       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
43912       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
43913         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
43914         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
43915         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
43916       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
43917       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
43918       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
43919       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
43920       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
43921         if (layer1 !== layer2) return true;
43922       }
43923       return false;
43924     }
43925     var highwaysDisallowingFords = {
43926       motorway: true,
43927       motorway_link: true,
43928       trunk: true,
43929       trunk_link: true,
43930       primary: true,
43931       primary_link: true,
43932       secondary: true,
43933       secondary_link: true
43934     };
43935     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
43936       var featureType1 = getFeatureType(entity1, graph);
43937       var featureType2 = getFeatureType(entity2, graph);
43938       var geometry1 = entity1.geometry(graph);
43939       var geometry2 = entity2.geometry(graph);
43940       var bothLines = geometry1 === "line" && geometry2 === "line";
43941       const featureTypes = [featureType1, featureType2].sort().join("-");
43942       if (featureTypes === "aeroway-aeroway") return {};
43943       if (featureTypes === "aeroway-highway") {
43944         const isServiceRoad = entity1.tags.highway === "service" || entity2.tags.highway === "service";
43945         const isPath = entity1.tags.highway in osmPathHighwayTagValues || entity2.tags.highway in osmPathHighwayTagValues;
43946         return isServiceRoad || isPath ? {} : { aeroway: "aircraft_crossing" };
43947       }
43948       if (featureTypes === "aeroway-railway") {
43949         return { aeroway: "aircraft_crossing", railway: "level_crossing" };
43950       }
43951       if (featureTypes === "aeroway-waterway") return null;
43952       if (featureType1 === featureType2) {
43953         if (featureType1 === "highway") {
43954           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
43955           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
43956           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
43957             if (!bothLines) return {};
43958             var roadFeature = entity1IsPath ? entity2 : entity1;
43959             var pathFeature = entity1IsPath ? entity1 : entity2;
43960             if (roadFeature.tags.highway === "track") {
43961               return {};
43962             }
43963             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
43964               return {};
43965             }
43966             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
43967               var tags = { highway: "crossing", crossing: pathFeature.tags.crossing };
43968               if ("crossing:markings" in pathFeature.tags) {
43969                 tags["crossing:markings"] = pathFeature.tags["crossing:markings"];
43970               }
43971               return tags;
43972             }
43973             return { highway: "crossing" };
43974           }
43975           return {};
43976         }
43977         if (featureType1 === "waterway") return {};
43978         if (featureType1 === "railway") return {};
43979       } else {
43980         if (featureTypes.indexOf("highway") !== -1) {
43981           if (featureTypes.indexOf("railway") !== -1) {
43982             if (!bothLines) return {};
43983             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
43984             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
43985               if (isTram) return { railway: "tram_crossing" };
43986               return { railway: "crossing" };
43987             } else {
43988               if (isTram) return { railway: "tram_level_crossing" };
43989               return { railway: "level_crossing" };
43990             }
43991           }
43992           if (featureTypes.indexOf("waterway") !== -1) {
43993             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
43994             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
43995             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
43996               return null;
43997             }
43998             return bothLines ? { ford: "yes" } : {};
43999           }
44000         }
44001       }
44002       return null;
44003     }
44004     function findCrossingsByWay(way1, graph, tree) {
44005       var edgeCrossInfos = [];
44006       if (way1.type !== "way") return edgeCrossInfos;
44007       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
44008       var way1FeatureType = getFeatureType(taggedFeature1, graph);
44009       if (way1FeatureType === null) return edgeCrossInfos;
44010       var checkedSingleCrossingWays = {};
44011       var i3, j2;
44012       var extent;
44013       var n1, n22, nA, nB, nAId, nBId;
44014       var segment1, segment2;
44015       var oneOnly;
44016       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
44017       var way1Nodes = graph.childNodes(way1);
44018       var comparedWays = {};
44019       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
44020         n1 = way1Nodes[i3];
44021         n22 = way1Nodes[i3 + 1];
44022         extent = geoExtent([
44023           [
44024             Math.min(n1.loc[0], n22.loc[0]),
44025             Math.min(n1.loc[1], n22.loc[1])
44026           ],
44027           [
44028             Math.max(n1.loc[0], n22.loc[0]),
44029             Math.max(n1.loc[1], n22.loc[1])
44030           ]
44031         ]);
44032         segmentInfos = tree.waySegments(extent, graph);
44033         for (j2 = 0; j2 < segmentInfos.length; j2++) {
44034           segment2Info = segmentInfos[j2];
44035           if (segment2Info.wayId === way1.id) continue;
44036           if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
44037           comparedWays[segment2Info.wayId] = true;
44038           way2 = graph.hasEntity(segment2Info.wayId);
44039           if (!way2) continue;
44040           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
44041           way2FeatureType = getFeatureType(taggedFeature2, graph);
44042           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
44043             continue;
44044           }
44045           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
44046           nAId = segment2Info.nodes[0];
44047           nBId = segment2Info.nodes[1];
44048           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
44049             continue;
44050           }
44051           nA = graph.hasEntity(nAId);
44052           if (!nA) continue;
44053           nB = graph.hasEntity(nBId);
44054           if (!nB) continue;
44055           segment1 = [n1.loc, n22.loc];
44056           segment2 = [nA.loc, nB.loc];
44057           var point = geoLineIntersection(segment1, segment2);
44058           if (point) {
44059             edgeCrossInfos.push({
44060               wayInfos: [
44061                 {
44062                   way: way1,
44063                   featureType: way1FeatureType,
44064                   edge: [n1.id, n22.id]
44065                 },
44066                 {
44067                   way: way2,
44068                   featureType: way2FeatureType,
44069                   edge: [nA.id, nB.id]
44070                 }
44071               ],
44072               crossPoint: point
44073             });
44074             if (oneOnly) {
44075               checkedSingleCrossingWays[way2.id] = true;
44076               break;
44077             }
44078           }
44079         }
44080       }
44081       return edgeCrossInfos;
44082     }
44083     function waysToCheck(entity, graph) {
44084       var featureType = getFeatureType(entity, graph);
44085       if (!featureType) return [];
44086       if (entity.type === "way") {
44087         return [entity];
44088       } else if (entity.type === "relation") {
44089         return entity.members.reduce(function(array2, member) {
44090           if (member.type === "way" && // only look at geometry ways
44091           (!member.role || member.role === "outer" || member.role === "inner")) {
44092             var entity2 = graph.hasEntity(member.id);
44093             if (entity2 && array2.indexOf(entity2) === -1) {
44094               array2.push(entity2);
44095             }
44096           }
44097           return array2;
44098         }, []);
44099       }
44100       return [];
44101     }
44102     var validation = function checkCrossingWays(entity, graph) {
44103       var tree = context.history().tree();
44104       var ways = waysToCheck(entity, graph);
44105       var issues = [];
44106       var wayIndex, crossingIndex, crossings;
44107       for (wayIndex in ways) {
44108         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
44109         for (crossingIndex in crossings) {
44110           issues.push(createIssue(crossings[crossingIndex], graph));
44111         }
44112       }
44113       return issues;
44114     };
44115     function createIssue(crossing, graph) {
44116       crossing.wayInfos.sort(function(way1Info, way2Info) {
44117         var type1 = way1Info.featureType;
44118         var type22 = way2Info.featureType;
44119         if (type1 === type22) {
44120           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
44121         } else if (type1 === "waterway") {
44122           return true;
44123         } else if (type22 === "waterway") {
44124           return false;
44125         }
44126         return type1 < type22;
44127       });
44128       var entities = crossing.wayInfos.map(function(wayInfo) {
44129         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
44130       });
44131       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
44132       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
44133       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
44134       var featureType1 = crossing.wayInfos[0].featureType;
44135       var featureType2 = crossing.wayInfos[1].featureType;
44136       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
44137       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
44138       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
44139       var subtype = [featureType1, featureType2].sort().join("-");
44140       var crossingTypeID = subtype;
44141       if (isCrossingIndoors) {
44142         crossingTypeID = "indoor-indoor";
44143       } else if (isCrossingTunnels) {
44144         crossingTypeID = "tunnel-tunnel";
44145       } else if (isCrossingBridges) {
44146         crossingTypeID = "bridge-bridge";
44147       }
44148       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
44149         crossingTypeID += "_connectable";
44150       }
44151       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
44152       return new validationIssue({
44153         type: type2,
44154         subtype,
44155         severity: "warning",
44156         message: function(context2) {
44157           var graph2 = context2.graph();
44158           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
44159           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
44160             feature: utilDisplayLabel(entity1, graph2),
44161             feature2: utilDisplayLabel(entity2, graph2)
44162           }) : "";
44163         },
44164         reference: showReference,
44165         entityIds: entities.map(function(entity) {
44166           return entity.id;
44167         }),
44168         data: {
44169           edges,
44170           featureTypes,
44171           connectionTags
44172         },
44173         hash: uniqueID,
44174         loc: crossing.crossPoint,
44175         dynamicFixes: function(context2) {
44176           var mode = context2.mode();
44177           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
44178           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
44179           var selectedFeatureType = this.data.featureTypes[selectedIndex];
44180           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
44181           var fixes = [];
44182           if (connectionTags) {
44183             fixes.push(makeConnectWaysFix(this.data.connectionTags));
44184             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
44185             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
44186               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
44187             }
44188           }
44189           if (isCrossingIndoors) {
44190             fixes.push(new validationIssueFix({
44191               icon: "iD-icon-layers",
44192               title: _t.append("issues.fix.use_different_levels.title")
44193             }));
44194           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
44195             fixes.push(makeChangeLayerFix("higher"));
44196             fixes.push(makeChangeLayerFix("lower"));
44197           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
44198             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
44199               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
44200             }
44201             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
44202             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
44203               if (selectedFeatureType === "waterway") {
44204                 fixes.push(makeAddBridgeOrTunnelFix("add_a_culvert", "temaki-waste", "tunnel"));
44205               } else {
44206                 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
44207               }
44208             }
44209           }
44210           fixes.push(new validationIssueFix({
44211             icon: "iD-operation-move",
44212             title: _t.append("issues.fix.reposition_features.title")
44213           }));
44214           return fixes;
44215         }
44216       });
44217       function showReference(selection2) {
44218         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
44219       }
44220     }
44221     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
44222       return new validationIssueFix({
44223         icon: iconName,
44224         title: _t.append("issues.fix." + fixTitleID + ".title"),
44225         onClick: function(context2) {
44226           var mode = context2.mode();
44227           if (!mode || mode.id !== "select") return;
44228           var selectedIDs = mode.selectedIDs();
44229           if (selectedIDs.length !== 1) return;
44230           var selectedWayID = selectedIDs[0];
44231           if (!context2.hasEntity(selectedWayID)) return;
44232           var resultWayIDs = [selectedWayID];
44233           var edge, crossedEdge, crossedWayID;
44234           if (this.issue.entityIds[0] === selectedWayID) {
44235             edge = this.issue.data.edges[0];
44236             crossedEdge = this.issue.data.edges[1];
44237             crossedWayID = this.issue.entityIds[1];
44238           } else {
44239             edge = this.issue.data.edges[1];
44240             crossedEdge = this.issue.data.edges[0];
44241             crossedWayID = this.issue.entityIds[0];
44242           }
44243           var crossingLoc = this.issue.loc;
44244           var projection2 = context2.projection;
44245           var action = function actionAddStructure(graph) {
44246             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44247             var crossedWay = graph.hasEntity(crossedWayID);
44248             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
44249             if (!structLengthMeters) {
44250               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
44251             }
44252             if (structLengthMeters) {
44253               if (getFeatureType(crossedWay, graph) === "railway") {
44254                 structLengthMeters *= 2;
44255               }
44256             } else {
44257               structLengthMeters = 8;
44258             }
44259             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
44260             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
44261             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
44262             if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
44263             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
44264             structLengthMeters += 4;
44265             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
44266             function geomToProj(geoPoint) {
44267               return [
44268                 geoLonToMeters(geoPoint[0], geoPoint[1]),
44269                 geoLatToMeters(geoPoint[1])
44270               ];
44271             }
44272             function projToGeom(projPoint) {
44273               var lat = geoMetersToLat(projPoint[1]);
44274               return [
44275                 geoMetersToLon(projPoint[0], lat),
44276                 lat
44277               ];
44278             }
44279             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
44280             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
44281             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
44282             var projectedCrossingLoc = geomToProj(crossingLoc);
44283             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
44284             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
44285               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
44286               return projToGeom([
44287                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
44288                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
44289               ]);
44290             }
44291             var endpointLocGetter1 = function(lengthMeters) {
44292               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
44293             };
44294             var endpointLocGetter2 = function(lengthMeters) {
44295               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
44296             };
44297             var minEdgeLengthMeters = 0.55;
44298             function determineEndpoint(edge2, endNode, locGetter) {
44299               var newNode;
44300               var idealLengthMeters = structLengthMeters / 2;
44301               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
44302               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
44303                 var idealNodeLoc = locGetter(idealLengthMeters);
44304                 newNode = osmNode();
44305                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
44306               } else {
44307                 var edgeCount = 0;
44308                 endNode.parentIntersectionWays(graph).forEach(function(way) {
44309                   way.nodes.forEach(function(nodeID) {
44310                     if (nodeID === endNode.id) {
44311                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
44312                         edgeCount += 1;
44313                       } else {
44314                         edgeCount += 2;
44315                       }
44316                     }
44317                   });
44318                 });
44319                 if (edgeCount >= 3) {
44320                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
44321                   if (insetLength > minEdgeLengthMeters) {
44322                     var insetNodeLoc = locGetter(insetLength);
44323                     newNode = osmNode();
44324                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
44325                   }
44326                 }
44327               }
44328               if (!newNode) newNode = endNode;
44329               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
44330               graph = splitAction(graph);
44331               if (splitAction.getCreatedWayIDs().length) {
44332                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
44333               }
44334               return newNode;
44335             }
44336             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
44337             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
44338             var structureWay = resultWayIDs.map(function(id2) {
44339               return graph.entity(id2);
44340             }).find(function(way) {
44341               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
44342             });
44343             var tags = Object.assign({}, structureWay.tags);
44344             if (bridgeOrTunnel === "bridge") {
44345               tags.bridge = "yes";
44346               tags.layer = "1";
44347             } else {
44348               var tunnelValue = "yes";
44349               if (getFeatureType(structureWay, graph) === "waterway") {
44350                 tunnelValue = "culvert";
44351               }
44352               tags.tunnel = tunnelValue;
44353               tags.layer = "-1";
44354             }
44355             graph = actionChangeTags(structureWay.id, tags)(graph);
44356             return graph;
44357           };
44358           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
44359           context2.enter(modeSelect(context2, resultWayIDs));
44360         }
44361       });
44362     }
44363     function makeConnectWaysFix(connectionTags) {
44364       var fixTitleID = "connect_features";
44365       var fixIcon = "iD-icon-crossing";
44366       if (connectionTags.highway === "crossing") {
44367         fixTitleID = "connect_using_crossing";
44368         fixIcon = "temaki-pedestrian";
44369       }
44370       if (connectionTags.ford) {
44371         fixTitleID = "connect_using_ford";
44372         fixIcon = "roentgen-ford";
44373       }
44374       const fix = new validationIssueFix({
44375         icon: fixIcon,
44376         title: _t.append("issues.fix." + fixTitleID + ".title"),
44377         onClick: function(context2) {
44378           var loc = this.issue.loc;
44379           var edges = this.issue.data.edges;
44380           context2.perform(
44381             function actionConnectCrossingWays(graph) {
44382               var node = osmNode({ loc, tags: connectionTags });
44383               graph = graph.replace(node);
44384               var nodesToMerge = [node.id];
44385               var mergeThresholdInMeters = 0.75;
44386               edges.forEach(function(edge) {
44387                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44388                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
44389                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
44390                   nodesToMerge.push(nearby.node.id);
44391                 } else {
44392                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
44393                 }
44394               });
44395               if (nodesToMerge.length > 1) {
44396                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
44397               }
44398               return graph;
44399             },
44400             _t("issues.fix.connect_crossing_features.annotation")
44401           );
44402         }
44403       });
44404       fix._connectionTags = connectionTags;
44405       return fix;
44406     }
44407     function makeChangeLayerFix(higherOrLower) {
44408       return new validationIssueFix({
44409         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
44410         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
44411         onClick: function(context2) {
44412           var mode = context2.mode();
44413           if (!mode || mode.id !== "select") return;
44414           var selectedIDs = mode.selectedIDs();
44415           if (selectedIDs.length !== 1) return;
44416           var selectedID = selectedIDs[0];
44417           if (!this.issue.entityIds.some(function(entityId) {
44418             return entityId === selectedID;
44419           })) return;
44420           var entity = context2.hasEntity(selectedID);
44421           if (!entity) return;
44422           var tags = Object.assign({}, entity.tags);
44423           var layer = tags.layer && Number(tags.layer);
44424           if (layer && !isNaN(layer)) {
44425             if (higherOrLower === "higher") {
44426               layer += 1;
44427             } else {
44428               layer -= 1;
44429             }
44430           } else {
44431             if (higherOrLower === "higher") {
44432               layer = 1;
44433             } else {
44434               layer = -1;
44435             }
44436           }
44437           tags.layer = layer.toString();
44438           context2.perform(
44439             actionChangeTags(entity.id, tags),
44440             _t("operations.change_tags.annotation")
44441           );
44442         }
44443       });
44444     }
44445     validation.type = type2;
44446     return validation;
44447   }
44448   var import_lodash3;
44449   var init_crossing_ways = __esm({
44450     "modules/validations/crossing_ways.js"() {
44451       "use strict";
44452       import_lodash3 = __toESM(require_lodash());
44453       init_add_midpoint();
44454       init_change_tags();
44455       init_merge_nodes();
44456       init_split();
44457       init_select5();
44458       init_geo2();
44459       init_node2();
44460       init_tags();
44461       init_localizer();
44462       init_utilDisplayLabel();
44463       init_validation();
44464     }
44465   });
44466
44467   // modules/behavior/draw_way.js
44468   var draw_way_exports = {};
44469   __export(draw_way_exports, {
44470     behaviorDrawWay: () => behaviorDrawWay
44471   });
44472   function behaviorDrawWay(context, wayID, mode, startGraph) {
44473     const keybinding = utilKeybinding("drawWay");
44474     var dispatch14 = dispatch_default("rejectedSelfIntersection");
44475     var behavior = behaviorDraw(context);
44476     var _nodeIndex;
44477     var _origWay;
44478     var _wayGeometry;
44479     var _headNodeID;
44480     var _annotation;
44481     var _pointerHasMoved = false;
44482     var _drawNode;
44483     var _didResolveTempEdit = false;
44484     function createDrawNode(loc) {
44485       _drawNode = osmNode({ loc });
44486       context.pauseChangeDispatch();
44487       context.replace(function actionAddDrawNode(graph) {
44488         var way = graph.entity(wayID);
44489         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
44490       }, _annotation);
44491       context.resumeChangeDispatch();
44492       setActiveElements();
44493     }
44494     function removeDrawNode() {
44495       context.pauseChangeDispatch();
44496       context.replace(
44497         function actionDeleteDrawNode(graph) {
44498           var way = graph.entity(wayID);
44499           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
44500         },
44501         _annotation
44502       );
44503       _drawNode = void 0;
44504       context.resumeChangeDispatch();
44505     }
44506     function keydown(d3_event) {
44507       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44508         if (context.surface().classed("nope")) {
44509           context.surface().classed("nope-suppressed", true);
44510         }
44511         context.surface().classed("nope", false).classed("nope-disabled", true);
44512       }
44513     }
44514     function keyup(d3_event) {
44515       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44516         if (context.surface().classed("nope-suppressed")) {
44517           context.surface().classed("nope", true);
44518         }
44519         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
44520       }
44521     }
44522     function allowsVertex(d2) {
44523       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
44524     }
44525     function move(d3_event, datum2) {
44526       var loc = context.map().mouseCoordinates();
44527       if (!_drawNode) createDrawNode(loc);
44528       context.surface().classed("nope-disabled", d3_event.altKey);
44529       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
44530       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
44531       if (targetLoc) {
44532         loc = targetLoc;
44533       } else if (targetNodes) {
44534         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
44535         if (choice) {
44536           loc = choice.loc;
44537         }
44538       }
44539       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
44540       _drawNode = context.entity(_drawNode.id);
44541       checkGeometry(
44542         true
44543         /* includeDrawNode */
44544       );
44545     }
44546     function checkGeometry(includeDrawNode) {
44547       var nopeDisabled = context.surface().classed("nope-disabled");
44548       var isInvalid = isInvalidGeometry(includeDrawNode);
44549       if (nopeDisabled) {
44550         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
44551       } else {
44552         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
44553       }
44554     }
44555     function isInvalidGeometry(includeDrawNode) {
44556       var testNode = _drawNode;
44557       var parentWay = context.graph().entity(wayID);
44558       var nodes = context.graph().childNodes(parentWay).slice();
44559       if (includeDrawNode) {
44560         if (parentWay.isClosed()) {
44561           nodes.pop();
44562         }
44563       } else {
44564         if (parentWay.isClosed()) {
44565           if (nodes.length < 3) return false;
44566           if (_drawNode) nodes.splice(-2, 1);
44567           testNode = nodes[nodes.length - 2];
44568         } else {
44569           return false;
44570         }
44571       }
44572       return testNode && geoHasSelfIntersections(nodes, testNode.id);
44573     }
44574     function undone() {
44575       _didResolveTempEdit = true;
44576       context.pauseChangeDispatch();
44577       var nextMode;
44578       if (context.graph() === startGraph) {
44579         nextMode = modeSelect(context, [wayID]);
44580       } else {
44581         context.pop(1);
44582         nextMode = mode;
44583       }
44584       context.perform(actionNoop());
44585       context.pop(1);
44586       context.resumeChangeDispatch();
44587       context.enter(nextMode);
44588     }
44589     function setActiveElements() {
44590       if (!_drawNode) return;
44591       context.surface().selectAll("." + _drawNode.id).classed("active", true);
44592     }
44593     function resetToStartGraph() {
44594       while (context.graph() !== startGraph) {
44595         context.pop();
44596       }
44597     }
44598     var drawWay = function(surface) {
44599       _drawNode = void 0;
44600       _didResolveTempEdit = false;
44601       _origWay = context.entity(wayID);
44602       if (typeof _nodeIndex === "number") {
44603         _headNodeID = _origWay.nodes[_nodeIndex];
44604       } else if (_origWay.isClosed()) {
44605         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
44606       } else {
44607         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
44608       }
44609       _wayGeometry = _origWay.geometry(context.graph());
44610       _annotation = _t(
44611         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
44612       );
44613       _pointerHasMoved = false;
44614       context.pauseChangeDispatch();
44615       context.perform(actionNoop(), _annotation);
44616       context.resumeChangeDispatch();
44617       behavior.hover().initialNodeID(_headNodeID);
44618       behavior.on("move", function() {
44619         _pointerHasMoved = true;
44620         move.apply(this, arguments);
44621       }).on("down", function() {
44622         move.apply(this, arguments);
44623       }).on("downcancel", function() {
44624         if (_drawNode) removeDrawNode();
44625       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
44626       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
44627       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
44628       setActiveElements();
44629       surface.call(behavior);
44630       context.history().on("undone.draw", undone);
44631     };
44632     drawWay.off = function(surface) {
44633       if (!_didResolveTempEdit) {
44634         context.pauseChangeDispatch();
44635         resetToStartGraph();
44636         context.resumeChangeDispatch();
44637       }
44638       _drawNode = void 0;
44639       _nodeIndex = void 0;
44640       context.map().on("drawn.draw", null);
44641       surface.call(behavior.off).selectAll(".active").classed("active", false);
44642       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
44643       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
44644       context.history().on("undone.draw", null);
44645     };
44646     function attemptAdd(d2, loc, doAdd) {
44647       if (_drawNode) {
44648         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
44649         _drawNode = context.entity(_drawNode.id);
44650       } else {
44651         createDrawNode(loc);
44652       }
44653       checkGeometry(
44654         true
44655         /* includeDrawNode */
44656       );
44657       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
44658         if (!_pointerHasMoved) {
44659           removeDrawNode();
44660         }
44661         dispatch14.call("rejectedSelfIntersection", this);
44662         return;
44663       }
44664       context.pauseChangeDispatch();
44665       doAdd();
44666       _didResolveTempEdit = true;
44667       context.resumeChangeDispatch();
44668       context.enter(mode);
44669     }
44670     drawWay.add = function(loc, d2) {
44671       attemptAdd(d2, loc, function() {
44672       });
44673     };
44674     drawWay.addWay = function(loc, edge, d2) {
44675       attemptAdd(d2, loc, function() {
44676         context.replace(
44677           actionAddMidpoint({ loc, edge }, _drawNode),
44678           _annotation
44679         );
44680       });
44681     };
44682     drawWay.addNode = function(node, d2) {
44683       if (node.id === _headNodeID || // or the first node when drawing an area
44684       _origWay.isClosed() && node.id === _origWay.first()) {
44685         drawWay.finish();
44686         return;
44687       }
44688       attemptAdd(d2, node.loc, function() {
44689         context.replace(
44690           function actionReplaceDrawNode(graph) {
44691             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
44692             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
44693           },
44694           _annotation
44695         );
44696       });
44697     };
44698     function getFeatureType(ways) {
44699       if (ways.every((way) => way.isClosed())) return "area";
44700       if (ways.every((way) => !way.isClosed())) return "line";
44701       return "generic";
44702     }
44703     function followMode() {
44704       if (_didResolveTempEdit) return;
44705       try {
44706         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
44707         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
44708         const historyGraph = context.history().graph();
44709         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
44710           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
44711           return;
44712         }
44713         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
44714         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
44715         const featureType = getFeatureType(lastNodesParents);
44716         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
44717           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_multiple_ways.${featureType}`))();
44718           return;
44719         }
44720         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
44721           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(`operations.follow.error.intersection_of_different_ways.${featureType}`))();
44722           return;
44723         }
44724         const way = lastNodesParents[0];
44725         const indexOfLast = way.nodes.indexOf(lastNodeId);
44726         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
44727         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
44728         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
44729         if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
44730         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
44731         drawWay.addNode(nextNode, {
44732           geometry: { type: "Point", coordinates: nextNode.loc },
44733           id: nextNode.id,
44734           properties: { target: true, entity: nextNode }
44735         });
44736       } catch {
44737         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
44738       }
44739     }
44740     keybinding.on(_t("operations.follow.key"), followMode);
44741     select_default2(document).call(keybinding);
44742     drawWay.finish = function() {
44743       checkGeometry(
44744         false
44745         /* includeDrawNode */
44746       );
44747       if (context.surface().classed("nope")) {
44748         dispatch14.call("rejectedSelfIntersection", this);
44749         return;
44750       }
44751       context.pauseChangeDispatch();
44752       context.pop(1);
44753       _didResolveTempEdit = true;
44754       context.resumeChangeDispatch();
44755       var way = context.hasEntity(wayID);
44756       if (!way || way.isDegenerate()) {
44757         drawWay.cancel();
44758         return;
44759       }
44760       window.setTimeout(function() {
44761         context.map().dblclickZoomEnable(true);
44762       }, 1e3);
44763       var isNewFeature = !mode.isContinuing;
44764       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
44765     };
44766     drawWay.cancel = function() {
44767       context.pauseChangeDispatch();
44768       resetToStartGraph();
44769       context.resumeChangeDispatch();
44770       window.setTimeout(function() {
44771         context.map().dblclickZoomEnable(true);
44772       }, 1e3);
44773       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
44774       context.enter(modeBrowse(context));
44775     };
44776     drawWay.nodeIndex = function(val) {
44777       if (!arguments.length) return _nodeIndex;
44778       _nodeIndex = val;
44779       return drawWay;
44780     };
44781     drawWay.activeID = function() {
44782       if (!arguments.length) return _drawNode && _drawNode.id;
44783       return drawWay;
44784     };
44785     return utilRebind(drawWay, dispatch14, "on");
44786   }
44787   var init_draw_way = __esm({
44788     "modules/behavior/draw_way.js"() {
44789       "use strict";
44790       init_src4();
44791       init_src5();
44792       init_presets();
44793       init_localizer();
44794       init_add_midpoint();
44795       init_move_node();
44796       init_noop2();
44797       init_draw();
44798       init_geo2();
44799       init_browse();
44800       init_select5();
44801       init_node2();
44802       init_rebind();
44803       init_util();
44804     }
44805   });
44806
44807   // modules/modes/draw_line.js
44808   var draw_line_exports = {};
44809   __export(draw_line_exports, {
44810     modeDrawLine: () => modeDrawLine
44811   });
44812   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
44813     var mode = {
44814       button,
44815       id: "draw-line"
44816     };
44817     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
44818       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
44819     });
44820     mode.wayID = wayID;
44821     mode.isContinuing = continuing;
44822     mode.enter = function() {
44823       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
44824       context.install(behavior);
44825     };
44826     mode.exit = function() {
44827       context.uninstall(behavior);
44828     };
44829     mode.selectedIDs = function() {
44830       return [wayID];
44831     };
44832     mode.activeID = function() {
44833       return behavior && behavior.activeID() || [];
44834     };
44835     return mode;
44836   }
44837   var init_draw_line = __esm({
44838     "modules/modes/draw_line.js"() {
44839       "use strict";
44840       init_localizer();
44841       init_draw_way();
44842     }
44843   });
44844
44845   // modules/validations/disconnected_way.js
44846   var disconnected_way_exports = {};
44847   __export(disconnected_way_exports, {
44848     validationDisconnectedWay: () => validationDisconnectedWay
44849   });
44850   function validationDisconnectedWay() {
44851     var type2 = "disconnected_way";
44852     function isTaggedAsHighway(entity) {
44853       return osmRoutableHighwayTagValues[entity.tags.highway];
44854     }
44855     var validation = function checkDisconnectedWay(entity, graph) {
44856       var routingIslandWays = routingIslandForEntity(entity);
44857       if (!routingIslandWays) return [];
44858       return [new validationIssue({
44859         type: type2,
44860         subtype: "highway",
44861         severity: "warning",
44862         message: function(context) {
44863           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
44864           var label = entity2 && utilDisplayLabel(entity2, context.graph());
44865           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
44866         },
44867         reference: showReference,
44868         entityIds: Array.from(routingIslandWays).map(function(way) {
44869           return way.id;
44870         }),
44871         dynamicFixes: makeFixes
44872       })];
44873       function makeFixes(context) {
44874         var fixes = [];
44875         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
44876         if (singleEntity) {
44877           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
44878             var textDirection = _mainLocalizer.textDirection();
44879             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
44880             if (startFix) fixes.push(startFix);
44881             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
44882             if (endFix) fixes.push(endFix);
44883           }
44884           if (!fixes.length) {
44885             fixes.push(new validationIssueFix({
44886               title: _t.append("issues.fix.connect_feature.title")
44887             }));
44888           }
44889           fixes.push(new validationIssueFix({
44890             icon: "iD-operation-delete",
44891             title: _t.append("issues.fix.delete_feature.title"),
44892             entityIds: [singleEntity.id],
44893             onClick: function(context2) {
44894               var id2 = this.issue.entityIds[0];
44895               var operation2 = operationDelete(context2, [id2]);
44896               if (!operation2.disabled()) {
44897                 operation2();
44898               }
44899             }
44900           }));
44901         } else {
44902           fixes.push(new validationIssueFix({
44903             title: _t.append("issues.fix.connect_features.title")
44904           }));
44905         }
44906         return fixes;
44907       }
44908       function showReference(selection2) {
44909         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
44910       }
44911       function routingIslandForEntity(entity2) {
44912         var routingIsland = /* @__PURE__ */ new Set();
44913         var waysToCheck = [];
44914         function queueParentWays(node) {
44915           graph.parentWays(node).forEach(function(parentWay) {
44916             if (!routingIsland.has(parentWay) && // only check each feature once
44917             isRoutableWay(parentWay, false)) {
44918               routingIsland.add(parentWay);
44919               waysToCheck.push(parentWay);
44920             }
44921           });
44922         }
44923         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
44924           routingIsland.add(entity2);
44925           waysToCheck.push(entity2);
44926         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
44927           routingIsland.add(entity2);
44928           queueParentWays(entity2);
44929         } else {
44930           return null;
44931         }
44932         while (waysToCheck.length) {
44933           var wayToCheck = waysToCheck.pop();
44934           var childNodes = graph.childNodes(wayToCheck);
44935           for (var i3 in childNodes) {
44936             var vertex = childNodes[i3];
44937             if (isConnectedVertex(vertex)) {
44938               return null;
44939             }
44940             if (isRoutableNode(vertex)) {
44941               routingIsland.add(vertex);
44942             }
44943             queueParentWays(vertex);
44944           }
44945         }
44946         return routingIsland;
44947       }
44948       function isConnectedVertex(vertex) {
44949         var osm = services.osm;
44950         if (osm && !osm.isDataLoaded(vertex.loc)) return true;
44951         if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
44952         if (vertex.tags.amenity === "parking_entrance") return true;
44953         return false;
44954       }
44955       function isRoutableNode(node) {
44956         if (node.tags.highway === "elevator") return true;
44957         return false;
44958       }
44959       function isRoutableWay(way, ignoreInnerWays) {
44960         if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
44961         return graph.parentRelations(way).some(function(parentRelation) {
44962           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44963           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
44964           return false;
44965         });
44966       }
44967       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
44968         var vertex = graph.hasEntity(vertexID);
44969         if (!vertex || vertex.tags.noexit === "yes") return null;
44970         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
44971         return new validationIssueFix({
44972           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44973           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
44974           entityIds: [vertexID],
44975           onClick: function(context) {
44976             var wayId = this.issue.entityIds[0];
44977             var way = context.hasEntity(wayId);
44978             var vertexId = this.entityIds[0];
44979             var vertex2 = context.hasEntity(vertexId);
44980             if (!way || !vertex2) return;
44981             var map2 = context.map();
44982             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
44983               map2.zoomToEase(vertex2);
44984             }
44985             context.enter(
44986               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
44987             );
44988           }
44989         });
44990       }
44991     };
44992     validation.type = type2;
44993     return validation;
44994   }
44995   var init_disconnected_way = __esm({
44996     "modules/validations/disconnected_way.js"() {
44997       "use strict";
44998       init_localizer();
44999       init_draw_line();
45000       init_delete();
45001       init_utilDisplayLabel();
45002       init_tags();
45003       init_validation();
45004       init_services();
45005     }
45006   });
45007
45008   // modules/validations/invalid_format.js
45009   var invalid_format_exports = {};
45010   __export(invalid_format_exports, {
45011     validationFormatting: () => validationFormatting
45012   });
45013   function validationFormatting() {
45014     var type2 = "invalid_format";
45015     var validation = function(entity) {
45016       var issues = [];
45017       function isValidEmail(email) {
45018         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
45019         return !email || valid_email.test(email);
45020       }
45021       function showReferenceEmail(selection2) {
45022         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
45023       }
45024       if (entity.tags.email) {
45025         var emails = entity.tags.email.split(";").map(function(s2) {
45026           return s2.trim();
45027         }).filter(function(x2) {
45028           return !isValidEmail(x2);
45029         });
45030         if (emails.length) {
45031           issues.push(new validationIssue({
45032             type: type2,
45033             subtype: "email",
45034             severity: "warning",
45035             message: function(context) {
45036               var entity2 = context.hasEntity(this.entityIds[0]);
45037               return entity2 ? _t.append(
45038                 "issues.invalid_format.email.message" + this.data,
45039                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
45040               ) : "";
45041             },
45042             reference: showReferenceEmail,
45043             entityIds: [entity.id],
45044             hash: emails.join(),
45045             data: emails.length > 1 ? "_multi" : ""
45046           }));
45047         }
45048       }
45049       return issues;
45050     };
45051     validation.type = type2;
45052     return validation;
45053   }
45054   var init_invalid_format = __esm({
45055     "modules/validations/invalid_format.js"() {
45056       "use strict";
45057       init_localizer();
45058       init_utilDisplayLabel();
45059       init_validation();
45060     }
45061   });
45062
45063   // modules/validations/help_request.js
45064   var help_request_exports = {};
45065   __export(help_request_exports, {
45066     validationHelpRequest: () => validationHelpRequest
45067   });
45068   function validationHelpRequest(context) {
45069     var type2 = "help_request";
45070     var validation = function checkFixmeTag(entity) {
45071       if (!entity.tags.fixme) return [];
45072       if (entity.version === void 0) return [];
45073       if (entity.v !== void 0) {
45074         var baseEntity = context.history().base().hasEntity(entity.id);
45075         if (!baseEntity || !baseEntity.tags.fixme) return [];
45076       }
45077       return [new validationIssue({
45078         type: type2,
45079         subtype: "fixme_tag",
45080         severity: "warning",
45081         message: function(context2) {
45082           var entity2 = context2.hasEntity(this.entityIds[0]);
45083           return entity2 ? _t.append("issues.fixme_tag.message", {
45084             feature: utilDisplayLabel(
45085               entity2,
45086               context2.graph(),
45087               true
45088               /* verbose */
45089             )
45090           }) : "";
45091         },
45092         dynamicFixes: function() {
45093           return [
45094             new validationIssueFix({
45095               title: _t.append("issues.fix.address_the_concern.title")
45096             })
45097           ];
45098         },
45099         reference: showReference,
45100         entityIds: [entity.id]
45101       })];
45102       function showReference(selection2) {
45103         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
45104       }
45105     };
45106     validation.type = type2;
45107     return validation;
45108   }
45109   var init_help_request = __esm({
45110     "modules/validations/help_request.js"() {
45111       "use strict";
45112       init_localizer();
45113       init_utilDisplayLabel();
45114       init_validation();
45115     }
45116   });
45117
45118   // modules/validations/impossible_oneway.js
45119   var impossible_oneway_exports = {};
45120   __export(impossible_oneway_exports, {
45121     validationImpossibleOneway: () => validationImpossibleOneway
45122   });
45123   function validationImpossibleOneway() {
45124     var type2 = "impossible_oneway";
45125     var validation = function checkImpossibleOneway(entity, graph) {
45126       if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
45127       if (entity.isClosed()) return [];
45128       if (!typeForWay(entity)) return [];
45129       if (!entity.isOneWay()) return [];
45130       var firstIssues = issuesForNode(entity, entity.first());
45131       var lastIssues = issuesForNode(entity, entity.last());
45132       return firstIssues.concat(lastIssues);
45133       function typeForWay(way) {
45134         if (way.geometry(graph) !== "line") return null;
45135         if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
45136         if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
45137         return null;
45138       }
45139       function nodeOccursMoreThanOnce(way, nodeID) {
45140         var occurrences = 0;
45141         for (var index in way.nodes) {
45142           if (way.nodes[index] === nodeID) {
45143             occurrences += 1;
45144             if (occurrences > 1) return true;
45145           }
45146         }
45147         return false;
45148       }
45149       function isConnectedViaOtherTypes(way, node) {
45150         var wayType = typeForWay(way);
45151         if (wayType === "highway") {
45152           if (node.tags.entrance && node.tags.entrance !== "no") return true;
45153           if (node.tags.amenity === "parking_entrance") return true;
45154         } else if (wayType === "waterway") {
45155           if (node.id === way.first()) {
45156             if (node.tags.natural === "spring") return true;
45157           } else {
45158             if (node.tags.manhole === "drain") return true;
45159           }
45160         }
45161         return graph.parentWays(node).some(function(parentWay) {
45162           if (parentWay.id === way.id) return false;
45163           if (wayType === "highway") {
45164             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
45165             if (parentWay.tags.route === "ferry") return true;
45166             return graph.parentRelations(parentWay).some(function(parentRelation) {
45167               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
45168               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
45169             });
45170           } else if (wayType === "waterway") {
45171             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
45172           }
45173           return false;
45174         });
45175       }
45176       function issuesForNode(way, nodeID) {
45177         var isFirst = nodeID === way.first();
45178         var wayType = typeForWay(way);
45179         if (nodeOccursMoreThanOnce(way, nodeID)) return [];
45180         var osm = services.osm;
45181         if (!osm) return [];
45182         var node = graph.hasEntity(nodeID);
45183         if (!node || !osm.isDataLoaded(node.loc)) return [];
45184         if (isConnectedViaOtherTypes(way, node)) return [];
45185         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
45186           if (parentWay.id === way.id) return false;
45187           return typeForWay(parentWay) === wayType;
45188         });
45189         if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
45190         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
45191           return attachedWay.isOneWay();
45192         });
45193         if (attachedOneways.length < attachedWaysOfSameType.length) return [];
45194         if (attachedOneways.length) {
45195           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
45196             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) return true;
45197             if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
45198             return false;
45199           });
45200           if (connectedEndpointsOkay) return [];
45201         }
45202         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
45203         if (wayType === "waterway") {
45204           messageID += "connected." + placement;
45205           referenceID += "connected";
45206         } else {
45207           messageID += placement;
45208           referenceID += placement;
45209         }
45210         return [new validationIssue({
45211           type: type2,
45212           subtype: wayType,
45213           severity: "warning",
45214           message: function(context) {
45215             var entity2 = context.hasEntity(this.entityIds[0]);
45216             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
45217               feature: utilDisplayLabel(entity2, context.graph())
45218             }) : "";
45219           },
45220           reference: getReference(referenceID),
45221           entityIds: [way.id, node.id],
45222           dynamicFixes: function() {
45223             var fixes = [];
45224             if (attachedOneways.length) {
45225               fixes.push(new validationIssueFix({
45226                 icon: "iD-operation-reverse",
45227                 title: _t.append("issues.fix.reverse_feature.title"),
45228                 entityIds: [way.id],
45229                 onClick: function(context) {
45230                   var id2 = this.issue.entityIds[0];
45231                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
45232                 }
45233               }));
45234             }
45235             if (node.tags.noexit !== "yes") {
45236               var textDirection = _mainLocalizer.textDirection();
45237               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
45238               fixes.push(new validationIssueFix({
45239                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
45240                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
45241                 onClick: function(context) {
45242                   var entityID = this.issue.entityIds[0];
45243                   var vertexID = this.issue.entityIds[1];
45244                   var way2 = context.entity(entityID);
45245                   var vertex = context.entity(vertexID);
45246                   continueDrawing(way2, vertex, context);
45247                 }
45248               }));
45249             }
45250             return fixes;
45251           },
45252           loc: node.loc
45253         })];
45254         function getReference(referenceID2) {
45255           return function showReference(selection2) {
45256             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
45257           };
45258         }
45259       }
45260     };
45261     function continueDrawing(way, vertex, context) {
45262       var map2 = context.map();
45263       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
45264         map2.zoomToEase(vertex);
45265       }
45266       context.enter(
45267         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
45268       );
45269     }
45270     validation.type = type2;
45271     return validation;
45272   }
45273   var init_impossible_oneway = __esm({
45274     "modules/validations/impossible_oneway.js"() {
45275       "use strict";
45276       init_localizer();
45277       init_draw_line();
45278       init_reverse();
45279       init_utilDisplayLabel();
45280       init_tags();
45281       init_validation();
45282       init_services();
45283     }
45284   });
45285
45286   // modules/validations/incompatible_source.js
45287   var incompatible_source_exports = {};
45288   __export(incompatible_source_exports, {
45289     validationIncompatibleSource: () => validationIncompatibleSource
45290   });
45291   function validationIncompatibleSource() {
45292     const type2 = "incompatible_source";
45293     const incompatibleRules = [
45294       {
45295         id: "amap",
45296         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
45297       },
45298       {
45299         id: "baidu",
45300         regex: /(baidu|mapbar|百度)/i
45301       },
45302       {
45303         id: "google",
45304         regex: /google/i,
45305         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
45306       }
45307     ];
45308     const validation = function checkIncompatibleSource(entity) {
45309       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
45310       if (!entitySources) return [];
45311       const entityID = entity.id;
45312       return entitySources.map((source) => {
45313         const matchRule = incompatibleRules.find((rule) => {
45314           if (!rule.regex.test(source)) return false;
45315           if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
45316           return true;
45317         });
45318         if (!matchRule) return null;
45319         return new validationIssue({
45320           type: type2,
45321           severity: "warning",
45322           message: (context) => {
45323             const entity2 = context.hasEntity(entityID);
45324             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
45325               feature: utilDisplayLabel(
45326                 entity2,
45327                 context.graph(),
45328                 true
45329                 /* verbose */
45330               ),
45331               value: source
45332             }) : "";
45333           },
45334           reference: getReference(matchRule.id),
45335           entityIds: [entityID],
45336           hash: source,
45337           dynamicFixes: () => {
45338             return [
45339               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
45340             ];
45341           }
45342         });
45343       }).filter(Boolean);
45344       function getReference(id2) {
45345         return function showReference(selection2) {
45346           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.incompatible_source.reference.${id2}`));
45347         };
45348       }
45349     };
45350     validation.type = type2;
45351     return validation;
45352   }
45353   var init_incompatible_source = __esm({
45354     "modules/validations/incompatible_source.js"() {
45355       "use strict";
45356       init_localizer();
45357       init_utilDisplayLabel();
45358       init_validation();
45359     }
45360   });
45361
45362   // modules/validations/maprules.js
45363   var maprules_exports2 = {};
45364   __export(maprules_exports2, {
45365     validationMaprules: () => validationMaprules
45366   });
45367   function validationMaprules() {
45368     var type2 = "maprules";
45369     var validation = function checkMaprules(entity, graph) {
45370       if (!services.maprules) return [];
45371       var rules = services.maprules.validationRules();
45372       var issues = [];
45373       for (var i3 = 0; i3 < rules.length; i3++) {
45374         var rule = rules[i3];
45375         rule.findIssues(entity, graph, issues);
45376       }
45377       return issues;
45378     };
45379     validation.type = type2;
45380     return validation;
45381   }
45382   var init_maprules2 = __esm({
45383     "modules/validations/maprules.js"() {
45384       "use strict";
45385       init_services();
45386     }
45387   });
45388
45389   // modules/validations/mismatched_geometry.js
45390   var mismatched_geometry_exports = {};
45391   __export(mismatched_geometry_exports, {
45392     validationMismatchedGeometry: () => validationMismatchedGeometry
45393   });
45394   function validationMismatchedGeometry() {
45395     var type2 = "mismatched_geometry";
45396     function tagSuggestingLineIsArea(entity) {
45397       if (entity.type !== "way" || entity.isClosed()) return null;
45398       var tagSuggestingArea = entity.tagSuggestingArea();
45399       if (!tagSuggestingArea) {
45400         return null;
45401       }
45402       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
45403       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
45404       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
45405         return null;
45406       }
45407       if (asLine.isFallback() && asArea.isFallback() && !(0, import_fast_deep_equal4.default)(tagSuggestingArea, { area: "yes" })) {
45408         return null;
45409       }
45410       return tagSuggestingArea;
45411     }
45412     function makeConnectEndpointsFixOnClick(way, graph) {
45413       if (way.nodes.length < 3) return null;
45414       var nodes = graph.childNodes(way), testNodes;
45415       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
45416       if (firstToLastDistanceMeters < 0.75) {
45417         testNodes = nodes.slice();
45418         testNodes.pop();
45419         testNodes.push(testNodes[0]);
45420         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45421           return function(context) {
45422             var way2 = context.entity(this.issue.entityIds[0]);
45423             context.perform(
45424               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
45425               _t("issues.fix.connect_endpoints.annotation")
45426             );
45427           };
45428         }
45429       }
45430       testNodes = nodes.slice();
45431       testNodes.push(testNodes[0]);
45432       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45433         return function(context) {
45434           var wayId = this.issue.entityIds[0];
45435           var way2 = context.entity(wayId);
45436           var nodeId = way2.nodes[0];
45437           var index = way2.nodes.length;
45438           context.perform(
45439             actionAddVertex(wayId, nodeId, index),
45440             _t("issues.fix.connect_endpoints.annotation")
45441           );
45442         };
45443       }
45444     }
45445     function lineTaggedAsAreaIssue(entity) {
45446       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
45447       if (!tagSuggestingArea) return null;
45448       var validAsLine = false;
45449       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
45450       if (presetAsLine) {
45451         validAsLine = true;
45452         var key = Object.keys(tagSuggestingArea)[0];
45453         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
45454           validAsLine = false;
45455         }
45456         if (Object.keys(presetAsLine.tags).length === 0) {
45457           validAsLine = false;
45458         }
45459       }
45460       return new validationIssue({
45461         type: type2,
45462         subtype: "area_as_line",
45463         severity: "warning",
45464         message: function(context) {
45465           var entity2 = context.hasEntity(this.entityIds[0]);
45466           return entity2 ? _t.append("issues.tag_suggests_area.message", {
45467             feature: utilDisplayLabel(
45468               entity2,
45469               "area",
45470               true
45471               /* verbose */
45472             ),
45473             tag: utilTagText({ tags: tagSuggestingArea })
45474           }) : "";
45475         },
45476         reference: showReference,
45477         entityIds: [entity.id],
45478         hash: JSON.stringify(tagSuggestingArea),
45479         dynamicFixes: function(context) {
45480           var fixes = [];
45481           var entity2 = context.entity(this.entityIds[0]);
45482           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
45483           if (!validAsLine) {
45484             fixes.push(new validationIssueFix({
45485               title: _t.append("issues.fix.connect_endpoints.title"),
45486               onClick: connectEndsOnClick
45487             }));
45488           }
45489           fixes.push(new validationIssueFix({
45490             icon: "iD-operation-delete",
45491             title: _t.append("issues.fix.remove_tag.title"),
45492             onClick: function(context2) {
45493               var entityId = this.issue.entityIds[0];
45494               var entity3 = context2.entity(entityId);
45495               var tags = Object.assign({}, entity3.tags);
45496               for (var key2 in tagSuggestingArea) {
45497                 delete tags[key2];
45498               }
45499               context2.perform(
45500                 actionChangeTags(entityId, tags),
45501                 _t("issues.fix.remove_tag.annotation")
45502               );
45503             }
45504           }));
45505           return fixes;
45506         }
45507       });
45508       function showReference(selection2) {
45509         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
45510       }
45511     }
45512     function vertexPointIssue(entity, graph) {
45513       if (entity.type !== "node") return null;
45514       if (Object.keys(entity.tags).length === 0) return null;
45515       if (entity.isOnAddressLine(graph)) return null;
45516       var geometry = entity.geometry(graph);
45517       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
45518       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
45519         return new validationIssue({
45520           type: type2,
45521           subtype: "vertex_as_point",
45522           severity: "warning",
45523           message: function(context) {
45524             var entity2 = context.hasEntity(this.entityIds[0]);
45525             return entity2 ? _t.append("issues.vertex_as_point.message", {
45526               feature: utilDisplayLabel(
45527                 entity2,
45528                 "vertex",
45529                 true
45530                 /* verbose */
45531               )
45532             }) : "";
45533           },
45534           reference: function showReference(selection2) {
45535             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
45536           },
45537           entityIds: [entity.id]
45538         });
45539       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
45540         return new validationIssue({
45541           type: type2,
45542           subtype: "point_as_vertex",
45543           severity: "warning",
45544           message: function(context) {
45545             var entity2 = context.hasEntity(this.entityIds[0]);
45546             return entity2 ? _t.append("issues.point_as_vertex.message", {
45547               feature: utilDisplayLabel(
45548                 entity2,
45549                 "point",
45550                 true
45551                 /* verbose */
45552               )
45553             }) : "";
45554           },
45555           reference: function showReference(selection2) {
45556             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
45557           },
45558           entityIds: [entity.id],
45559           dynamicFixes: extractPointDynamicFixes
45560         });
45561       }
45562       return null;
45563     }
45564     function otherMismatchIssue(entity, graph) {
45565       if (!entity.hasInterestingTags()) return null;
45566       if (entity.type !== "node" && entity.type !== "way") return null;
45567       if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
45568       var sourceGeom = entity.geometry(graph);
45569       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
45570       if (sourceGeom === "area") targetGeoms.unshift("line");
45571       var asSource = _mainPresetIndex.match(entity, graph);
45572       var targetGeom = targetGeoms.find((nodeGeom) => {
45573         const asTarget = _mainPresetIndex.matchTags(
45574           entity.tags,
45575           nodeGeom,
45576           entity.extent(graph).center()
45577         );
45578         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
45579         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags)) return false;
45580         if (asTarget.isFallback()) return false;
45581         var primaryKey = Object.keys(asTarget.tags)[0];
45582         if (primaryKey === "building") return false;
45583         if (asTarget.tags[primaryKey] === "*") return false;
45584         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
45585       });
45586       if (!targetGeom) return null;
45587       var subtype = targetGeom + "_as_" + sourceGeom;
45588       if (targetGeom === "vertex") targetGeom = "point";
45589       if (sourceGeom === "vertex") sourceGeom = "point";
45590       var referenceId = targetGeom + "_as_" + sourceGeom;
45591       var dynamicFixes;
45592       if (targetGeom === "point") {
45593         dynamicFixes = extractPointDynamicFixes;
45594       } else if (sourceGeom === "area" && targetGeom === "line") {
45595         dynamicFixes = lineToAreaDynamicFixes;
45596       }
45597       return new validationIssue({
45598         type: type2,
45599         subtype,
45600         severity: "warning",
45601         message: function(context) {
45602           var entity2 = context.hasEntity(this.entityIds[0]);
45603           return entity2 ? _t.append("issues." + referenceId + ".message", {
45604             feature: utilDisplayLabel(
45605               entity2,
45606               targetGeom,
45607               true
45608               /* verbose */
45609             )
45610           }) : "";
45611         },
45612         reference: function showReference(selection2) {
45613           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
45614         },
45615         entityIds: [entity.id],
45616         dynamicFixes
45617       });
45618     }
45619     function lineToAreaDynamicFixes(context) {
45620       var convertOnClick;
45621       var entityId = this.entityIds[0];
45622       var entity = context.entity(entityId);
45623       var tags = Object.assign({}, entity.tags);
45624       delete tags.area;
45625       if (!osmTagSuggestingArea(tags)) {
45626         convertOnClick = function(context2) {
45627           var entityId2 = this.issue.entityIds[0];
45628           var entity2 = context2.entity(entityId2);
45629           var tags2 = Object.assign({}, entity2.tags);
45630           if (tags2.area) {
45631             delete tags2.area;
45632           }
45633           context2.perform(
45634             actionChangeTags(entityId2, tags2),
45635             _t("issues.fix.convert_to_line.annotation")
45636           );
45637         };
45638       }
45639       return [
45640         new validationIssueFix({
45641           icon: "iD-icon-line",
45642           title: _t.append("issues.fix.convert_to_line.title"),
45643           onClick: convertOnClick
45644         })
45645       ];
45646     }
45647     function extractPointDynamicFixes(context) {
45648       var entityId = this.entityIds[0];
45649       var extractOnClick = null;
45650       if (!context.hasHiddenConnections(entityId)) {
45651         extractOnClick = function(context2) {
45652           var entityId2 = this.issue.entityIds[0];
45653           var action = actionExtract(entityId2, context2.projection);
45654           context2.perform(
45655             action,
45656             _t("operations.extract.annotation", { n: 1 })
45657           );
45658           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
45659         };
45660       }
45661       return [
45662         new validationIssueFix({
45663           icon: "iD-operation-extract",
45664           title: _t.append("issues.fix.extract_point.title"),
45665           onClick: extractOnClick
45666         })
45667       ];
45668     }
45669     function unclosedMultipolygonPartIssues(entity, graph) {
45670       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
45671       !entity.isComplete(graph)) return [];
45672       var sequences = osmJoinWays(entity.members, graph);
45673       var issues = [];
45674       for (var i3 in sequences) {
45675         var sequence = sequences[i3];
45676         if (!sequence.nodes) continue;
45677         var firstNode = sequence.nodes[0];
45678         var lastNode = sequence.nodes[sequence.nodes.length - 1];
45679         if (firstNode === lastNode) continue;
45680         var issue = new validationIssue({
45681           type: type2,
45682           subtype: "unclosed_multipolygon_part",
45683           severity: "warning",
45684           message: function(context) {
45685             var entity2 = context.hasEntity(this.entityIds[0]);
45686             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
45687               feature: utilDisplayLabel(
45688                 entity2,
45689                 context.graph(),
45690                 true
45691                 /* verbose */
45692               )
45693             }) : "";
45694           },
45695           reference: showReference,
45696           loc: sequence.nodes[0].loc,
45697           entityIds: [entity.id],
45698           hash: sequence.map(function(way) {
45699             return way.id;
45700           }).join()
45701         });
45702         issues.push(issue);
45703       }
45704       return issues;
45705       function showReference(selection2) {
45706         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
45707       }
45708     }
45709     var validation = function checkMismatchedGeometry(entity, graph) {
45710       var vertexPoint = vertexPointIssue(entity, graph);
45711       if (vertexPoint) return [vertexPoint];
45712       var lineAsArea = lineTaggedAsAreaIssue(entity);
45713       if (lineAsArea) return [lineAsArea];
45714       var mismatch = otherMismatchIssue(entity, graph);
45715       if (mismatch) return [mismatch];
45716       return unclosedMultipolygonPartIssues(entity, graph);
45717     };
45718     validation.type = type2;
45719     return validation;
45720   }
45721   var import_fast_deep_equal4;
45722   var init_mismatched_geometry = __esm({
45723     "modules/validations/mismatched_geometry.js"() {
45724       "use strict";
45725       import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
45726       init_add_vertex();
45727       init_change_tags();
45728       init_merge_nodes();
45729       init_extract();
45730       init_select5();
45731       init_multipolygon();
45732       init_tags();
45733       init_presets();
45734       init_geo2();
45735       init_localizer();
45736       init_util();
45737       init_utilDisplayLabel();
45738       init_validation();
45739     }
45740   });
45741
45742   // modules/validations/missing_role.js
45743   var missing_role_exports = {};
45744   __export(missing_role_exports, {
45745     validationMissingRole: () => validationMissingRole
45746   });
45747   function validationMissingRole() {
45748     var type2 = "missing_role";
45749     var validation = function checkMissingRole(entity, graph) {
45750       var issues = [];
45751       if (entity.type === "way") {
45752         graph.parentRelations(entity).forEach(function(relation) {
45753           if (!relation.isMultipolygon()) return;
45754           var member = relation.memberById(entity.id);
45755           if (member && isMissingRole(member)) {
45756             issues.push(makeIssue(entity, relation, member));
45757           }
45758         });
45759       } else if (entity.type === "relation" && entity.isMultipolygon()) {
45760         entity.indexedMembers().forEach(function(member) {
45761           var way = graph.hasEntity(member.id);
45762           if (way && isMissingRole(member)) {
45763             issues.push(makeIssue(way, entity, member));
45764           }
45765         });
45766       }
45767       return issues;
45768     };
45769     function isMissingRole(member) {
45770       return !member.role || !member.role.trim().length;
45771     }
45772     function makeIssue(way, relation, member) {
45773       return new validationIssue({
45774         type: type2,
45775         severity: "warning",
45776         message: function(context) {
45777           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
45778           return member2 && relation2 ? _t.append("issues.missing_role.message", {
45779             member: utilDisplayLabel(member2, context.graph()),
45780             relation: utilDisplayLabel(relation2, context.graph())
45781           }) : "";
45782         },
45783         reference: showReference,
45784         entityIds: [relation.id, way.id],
45785         data: {
45786           member
45787         },
45788         hash: member.index.toString(),
45789         dynamicFixes: function() {
45790           return [
45791             makeAddRoleFix("inner"),
45792             makeAddRoleFix("outer"),
45793             new validationIssueFix({
45794               icon: "iD-operation-delete",
45795               title: _t.append("issues.fix.remove_from_relation.title"),
45796               onClick: function(context) {
45797                 context.perform(
45798                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
45799                   _t("operations.delete_member.annotation", {
45800                     n: 1
45801                   })
45802                 );
45803               }
45804             })
45805           ];
45806         }
45807       });
45808       function showReference(selection2) {
45809         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
45810       }
45811     }
45812     function makeAddRoleFix(role) {
45813       return new validationIssueFix({
45814         title: _t.append("issues.fix.set_as_" + role + ".title"),
45815         onClick: function(context) {
45816           var oldMember = this.issue.data.member;
45817           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
45818           context.perform(
45819             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
45820             _t("operations.change_role.annotation", {
45821               n: 1
45822             })
45823           );
45824         }
45825       });
45826     }
45827     validation.type = type2;
45828     return validation;
45829   }
45830   var init_missing_role = __esm({
45831     "modules/validations/missing_role.js"() {
45832       "use strict";
45833       init_change_member();
45834       init_delete_member();
45835       init_localizer();
45836       init_utilDisplayLabel();
45837       init_validation();
45838     }
45839   });
45840
45841   // modules/validations/missing_tag.js
45842   var missing_tag_exports = {};
45843   __export(missing_tag_exports, {
45844     validationMissingTag: () => validationMissingTag
45845   });
45846   function validationMissingTag(context) {
45847     var type2 = "missing_tag";
45848     function hasDescriptiveTags(entity) {
45849       var onlyAttributeKeys = ["description", "name", "note", "start_date", "oneway"];
45850       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
45851         if (k2 === "area" || !osmIsInterestingTag(k2)) return false;
45852         return !onlyAttributeKeys.some(function(attributeKey) {
45853           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
45854         });
45855       });
45856       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
45857         return false;
45858       }
45859       return entityDescriptiveKeys.length > 0;
45860     }
45861     function isUnknownRoad(entity) {
45862       return entity.type === "way" && entity.tags.highway === "road";
45863     }
45864     function isUntypedRelation(entity) {
45865       return entity.type === "relation" && !entity.tags.type;
45866     }
45867     var validation = function checkMissingTag(entity, graph) {
45868       var subtype;
45869       var osm = context.connection();
45870       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
45871       if (!isUnloadedNode && // allow untagged nodes that are part of ways
45872       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
45873       !entity.hasParentRelations(graph)) {
45874         if (Object.keys(entity.tags).length === 0) {
45875           subtype = "any";
45876         } else if (!hasDescriptiveTags(entity)) {
45877           subtype = "descriptive";
45878         } else if (isUntypedRelation(entity)) {
45879           subtype = "relation_type";
45880         }
45881       }
45882       if (!subtype && isUnknownRoad(entity)) {
45883         subtype = "highway_classification";
45884       }
45885       if (!subtype) return [];
45886       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
45887       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
45888       var canDelete = entity.version === void 0 || entity.v !== void 0;
45889       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
45890       return [new validationIssue({
45891         type: type2,
45892         subtype,
45893         severity,
45894         message: function(context2) {
45895           var entity2 = context2.hasEntity(this.entityIds[0]);
45896           return entity2 ? _t.append("issues." + messageID + ".message", {
45897             feature: utilDisplayLabel(entity2, context2.graph())
45898           }) : "";
45899         },
45900         reference: showReference,
45901         entityIds: [entity.id],
45902         dynamicFixes: function(context2) {
45903           var fixes = [];
45904           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
45905           fixes.push(new validationIssueFix({
45906             icon: "iD-icon-search",
45907             title: _t.append("issues.fix." + selectFixType + ".title"),
45908             onClick: function(context3) {
45909               context3.ui().sidebar.showPresetList();
45910             }
45911           }));
45912           var deleteOnClick;
45913           var id2 = this.entityIds[0];
45914           var operation2 = operationDelete(context2, [id2]);
45915           var disabledReasonID = operation2.disabled();
45916           if (!disabledReasonID) {
45917             deleteOnClick = function(context3) {
45918               var id3 = this.issue.entityIds[0];
45919               var operation3 = operationDelete(context3, [id3]);
45920               if (!operation3.disabled()) {
45921                 operation3();
45922               }
45923             };
45924           }
45925           fixes.push(
45926             new validationIssueFix({
45927               icon: "iD-operation-delete",
45928               title: _t.append("issues.fix.delete_feature.title"),
45929               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
45930               onClick: deleteOnClick
45931             })
45932           );
45933           return fixes;
45934         }
45935       })];
45936       function showReference(selection2) {
45937         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
45938       }
45939     };
45940     validation.type = type2;
45941     return validation;
45942   }
45943   var init_missing_tag = __esm({
45944     "modules/validations/missing_tag.js"() {
45945       "use strict";
45946       init_delete();
45947       init_tags();
45948       init_localizer();
45949       init_utilDisplayLabel();
45950       init_validation();
45951     }
45952   });
45953
45954   // modules/validations/mutually_exclusive_tags.js
45955   var mutually_exclusive_tags_exports = {};
45956   __export(mutually_exclusive_tags_exports, {
45957     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags
45958   });
45959   function validationMutuallyExclusiveTags() {
45960     const type2 = "mutually_exclusive_tags";
45961     const tagKeyPairs = osmMutuallyExclusiveTagPairs;
45962     const validation = function checkMutuallyExclusiveTags(entity) {
45963       let pairsFounds = tagKeyPairs.filter((pair3) => {
45964         return pair3[0] in entity.tags && pair3[1] in entity.tags;
45965       }).filter((pair3) => {
45966         return !(pair3[0].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[0]] === "no" || pair3[1].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[1]] === "no");
45967       });
45968       Object.keys(entity.tags).forEach((key) => {
45969         let negative_key = "not:" + key;
45970         if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
45971           pairsFounds.push([negative_key, key, "same_value"]);
45972         }
45973         if (key.match(/^name:[a-z]+/)) {
45974           negative_key = "not:name";
45975           if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
45976             pairsFounds.push([negative_key, key, "same_value"]);
45977           }
45978         }
45979       });
45980       let issues = pairsFounds.map((pair3) => {
45981         const subtype = pair3[2] || "default";
45982         return new validationIssue({
45983           type: type2,
45984           subtype,
45985           severity: "warning",
45986           message: function(context) {
45987             let entity2 = context.hasEntity(this.entityIds[0]);
45988             return entity2 ? _t.append(`issues.${type2}.${subtype}.message`, {
45989               feature: utilDisplayLabel(entity2, context.graph()),
45990               tag1: pair3[0],
45991               tag2: pair3[1]
45992             }) : "";
45993           },
45994           reference: (selection2) => showReference(selection2, pair3, subtype),
45995           entityIds: [entity.id],
45996           dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
45997         });
45998       });
45999       function createIssueFix(tagToRemove) {
46000         return new validationIssueFix({
46001           icon: "iD-operation-delete",
46002           title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
46003           onClick: function(context) {
46004             const entityId = this.issue.entityIds[0];
46005             const entity2 = context.entity(entityId);
46006             let tags = Object.assign({}, entity2.tags);
46007             delete tags[tagToRemove];
46008             context.perform(
46009               actionChangeTags(entityId, tags),
46010               _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
46011             );
46012           }
46013         });
46014       }
46015       function showReference(selection2, pair3, subtype) {
46016         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append(`issues.${type2}.${subtype}.reference`, { tag1: pair3[0], tag2: pair3[1] }));
46017       }
46018       return issues;
46019     };
46020     validation.type = type2;
46021     return validation;
46022   }
46023   var init_mutually_exclusive_tags = __esm({
46024     "modules/validations/mutually_exclusive_tags.js"() {
46025       "use strict";
46026       init_change_tags();
46027       init_localizer();
46028       init_utilDisplayLabel();
46029       init_validation();
46030       init_tags();
46031     }
46032   });
46033
46034   // modules/operations/split.js
46035   var split_exports2 = {};
46036   __export(split_exports2, {
46037     operationSplit: () => operationSplit
46038   });
46039   function operationSplit(context, selectedIDs) {
46040     var _vertexIds = selectedIDs.filter(function(id2) {
46041       return context.graph().geometry(id2) === "vertex";
46042     });
46043     var _selectedWayIds = selectedIDs.filter(function(id2) {
46044       var entity = context.graph().hasEntity(id2);
46045       return entity && entity.type === "way";
46046     });
46047     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
46048     var _action = actionSplit(_vertexIds);
46049     var _ways = [];
46050     var _geometry = "feature";
46051     var _waysAmount = "single";
46052     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
46053     if (_isAvailable) {
46054       if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
46055       _ways = _action.ways(context.graph());
46056       var geometries = {};
46057       _ways.forEach(function(way) {
46058         geometries[way.geometry(context.graph())] = true;
46059       });
46060       if (Object.keys(geometries).length === 1) {
46061         _geometry = Object.keys(geometries)[0];
46062       }
46063       _waysAmount = _ways.length === 1 ? "single" : "multiple";
46064     }
46065     var operation2 = function() {
46066       var difference2 = context.perform(_action, operation2.annotation());
46067       var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
46068         return context.entity(id2).type === "way";
46069       }));
46070       context.enter(modeSelect(context, idsToSelect));
46071     };
46072     operation2.relatedEntityIds = function() {
46073       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
46074     };
46075     operation2.available = function() {
46076       return _isAvailable;
46077     };
46078     operation2.disabled = function() {
46079       var reason = _action.disabled(context.graph());
46080       if (reason) {
46081         return reason;
46082       } else if (selectedIDs.some(context.hasHiddenConnections)) {
46083         return "connected_to_hidden";
46084       }
46085       return false;
46086     };
46087     operation2.tooltip = function() {
46088       var disable = operation2.disabled();
46089       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
46090     };
46091     operation2.annotation = function() {
46092       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
46093     };
46094     operation2.icon = function() {
46095       if (_waysAmount === "multiple") {
46096         return "#iD-operation-split-multiple";
46097       } else {
46098         return "#iD-operation-split";
46099       }
46100     };
46101     operation2.id = "split";
46102     operation2.keys = [_t("operations.split.key")];
46103     operation2.title = _t.append("operations.split.title");
46104     operation2.behavior = behaviorOperation(context).which(operation2);
46105     return operation2;
46106   }
46107   var init_split2 = __esm({
46108     "modules/operations/split.js"() {
46109       "use strict";
46110       init_localizer();
46111       init_split();
46112       init_operation();
46113       init_select5();
46114     }
46115   });
46116
46117   // modules/validations/osm_api_limits.js
46118   var osm_api_limits_exports = {};
46119   __export(osm_api_limits_exports, {
46120     validationOsmApiLimits: () => validationOsmApiLimits
46121   });
46122   function validationOsmApiLimits(context) {
46123     const type2 = "osm_api_limits";
46124     const validation = function checkOsmApiLimits(entity) {
46125       const issues = [];
46126       const osm = context.connection();
46127       if (!osm) return issues;
46128       const maxWayNodes = osm.maxWayNodes();
46129       if (entity.type === "way") {
46130         if (entity.nodes.length > maxWayNodes) {
46131           issues.push(new validationIssue({
46132             type: type2,
46133             subtype: "exceededMaxWayNodes",
46134             severity: "error",
46135             message: function() {
46136               return _t.html("issues.osm_api_limits.max_way_nodes.message");
46137             },
46138             reference: function(selection2) {
46139               selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(_t.html("issues.osm_api_limits.max_way_nodes.reference", { maxWayNodes }));
46140             },
46141             entityIds: [entity.id],
46142             dynamicFixes: splitWayIntoSmallChunks
46143           }));
46144         }
46145       }
46146       return issues;
46147     };
46148     function splitWayIntoSmallChunks() {
46149       const fix = new validationIssueFix({
46150         icon: "iD-operation-split",
46151         title: _t.html("issues.fix.split_way.title"),
46152         entityIds: this.entityIds,
46153         onClick: function(context2) {
46154           const maxWayNodes = context2.connection().maxWayNodes();
46155           const g3 = context2.graph();
46156           const entityId = this.entityIds[0];
46157           const entity = context2.graph().entities[entityId];
46158           const numberOfParts = Math.ceil(entity.nodes.length / maxWayNodes);
46159           let splitVertices;
46160           if (numberOfParts === 2) {
46161             const splitIntersections = entity.nodes.map((nid) => g3.entity(nid)).filter((n3) => g3.parentWays(n3).length > 1).map((n3) => n3.id).filter((nid) => {
46162               const splitIndex = entity.nodes.indexOf(nid);
46163               return splitIndex < maxWayNodes && entity.nodes.length - splitIndex < maxWayNodes;
46164             });
46165             if (splitIntersections.length > 0) {
46166               splitVertices = [
46167                 splitIntersections[Math.floor(splitIntersections.length / 2)]
46168               ];
46169             }
46170           }
46171           if (splitVertices === void 0) {
46172             splitVertices = [...Array(numberOfParts - 1)].map((_2, i3) => entity.nodes[Math.floor(entity.nodes.length * (i3 + 1) / numberOfParts)]);
46173           }
46174           if (entity.isClosed()) {
46175             splitVertices.push(entity.nodes[0]);
46176           }
46177           const operation2 = operationSplit(context2, splitVertices.concat(entityId));
46178           if (!operation2.disabled()) {
46179             operation2();
46180           }
46181         }
46182       });
46183       return [fix];
46184     }
46185     validation.type = type2;
46186     return validation;
46187   }
46188   var init_osm_api_limits = __esm({
46189     "modules/validations/osm_api_limits.js"() {
46190       "use strict";
46191       init_localizer();
46192       init_validation();
46193       init_split2();
46194     }
46195   });
46196
46197   // modules/osm/deprecated.js
46198   var deprecated_exports = {};
46199   __export(deprecated_exports, {
46200     deprecatedTagValuesByKey: () => deprecatedTagValuesByKey,
46201     getDeprecatedTags: () => getDeprecatedTags
46202   });
46203   function getDeprecatedTags(tags, dataDeprecated) {
46204     if (Object.keys(tags).length === 0) return [];
46205     var deprecated = [];
46206     dataDeprecated.forEach((d2) => {
46207       var oldKeys = Object.keys(d2.old);
46208       if (d2.replace) {
46209         var hasExistingValues = Object.keys(d2.replace).some((replaceKey) => {
46210           if (!tags[replaceKey] || d2.old[replaceKey]) return false;
46211           var replaceValue = d2.replace[replaceKey];
46212           if (replaceValue === "*") return false;
46213           if (replaceValue === tags[replaceKey]) return false;
46214           return true;
46215         });
46216         if (hasExistingValues) return;
46217       }
46218       var matchesDeprecatedTags = oldKeys.every((oldKey) => {
46219         if (!tags[oldKey]) return false;
46220         if (d2.old[oldKey] === "*") return true;
46221         if (d2.old[oldKey] === tags[oldKey]) return true;
46222         var vals = tags[oldKey].split(";").filter(Boolean);
46223         if (vals.length === 0) {
46224           return false;
46225         } else if (vals.length > 1) {
46226           return vals.indexOf(d2.old[oldKey]) !== -1;
46227         } else {
46228           if (tags[oldKey] === d2.old[oldKey]) {
46229             if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
46230               var replaceKeys = Object.keys(d2.replace);
46231               return !replaceKeys.every((replaceKey) => {
46232                 return tags[replaceKey] === d2.replace[replaceKey];
46233               });
46234             } else {
46235               return true;
46236             }
46237           }
46238         }
46239         return false;
46240       });
46241       if (matchesDeprecatedTags) {
46242         deprecated.push(d2);
46243       }
46244     });
46245     return deprecated;
46246   }
46247   function deprecatedTagValuesByKey(dataDeprecated) {
46248     if (!_deprecatedTagValuesByKey) {
46249       _deprecatedTagValuesByKey = {};
46250       dataDeprecated.forEach((d2) => {
46251         var oldKeys = Object.keys(d2.old);
46252         if (oldKeys.length === 1) {
46253           var oldKey = oldKeys[0];
46254           var oldValue = d2.old[oldKey];
46255           if (oldValue !== "*") {
46256             if (!_deprecatedTagValuesByKey[oldKey]) {
46257               _deprecatedTagValuesByKey[oldKey] = [oldValue];
46258             } else {
46259               _deprecatedTagValuesByKey[oldKey].push(oldValue);
46260             }
46261           }
46262         }
46263       });
46264     }
46265     return _deprecatedTagValuesByKey;
46266   }
46267   var _deprecatedTagValuesByKey;
46268   var init_deprecated = __esm({
46269     "modules/osm/deprecated.js"() {
46270       "use strict";
46271     }
46272   });
46273
46274   // modules/validations/outdated_tags.js
46275   var outdated_tags_exports = {};
46276   __export(outdated_tags_exports, {
46277     validationOutdatedTags: () => validationOutdatedTags
46278   });
46279   function validationOutdatedTags() {
46280     const type2 = "outdated_tags";
46281     let _waitingForDeprecated = true;
46282     let _dataDeprecated;
46283     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
46284     }).finally(() => _waitingForDeprecated = false);
46285     function oldTagIssues(entity, graph) {
46286       if (!entity.hasInterestingTags()) return [];
46287       let preset = _mainPresetIndex.match(entity, graph);
46288       if (!preset) return [];
46289       const oldTags = Object.assign({}, entity.tags);
46290       if (preset.replacement) {
46291         const newPreset = _mainPresetIndex.item(preset.replacement);
46292         graph = actionChangePreset(
46293           entity.id,
46294           preset,
46295           newPreset,
46296           true
46297           /* skip field defaults */
46298         )(graph);
46299         entity = graph.entity(entity.id);
46300         preset = newPreset;
46301       }
46302       const nsi = services.nsi;
46303       let waitingForNsi = false;
46304       let nsiResult;
46305       if (nsi) {
46306         waitingForNsi = nsi.status() === "loading";
46307         if (!waitingForNsi) {
46308           const loc = entity.extent(graph).center();
46309           nsiResult = nsi.upgradeTags(oldTags, loc);
46310         }
46311       }
46312       const nsiDiff = nsiResult ? utilTagDiff(oldTags, nsiResult.newTags) : [];
46313       let deprecatedTags;
46314       if (_dataDeprecated) {
46315         deprecatedTags = getDeprecatedTags(entity.tags, _dataDeprecated);
46316         if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
46317           deprecatedTags.push({
46318             old: { traffic_calming: "island" },
46319             replace: { "area:highway": "traffic_island" }
46320           });
46321         }
46322         if (deprecatedTags.length) {
46323           deprecatedTags.forEach((tag2) => {
46324             graph = actionUpgradeTags(entity.id, tag2.old, tag2.replace)(graph);
46325           });
46326           entity = graph.entity(entity.id);
46327         }
46328       }
46329       let newTags = Object.assign({}, entity.tags);
46330       if (preset.tags !== preset.addTags) {
46331         Object.keys(preset.addTags).filter((k2) => {
46332           return !(nsiResult == null ? void 0 : nsiResult.newTags[k2]);
46333         }).forEach((k2) => {
46334           if (!newTags[k2]) {
46335             if (preset.addTags[k2] === "*") {
46336               newTags[k2] = "yes";
46337             } else if (preset.addTags[k2]) {
46338               newTags[k2] = preset.addTags[k2];
46339             }
46340           }
46341         });
46342       }
46343       const deprecationDiff = utilTagDiff(oldTags, newTags);
46344       const deprecationDiffContext = Object.keys(oldTags).filter((key) => deprecatedTags == null ? void 0 : deprecatedTags.some((deprecated) => {
46345         var _a3;
46346         return ((_a3 = deprecated.replace) == null ? void 0 : _a3[key]) !== void 0;
46347       })).filter((key) => newTags[key] === oldTags[key]).map((key) => ({
46348         type: "~",
46349         key,
46350         oldVal: oldTags[key],
46351         newVal: newTags[key],
46352         display: "&nbsp; " + key + "=" + oldTags[key]
46353       }));
46354       let issues = [];
46355       issues.provisional = _waitingForDeprecated || waitingForNsi;
46356       if (deprecationDiff.length) {
46357         const isOnlyAddingTags = !deprecationDiff.some((d2) => d2.type === "-");
46358         const prefix = isOnlyAddingTags ? "incomplete." : "";
46359         issues.push(new validationIssue({
46360           type: type2,
46361           subtype: isOnlyAddingTags ? "incomplete_tags" : "deprecated_tags",
46362           severity: "warning",
46363           message: (context) => {
46364             const currEntity = context.hasEntity(entity.id);
46365             if (!currEntity) return "";
46366             const feature3 = utilDisplayLabel(
46367               currEntity,
46368               context.graph(),
46369               /* verbose */
46370               true
46371             );
46372             return _t.append(`issues.outdated_tags.${prefix}message`, { feature: feature3 });
46373           },
46374           reference: (selection2) => showReference(
46375             selection2,
46376             _t.append(`issues.outdated_tags.${prefix}reference`),
46377             [...deprecationDiff, ...deprecationDiffContext]
46378           ),
46379           entityIds: [entity.id],
46380           hash: utilHashcode(JSON.stringify(deprecationDiff)),
46381           dynamicFixes: () => {
46382             let fixes = [
46383               new validationIssueFix({
46384                 title: _t.append("issues.fix.upgrade_tags.title"),
46385                 onClick: (context) => {
46386                   context.perform((graph2) => doUpgrade(graph2, deprecationDiff), _t("issues.fix.upgrade_tags.annotation"));
46387                 }
46388               })
46389             ];
46390             return fixes;
46391           }
46392         }));
46393       }
46394       if (nsiDiff.length) {
46395         const isOnlyAddingTags = nsiDiff.every((d2) => d2.type === "+");
46396         issues.push(new validationIssue({
46397           type: type2,
46398           subtype: "noncanonical_brand",
46399           severity: "warning",
46400           message: (context) => {
46401             const currEntity = context.hasEntity(entity.id);
46402             if (!currEntity) return "";
46403             const feature3 = utilDisplayLabel(
46404               currEntity,
46405               context.graph(),
46406               /* verbose */
46407               true
46408             );
46409             return isOnlyAddingTags ? _t.append("issues.outdated_tags.noncanonical_brand.message_incomplete", { feature: feature3 }) : _t.append("issues.outdated_tags.noncanonical_brand.message", { feature: feature3 });
46410           },
46411           reference: (selection2) => showReference(
46412             selection2,
46413             _t.append("issues.outdated_tags.noncanonical_brand.reference"),
46414             nsiDiff
46415           ),
46416           entityIds: [entity.id],
46417           hash: utilHashcode(JSON.stringify(nsiDiff)),
46418           dynamicFixes: () => {
46419             let fixes = [
46420               new validationIssueFix({
46421                 title: _t.append("issues.fix.upgrade_tags.title"),
46422                 onClick: (context) => {
46423                   context.perform((graph2) => doUpgrade(graph2, nsiDiff), _t("issues.fix.upgrade_tags.annotation"));
46424                 }
46425               }),
46426               new validationIssueFix({
46427                 title: _t.append("issues.fix.tag_as_not.title", { name: nsiResult.matched.displayName }),
46428                 onClick: (context) => {
46429                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
46430                 }
46431               })
46432             ];
46433             return fixes;
46434           }
46435         }));
46436       }
46437       return issues;
46438       function doUpgrade(graph2, diff) {
46439         const currEntity = graph2.hasEntity(entity.id);
46440         if (!currEntity) return graph2;
46441         let newTags2 = Object.assign({}, currEntity.tags);
46442         diff.forEach((diff2) => {
46443           if (diff2.type === "-") {
46444             delete newTags2[diff2.key];
46445           } else if (diff2.type === "+") {
46446             newTags2[diff2.key] = diff2.newVal;
46447           }
46448         });
46449         return actionChangeTags(currEntity.id, newTags2)(graph2);
46450       }
46451       function addNotTag(graph2) {
46452         const currEntity = graph2.hasEntity(entity.id);
46453         if (!currEntity) return graph2;
46454         const item = nsiResult && nsiResult.matched;
46455         if (!item) return graph2;
46456         let newTags2 = Object.assign({}, currEntity.tags);
46457         const wd = item.mainTag;
46458         const notwd = `not:${wd}`;
46459         const qid = item.tags[wd];
46460         newTags2[notwd] = qid;
46461         if (newTags2[wd] === qid) {
46462           const wp = item.mainTag.replace("wikidata", "wikipedia");
46463           delete newTags2[wd];
46464           delete newTags2[wp];
46465         }
46466         return actionChangeTags(currEntity.id, newTags2)(graph2);
46467       }
46468       function showReference(selection2, reference, tagDiff) {
46469         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
46470         enter.append("div").attr("class", "issue-reference").call(reference);
46471         enter.append("strong").call(_t.append("issues.suggested"));
46472         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
46473           const klass = "tagDiff-cell";
46474           switch (d2.type) {
46475             case "+":
46476               return `${klass} tagDiff-cell-add`;
46477             case "-":
46478               return `${klass} tagDiff-cell-remove`;
46479             default:
46480               return `${klass} tagDiff-cell-unchanged`;
46481           }
46482         }).html((d2) => d2.display);
46483       }
46484     }
46485     let validation = oldTagIssues;
46486     validation.type = type2;
46487     return validation;
46488   }
46489   var init_outdated_tags = __esm({
46490     "modules/validations/outdated_tags.js"() {
46491       "use strict";
46492       init_localizer();
46493       init_change_preset();
46494       init_change_tags();
46495       init_upgrade_tags();
46496       init_core();
46497       init_presets();
46498       init_services();
46499       init_util();
46500       init_utilDisplayLabel();
46501       init_validation();
46502       init_deprecated();
46503     }
46504   });
46505
46506   // modules/validations/private_data.js
46507   var private_data_exports = {};
46508   __export(private_data_exports, {
46509     validationPrivateData: () => validationPrivateData
46510   });
46511   function validationPrivateData() {
46512     var type2 = "private_data";
46513     var privateBuildingValues = {
46514       detached: true,
46515       farm: true,
46516       house: true,
46517       houseboat: true,
46518       residential: true,
46519       semidetached_house: true,
46520       static_caravan: true
46521     };
46522     var publicKeys = {
46523       amenity: true,
46524       craft: true,
46525       historic: true,
46526       leisure: true,
46527       office: true,
46528       shop: true,
46529       tourism: true
46530     };
46531     var personalTags = {
46532       "contact:email": true,
46533       "contact:fax": true,
46534       "contact:phone": true,
46535       email: true,
46536       fax: true,
46537       phone: true
46538     };
46539     var validation = function checkPrivateData(entity) {
46540       var tags = entity.tags;
46541       if (!tags.building || !privateBuildingValues[tags.building]) return [];
46542       var keepTags = {};
46543       for (var k2 in tags) {
46544         if (publicKeys[k2]) return [];
46545         if (!personalTags[k2]) {
46546           keepTags[k2] = tags[k2];
46547         }
46548       }
46549       var tagDiff = utilTagDiff(tags, keepTags);
46550       if (!tagDiff.length) return [];
46551       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
46552       return [new validationIssue({
46553         type: type2,
46554         severity: "warning",
46555         message: showMessage,
46556         reference: showReference,
46557         entityIds: [entity.id],
46558         dynamicFixes: function() {
46559           return [
46560             new validationIssueFix({
46561               icon: "iD-operation-delete",
46562               title: _t.append("issues.fix." + fixID + ".title"),
46563               onClick: function(context) {
46564                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
46565               }
46566             })
46567           ];
46568         }
46569       })];
46570       function doUpgrade(graph) {
46571         var currEntity = graph.hasEntity(entity.id);
46572         if (!currEntity) return graph;
46573         var newTags = Object.assign({}, currEntity.tags);
46574         tagDiff.forEach(function(diff) {
46575           if (diff.type === "-") {
46576             delete newTags[diff.key];
46577           } else if (diff.type === "+") {
46578             newTags[diff.key] = diff.newVal;
46579           }
46580         });
46581         return actionChangeTags(currEntity.id, newTags)(graph);
46582       }
46583       function showMessage(context) {
46584         var currEntity = context.hasEntity(this.entityIds[0]);
46585         if (!currEntity) return "";
46586         return _t.append(
46587           "issues.private_data.contact.message",
46588           { feature: utilDisplayLabel(currEntity, context.graph()) }
46589         );
46590       }
46591       function showReference(selection2) {
46592         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
46593         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
46594         enter.append("strong").call(_t.append("issues.suggested"));
46595         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) {
46596           var klass = d2.type === "+" ? "add" : "remove";
46597           return "tagDiff-cell tagDiff-cell-" + klass;
46598         }).html(function(d2) {
46599           return d2.display;
46600         });
46601       }
46602     };
46603     validation.type = type2;
46604     return validation;
46605   }
46606   var init_private_data = __esm({
46607     "modules/validations/private_data.js"() {
46608       "use strict";
46609       init_change_tags();
46610       init_localizer();
46611       init_util();
46612       init_utilDisplayLabel();
46613       init_validation();
46614     }
46615   });
46616
46617   // modules/validations/suspicious_name.js
46618   var suspicious_name_exports = {};
46619   __export(suspicious_name_exports, {
46620     validationSuspiciousName: () => validationSuspiciousName
46621   });
46622   function validationSuspiciousName(context) {
46623     const type2 = "suspicious_name";
46624     const keysToTestForGenericValues = [
46625       "aerialway",
46626       "aeroway",
46627       "amenity",
46628       "building",
46629       "craft",
46630       "highway",
46631       "leisure",
46632       "railway",
46633       "man_made",
46634       "office",
46635       "shop",
46636       "tourism",
46637       "waterway"
46638     ];
46639     const ignoredPresets = /* @__PURE__ */ new Set([
46640       "amenity/place_of_worship/christian/jehovahs_witness",
46641       "__test__ignored_preset"
46642       // for unit tests
46643     ]);
46644     let _waitingForNsi = false;
46645     function isGenericMatchInNsi(tags) {
46646       const nsi = services.nsi;
46647       if (nsi) {
46648         _waitingForNsi = nsi.status() === "loading";
46649         if (!_waitingForNsi) {
46650           return nsi.isGenericName(tags);
46651         }
46652       }
46653       return false;
46654     }
46655     function nameMatchesRawTag(lowercaseName, tags) {
46656       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
46657         let key = keysToTestForGenericValues[i3];
46658         let val = tags[key];
46659         if (val) {
46660           val = val.toLowerCase();
46661           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
46662             return true;
46663           }
46664         }
46665       }
46666       return false;
46667     }
46668     function nameMatchesPresetName(name, preset) {
46669       if (!preset) return false;
46670       if (ignoredPresets.has(preset.id)) return false;
46671       name = name.toLowerCase();
46672       return name === preset.name().toLowerCase() || preset.aliases().some((alias) => name === alias.toLowerCase());
46673     }
46674     function isGenericName(name, tags, preset) {
46675       name = name.toLowerCase();
46676       return nameMatchesRawTag(name, tags) || nameMatchesPresetName(name, preset) || isGenericMatchInNsi(tags);
46677     }
46678     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
46679       return new validationIssue({
46680         type: type2,
46681         subtype: "generic_name",
46682         severity: "warning",
46683         message: function(context2) {
46684           let entity = context2.hasEntity(this.entityIds[0]);
46685           if (!entity) return "";
46686           let preset = _mainPresetIndex.match(entity, context2.graph());
46687           let langName = langCode && _mainLocalizer.languageName(langCode);
46688           return _t.append(
46689             "issues.generic_name.message" + (langName ? "_language" : ""),
46690             { feature: preset.name(), name: genericName, language: langName }
46691           );
46692         },
46693         reference: showReference,
46694         entityIds: [entityId],
46695         hash: `${nameKey}=${genericName}`,
46696         dynamicFixes: function() {
46697           return [
46698             new validationIssueFix({
46699               icon: "iD-operation-delete",
46700               title: _t.append("issues.fix.remove_the_name.title"),
46701               onClick: function(context2) {
46702                 let entityId2 = this.issue.entityIds[0];
46703                 let entity = context2.entity(entityId2);
46704                 let tags = Object.assign({}, entity.tags);
46705                 delete tags[nameKey];
46706                 context2.perform(
46707                   actionChangeTags(entityId2, tags),
46708                   _t("issues.fix.remove_generic_name.annotation")
46709                 );
46710               }
46711             })
46712           ];
46713         }
46714       });
46715       function showReference(selection2) {
46716         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
46717       }
46718     }
46719     let validation = function checkGenericName(entity) {
46720       const tags = entity.tags;
46721       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
46722       if (hasWikidata) return [];
46723       let issues = [];
46724       const preset = _mainPresetIndex.match(entity, context.graph());
46725       for (let key in tags) {
46726         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
46727         if (!m2) continue;
46728         const langCode = m2.length >= 2 ? m2[1] : null;
46729         const value = tags[key];
46730         if (isGenericName(value, tags, preset)) {
46731           issues.provisional = _waitingForNsi;
46732           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
46733         }
46734       }
46735       return issues;
46736     };
46737     validation.type = type2;
46738     return validation;
46739   }
46740   var init_suspicious_name = __esm({
46741     "modules/validations/suspicious_name.js"() {
46742       "use strict";
46743       init_change_tags();
46744       init_presets();
46745       init_services();
46746       init_localizer();
46747       init_validation();
46748     }
46749   });
46750
46751   // modules/validations/unsquare_way.js
46752   var unsquare_way_exports = {};
46753   __export(unsquare_way_exports, {
46754     validationUnsquareWay: () => validationUnsquareWay
46755   });
46756   function validationUnsquareWay(context) {
46757     var type2 = "unsquare_way";
46758     var DEFAULT_DEG_THRESHOLD = 5;
46759     var epsilon3 = 0.05;
46760     var nodeThreshold = 10;
46761     function isBuilding(entity, graph) {
46762       if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
46763       return entity.tags.building && entity.tags.building !== "no";
46764     }
46765     var validation = function checkUnsquareWay(entity, graph) {
46766       if (!isBuilding(entity, graph)) return [];
46767       if (entity.tags.nonsquare === "yes") return [];
46768       var isClosed = entity.isClosed();
46769       if (!isClosed) return [];
46770       var nodes = graph.childNodes(entity).slice();
46771       if (nodes.length > nodeThreshold + 1) return [];
46772       var osm = services.osm;
46773       if (!osm || nodes.some(function(node) {
46774         return !osm.isDataLoaded(node.loc);
46775       })) return [];
46776       var hasConnectedSquarableWays = nodes.some(function(node) {
46777         return graph.parentWays(node).some(function(way) {
46778           if (way.id === entity.id) return false;
46779           if (isBuilding(way, graph)) return true;
46780           return graph.parentRelations(way).some(function(parentRelation) {
46781             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
46782           });
46783         });
46784       });
46785       if (hasConnectedSquarableWays) return [];
46786       var storedDegreeThreshold = corePreferences("validate-square-degrees");
46787       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
46788       var points = nodes.map(function(node) {
46789         return context.projection(node.loc);
46790       });
46791       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
46792       var autoArgs;
46793       if (!entity.tags.wikidata) {
46794         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
46795         autoAction.transitionable = false;
46796         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
46797       }
46798       return [new validationIssue({
46799         type: type2,
46800         subtype: "building",
46801         severity: "warning",
46802         message: function(context2) {
46803           var entity2 = context2.hasEntity(this.entityIds[0]);
46804           return entity2 ? _t.append("issues.unsquare_way.message", {
46805             feature: utilDisplayLabel(entity2, context2.graph())
46806           }) : "";
46807         },
46808         reference: showReference,
46809         entityIds: [entity.id],
46810         hash: degreeThreshold,
46811         dynamicFixes: function() {
46812           return [
46813             new validationIssueFix({
46814               icon: "iD-operation-orthogonalize",
46815               title: _t.append("issues.fix.square_feature.title"),
46816               autoArgs,
46817               onClick: function(context2, completionHandler) {
46818                 var entityId = this.issue.entityIds[0];
46819                 context2.perform(
46820                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
46821                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
46822                 );
46823                 window.setTimeout(function() {
46824                   completionHandler();
46825                 }, 175);
46826               }
46827             })
46828             /*
46829             new validationIssueFix({
46830                 title: t.append('issues.fix.tag_as_unsquare.title'),
46831                 onClick: function(context) {
46832                     var entityId = this.issue.entityIds[0];
46833                     var entity = context.entity(entityId);
46834                     var tags = Object.assign({}, entity.tags);  // shallow copy
46835                     tags.nonsquare = 'yes';
46836                     context.perform(
46837                         actionChangeTags(entityId, tags),
46838                         t('issues.fix.tag_as_unsquare.annotation')
46839                     );
46840                 }
46841             })
46842             */
46843           ];
46844         }
46845       })];
46846       function showReference(selection2) {
46847         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
46848       }
46849     };
46850     validation.type = type2;
46851     return validation;
46852   }
46853   var init_unsquare_way = __esm({
46854     "modules/validations/unsquare_way.js"() {
46855       "use strict";
46856       init_preferences();
46857       init_localizer();
46858       init_orthogonalize();
46859       init_ortho();
46860       init_utilDisplayLabel();
46861       init_validation();
46862       init_services();
46863     }
46864   });
46865
46866   // modules/validations/index.js
46867   var validations_exports = {};
46868   __export(validations_exports, {
46869     validationAlmostJunction: () => validationAlmostJunction,
46870     validationCloseNodes: () => validationCloseNodes,
46871     validationCrossingWays: () => validationCrossingWays,
46872     validationDisconnectedWay: () => validationDisconnectedWay,
46873     validationFormatting: () => validationFormatting,
46874     validationHelpRequest: () => validationHelpRequest,
46875     validationImpossibleOneway: () => validationImpossibleOneway,
46876     validationIncompatibleSource: () => validationIncompatibleSource,
46877     validationMaprules: () => validationMaprules,
46878     validationMismatchedGeometry: () => validationMismatchedGeometry,
46879     validationMissingRole: () => validationMissingRole,
46880     validationMissingTag: () => validationMissingTag,
46881     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
46882     validationOsmApiLimits: () => validationOsmApiLimits,
46883     validationOutdatedTags: () => validationOutdatedTags,
46884     validationPrivateData: () => validationPrivateData,
46885     validationSuspiciousName: () => validationSuspiciousName,
46886     validationUnsquareWay: () => validationUnsquareWay
46887   });
46888   var init_validations = __esm({
46889     "modules/validations/index.js"() {
46890       "use strict";
46891       init_almost_junction();
46892       init_close_nodes();
46893       init_crossing_ways();
46894       init_disconnected_way();
46895       init_invalid_format();
46896       init_help_request();
46897       init_impossible_oneway();
46898       init_incompatible_source();
46899       init_maprules2();
46900       init_mismatched_geometry();
46901       init_missing_role();
46902       init_missing_tag();
46903       init_mutually_exclusive_tags();
46904       init_osm_api_limits();
46905       init_outdated_tags();
46906       init_private_data();
46907       init_suspicious_name();
46908       init_unsquare_way();
46909     }
46910   });
46911
46912   // modules/core/validator.js
46913   var validator_exports = {};
46914   __export(validator_exports, {
46915     coreValidator: () => coreValidator
46916   });
46917   function coreValidator(context) {
46918     let dispatch14 = dispatch_default("validated", "focusedIssue");
46919     const validator = {};
46920     let _rules = {};
46921     let _disabledRules = {};
46922     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
46923     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
46924     let _baseCache = validationCache("base");
46925     let _headCache = validationCache("head");
46926     let _completeDiff = {};
46927     let _headIsCurrent = false;
46928     let _deferredRIC = {};
46929     let _deferredST = /* @__PURE__ */ new Set();
46930     let _headPromise;
46931     const RETRY = 5e3;
46932     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
46933     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
46934     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
46935     function parseHashParam(param) {
46936       let result = [];
46937       let rules = (param || "").split(",");
46938       rules.forEach((rule) => {
46939         rule = rule.trim();
46940         const parts = rule.split("/", 2);
46941         const type2 = parts[0];
46942         const subtype = parts[1] || "*";
46943         if (!type2 || !subtype) return;
46944         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
46945       });
46946       return result;
46947       function makeRegExp(str) {
46948         const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
46949         return new RegExp("^" + escaped + "$");
46950       }
46951     }
46952     validator.init = () => {
46953       Object.values(validations_exports).forEach((validation) => {
46954         if (typeof validation !== "function") return;
46955         const fn = validation(context);
46956         const key = fn.type;
46957         _rules[key] = fn;
46958       });
46959       let disabledRules = corePreferences("validate-disabledRules");
46960       if (disabledRules) {
46961         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
46962       }
46963     };
46964     function reset(resetIgnored) {
46965       _baseCache.queue = [];
46966       _headCache.queue = [];
46967       Object.keys(_deferredRIC).forEach((key) => {
46968         window.cancelIdleCallback(key);
46969         _deferredRIC[key]();
46970       });
46971       _deferredRIC = {};
46972       _deferredST.forEach(window.clearTimeout);
46973       _deferredST.clear();
46974       if (resetIgnored) _ignoredIssueIDs.clear();
46975       _resolvedIssueIDs.clear();
46976       _baseCache = validationCache("base");
46977       _headCache = validationCache("head");
46978       _completeDiff = {};
46979       _headIsCurrent = false;
46980     }
46981     validator.reset = () => {
46982       reset(true);
46983     };
46984     validator.resetIgnoredIssues = () => {
46985       _ignoredIssueIDs.clear();
46986       dispatch14.call("validated");
46987     };
46988     validator.revalidateUnsquare = () => {
46989       revalidateUnsquare(_headCache);
46990       revalidateUnsquare(_baseCache);
46991       dispatch14.call("validated");
46992     };
46993     function revalidateUnsquare(cache) {
46994       const checkUnsquareWay = _rules.unsquare_way;
46995       if (!cache.graph || typeof checkUnsquareWay !== "function") return;
46996       cache.uncacheIssuesOfType("unsquare_way");
46997       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");
46998       buildings.forEach((entity) => {
46999         const detected = checkUnsquareWay(entity, cache.graph);
47000         if (!detected.length) return;
47001         cache.cacheIssues(detected);
47002       });
47003     }
47004     validator.getIssues = (options2) => {
47005       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
47006       const view = context.map().extent();
47007       let seen = /* @__PURE__ */ new Set();
47008       let results = [];
47009       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
47010         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
47011           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
47012           if (opts.what === "edited" && !userModified) return;
47013           if (!filter2(issue)) return;
47014           seen.add(issue.id);
47015           results.push(issue);
47016         });
47017       }
47018       if (opts.what === "all") {
47019         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
47020           if (!filter2(issue)) return;
47021           seen.add(issue.id);
47022           results.push(issue);
47023         });
47024       }
47025       return results;
47026       function filter2(issue) {
47027         if (!issue) return false;
47028         if (seen.has(issue.id)) return false;
47029         if (_resolvedIssueIDs.has(issue.id)) return false;
47030         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
47031         if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
47032         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
47033         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
47034         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
47035         if (opts.where === "visible") {
47036           const extent = issue.extent(context.graph());
47037           if (!view.intersects(extent)) return false;
47038         }
47039         return true;
47040       }
47041     };
47042     validator.getResolvedIssues = () => {
47043       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
47044     };
47045     validator.focusIssue = (issue) => {
47046       const graph = context.graph();
47047       let selectID;
47048       let focusCenter;
47049       const issueExtent = issue.extent(graph);
47050       if (issueExtent) {
47051         focusCenter = issueExtent.center();
47052       }
47053       if (issue.entityIds && issue.entityIds.length) {
47054         selectID = issue.entityIds[0];
47055         if (selectID && selectID.charAt(0) === "r") {
47056           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
47057           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
47058           if (!nodeID) {
47059             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
47060             if (wayID) {
47061               nodeID = graph.entity(wayID).first();
47062             }
47063           }
47064           if (nodeID) {
47065             focusCenter = graph.entity(nodeID).loc;
47066           }
47067         }
47068       }
47069       if (focusCenter) {
47070         const setZoom = Math.max(context.map().zoom(), 19);
47071         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
47072       }
47073       if (selectID) {
47074         window.setTimeout(() => {
47075           context.enter(modeSelect(context, [selectID]));
47076           dispatch14.call("focusedIssue", this, issue);
47077         }, 250);
47078       }
47079     };
47080     validator.getIssuesBySeverity = (options2) => {
47081       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
47082       groups.error = groups.error || [];
47083       groups.warning = groups.warning || [];
47084       return groups;
47085     };
47086     validator.getSharedEntityIssues = (entityIDs, options2) => {
47087       const orderedIssueTypes = [
47088         // Show some issue types in a particular order:
47089         "missing_tag",
47090         "missing_role",
47091         // - missing data first
47092         "outdated_tags",
47093         "mismatched_geometry",
47094         // - identity issues
47095         "crossing_ways",
47096         "almost_junction",
47097         // - geometry issues where fixing them might solve connectivity issues
47098         "disconnected_way",
47099         "impossible_oneway"
47100         // - finally connectivity issues
47101       ];
47102       const allIssues = validator.getIssues(options2);
47103       const forEntityIDs = new Set(entityIDs);
47104       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
47105         if (issue1.type === issue2.type) {
47106           return issue1.id < issue2.id ? -1 : 1;
47107         }
47108         const index1 = orderedIssueTypes.indexOf(issue1.type);
47109         const index2 = orderedIssueTypes.indexOf(issue2.type);
47110         if (index1 !== -1 && index2 !== -1) {
47111           return index1 - index2;
47112         } else if (index1 === -1 && index2 === -1) {
47113           return issue1.type < issue2.type ? -1 : 1;
47114         } else {
47115           return index1 !== -1 ? -1 : 1;
47116         }
47117       });
47118     };
47119     validator.getEntityIssues = (entityID, options2) => {
47120       return validator.getSharedEntityIssues([entityID], options2);
47121     };
47122     validator.getRuleKeys = () => {
47123       return Object.keys(_rules);
47124     };
47125     validator.isRuleEnabled = (key) => {
47126       return !_disabledRules[key];
47127     };
47128     validator.toggleRule = (key) => {
47129       if (_disabledRules[key]) {
47130         delete _disabledRules[key];
47131       } else {
47132         _disabledRules[key] = true;
47133       }
47134       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47135       validator.validate();
47136     };
47137     validator.disableRules = (keys2) => {
47138       _disabledRules = {};
47139       keys2.forEach((k2) => _disabledRules[k2] = true);
47140       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47141       validator.validate();
47142     };
47143     validator.ignoreIssue = (issueID) => {
47144       _ignoredIssueIDs.add(issueID);
47145     };
47146     validator.validate = () => {
47147       const baseGraph = context.history().base();
47148       if (!_headCache.graph) _headCache.graph = baseGraph;
47149       if (!_baseCache.graph) _baseCache.graph = baseGraph;
47150       const prevGraph = _headCache.graph;
47151       const currGraph = context.graph();
47152       if (currGraph === prevGraph) {
47153         _headIsCurrent = true;
47154         dispatch14.call("validated");
47155         return Promise.resolve();
47156       }
47157       if (_headPromise) {
47158         _headIsCurrent = false;
47159         return _headPromise;
47160       }
47161       _headCache.graph = currGraph;
47162       _completeDiff = context.history().difference().complete();
47163       const incrementalDiff = coreDifference(prevGraph, currGraph);
47164       const diff = Object.keys(incrementalDiff.complete());
47165       const entityIDs = _headCache.withAllRelatedEntities(diff);
47166       if (!entityIDs.size) {
47167         dispatch14.call("validated");
47168         return Promise.resolve();
47169       }
47170       const addConnectedWays = (graph) => diff.filter((entityID) => graph.hasEntity(entityID)).map((entityID) => graph.entity(entityID)).flatMap((entity) => graph.childNodes(entity)).flatMap((vertex) => graph.parentWays(vertex)).forEach((way) => entityIDs.add(way.id));
47171       addConnectedWays(currGraph);
47172       addConnectedWays(prevGraph);
47173       Object.values({ ...incrementalDiff.created(), ...incrementalDiff.deleted() }).filter((e3) => e3.type === "relation").flatMap((r2) => r2.members).forEach((m2) => entityIDs.add(m2.id));
47174       Object.values(incrementalDiff.modified()).filter((e3) => e3.type === "relation").map((r2) => ({ baseEntity: prevGraph.entity(r2.id), headEntity: r2 })).forEach(({ baseEntity, headEntity }) => {
47175         const bm = baseEntity.members.map((m2) => m2.id);
47176         const hm = headEntity.members.map((m2) => m2.id);
47177         const symDiff = utilArrayDifference(utilArrayUnion(bm, hm), utilArrayIntersection(bm, hm));
47178         symDiff.forEach((id2) => entityIDs.add(id2));
47179       });
47180       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
47181       }).then(() => {
47182         _headPromise = null;
47183         if (!_headIsCurrent) {
47184           validator.validate();
47185         }
47186       });
47187       return _headPromise;
47188     };
47189     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
47190       reset(false);
47191       validator.validate();
47192     });
47193     context.on("exit.validator", validator.validate);
47194     context.history().on("merge.validator", (entities) => {
47195       if (!entities) return;
47196       const baseGraph = context.history().base();
47197       if (!_headCache.graph) _headCache.graph = baseGraph;
47198       if (!_baseCache.graph) _baseCache.graph = baseGraph;
47199       let entityIDs = entities.map((entity) => entity.id);
47200       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
47201       validateEntitiesAsync(entityIDs, _baseCache);
47202     });
47203     function validateEntity(entity, graph) {
47204       let result = { issues: [], provisional: false };
47205       Object.keys(_rules).forEach(runValidation);
47206       return result;
47207       function runValidation(key) {
47208         const fn = _rules[key];
47209         if (typeof fn !== "function") {
47210           console.error("no such validation rule = " + key);
47211           return;
47212         }
47213         let detected = fn(entity, graph);
47214         if (detected.provisional) {
47215           result.provisional = true;
47216         }
47217         detected = detected.filter(applySeverityOverrides);
47218         result.issues = result.issues.concat(detected);
47219         function applySeverityOverrides(issue) {
47220           const type2 = issue.type;
47221           const subtype = issue.subtype || "";
47222           let i3;
47223           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
47224             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
47225               issue.severity = "error";
47226               return true;
47227             }
47228           }
47229           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
47230             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
47231               issue.severity = "warning";
47232               return true;
47233             }
47234           }
47235           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
47236             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
47237               return false;
47238             }
47239           }
47240           return true;
47241         }
47242       }
47243     }
47244     function updateResolvedIssues(entityIDs) {
47245       entityIDs.forEach((entityID) => {
47246         const baseIssues = _baseCache.issuesByEntityID[entityID];
47247         if (!baseIssues) return;
47248         baseIssues.forEach((issueID) => {
47249           const issue = _baseCache.issuesByIssueID[issueID];
47250           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
47251           if (userModified && !_headCache.issuesByIssueID[issueID]) {
47252             _resolvedIssueIDs.add(issueID);
47253           } else {
47254             _resolvedIssueIDs.delete(issueID);
47255           }
47256         });
47257       });
47258     }
47259     function validateEntitiesAsync(entityIDs, cache) {
47260       const jobs = Array.from(entityIDs).map((entityID) => {
47261         if (cache.queuedEntityIDs.has(entityID)) return null;
47262         cache.queuedEntityIDs.add(entityID);
47263         cache.uncacheEntityID(entityID);
47264         return () => {
47265           cache.queuedEntityIDs.delete(entityID);
47266           const graph = cache.graph;
47267           if (!graph) return;
47268           const entity = graph.hasEntity(entityID);
47269           if (!entity) return;
47270           const result = validateEntity(entity, graph);
47271           if (result.provisional) {
47272             cache.provisionalEntityIDs.add(entityID);
47273           }
47274           cache.cacheIssues(result.issues);
47275         };
47276       }).filter(Boolean);
47277       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
47278       if (cache.queuePromise) return cache.queuePromise;
47279       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
47280       }).finally(() => cache.queuePromise = null);
47281       return cache.queuePromise;
47282     }
47283     function revalidateProvisionalEntities(cache) {
47284       if (!cache.provisionalEntityIDs.size) return;
47285       const handle = window.setTimeout(() => {
47286         _deferredST.delete(handle);
47287         if (!cache.provisionalEntityIDs.size) return;
47288         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
47289       }, RETRY);
47290       _deferredST.add(handle);
47291     }
47292     function processQueue(cache) {
47293       if (!cache.queue.length) return Promise.resolve();
47294       const chunk = cache.queue.pop();
47295       return new Promise((resolvePromise, rejectPromise) => {
47296         const handle = window.requestIdleCallback(() => {
47297           delete _deferredRIC[handle];
47298           chunk.forEach((job) => job());
47299           resolvePromise();
47300         });
47301         _deferredRIC[handle] = rejectPromise;
47302       }).then(() => {
47303         if (cache.queue.length % 25 === 0) dispatch14.call("validated");
47304       }).then(() => processQueue(cache));
47305     }
47306     return utilRebind(validator, dispatch14, "on");
47307   }
47308   function validationCache(which) {
47309     let cache = {
47310       which,
47311       graph: null,
47312       queue: [],
47313       queuePromise: null,
47314       queuedEntityIDs: /* @__PURE__ */ new Set(),
47315       provisionalEntityIDs: /* @__PURE__ */ new Set(),
47316       issuesByIssueID: {},
47317       // issue.id -> issue
47318       issuesByEntityID: {}
47319       // entity.id -> Set(issue.id)
47320     };
47321     cache.cacheIssue = (issue) => {
47322       (issue.entityIds || []).forEach((entityID) => {
47323         if (!cache.issuesByEntityID[entityID]) {
47324           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
47325         }
47326         cache.issuesByEntityID[entityID].add(issue.id);
47327       });
47328       cache.issuesByIssueID[issue.id] = issue;
47329     };
47330     cache.uncacheIssue = (issue) => {
47331       (issue.entityIds || []).forEach((entityID) => {
47332         if (cache.issuesByEntityID[entityID]) {
47333           cache.issuesByEntityID[entityID].delete(issue.id);
47334         }
47335       });
47336       delete cache.issuesByIssueID[issue.id];
47337     };
47338     cache.cacheIssues = (issues) => {
47339       issues.forEach(cache.cacheIssue);
47340     };
47341     cache.uncacheIssues = (issues) => {
47342       issues.forEach(cache.uncacheIssue);
47343     };
47344     cache.uncacheIssuesOfType = (type2) => {
47345       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
47346       cache.uncacheIssues(issuesOfType);
47347     };
47348     cache.uncacheEntityID = (entityID) => {
47349       const entityIssueIDs = cache.issuesByEntityID[entityID];
47350       if (entityIssueIDs) {
47351         entityIssueIDs.forEach((issueID) => {
47352           const issue = cache.issuesByIssueID[issueID];
47353           if (issue) {
47354             cache.uncacheIssue(issue);
47355           } else {
47356             delete cache.issuesByIssueID[issueID];
47357           }
47358         });
47359       }
47360       delete cache.issuesByEntityID[entityID];
47361       cache.provisionalEntityIDs.delete(entityID);
47362     };
47363     cache.withAllRelatedEntities = (entityIDs) => {
47364       let result = /* @__PURE__ */ new Set();
47365       (entityIDs || []).forEach((entityID) => {
47366         result.add(entityID);
47367         const entityIssueIDs = cache.issuesByEntityID[entityID];
47368         if (entityIssueIDs) {
47369           entityIssueIDs.forEach((issueID) => {
47370             const issue = cache.issuesByIssueID[issueID];
47371             if (issue) {
47372               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
47373             } else {
47374               delete cache.issuesByIssueID[issueID];
47375             }
47376           });
47377         }
47378       });
47379       return result;
47380     };
47381     return cache;
47382   }
47383   var init_validator = __esm({
47384     "modules/core/validator.js"() {
47385       "use strict";
47386       init_src4();
47387       init_preferences();
47388       init_difference();
47389       init_extent();
47390       init_select5();
47391       init_util();
47392       init_validations();
47393     }
47394   });
47395
47396   // modules/core/uploader.js
47397   var uploader_exports = {};
47398   __export(uploader_exports, {
47399     coreUploader: () => coreUploader
47400   });
47401   function coreUploader(context) {
47402     var dispatch14 = dispatch_default(
47403       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
47404       "saveStarted",
47405       // dispatched as soon as a call to `save` has been deemed legitimate
47406       "saveEnded",
47407       // dispatched after the result event has been dispatched
47408       "willAttemptUpload",
47409       // dispatched before the actual upload call occurs, if it will
47410       "progressChanged",
47411       // Each save results in one of these outcomes:
47412       "resultNoChanges",
47413       // upload wasn't attempted since there were no edits
47414       "resultErrors",
47415       // upload failed due to errors
47416       "resultConflicts",
47417       // upload failed due to data conflicts
47418       "resultSuccess"
47419       // upload completed without errors
47420     );
47421     var _isSaving = false;
47422     let _anyConflictsAutomaticallyResolved = false;
47423     var _conflicts = [];
47424     var _errors = [];
47425     var _origChanges;
47426     var _discardTags = {};
47427     _mainFileFetcher.get("discarded").then(function(d2) {
47428       _discardTags = d2;
47429     }).catch(function() {
47430     });
47431     const uploader = {};
47432     uploader.isSaving = function() {
47433       return _isSaving;
47434     };
47435     uploader.save = function(changeset, tryAgain, checkConflicts) {
47436       if (_isSaving && !tryAgain) {
47437         return;
47438       }
47439       var osm = context.connection();
47440       if (!osm) return;
47441       if (!osm.authenticated()) {
47442         osm.authenticate(function(err) {
47443           if (!err) {
47444             uploader.save(changeset, tryAgain, checkConflicts);
47445           }
47446         });
47447         return;
47448       }
47449       if (!_isSaving) {
47450         _isSaving = true;
47451         dispatch14.call("saveStarted", this);
47452       }
47453       var history = context.history();
47454       _anyConflictsAutomaticallyResolved = false;
47455       _conflicts = [];
47456       _errors = [];
47457       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
47458       if (!tryAgain) {
47459         history.perform(actionNoop());
47460       }
47461       if (!checkConflicts) {
47462         upload(changeset);
47463       } else {
47464         performFullConflictCheck(changeset);
47465       }
47466     };
47467     function performFullConflictCheck(changeset) {
47468       var osm = context.connection();
47469       if (!osm) return;
47470       var history = context.history();
47471       var localGraph = context.graph();
47472       var remoteGraph = coreGraph(history.base(), true);
47473       var summary = history.difference().summary();
47474       var _toCheck = [];
47475       for (var i3 = 0; i3 < summary.length; i3++) {
47476         var item = summary[i3];
47477         if (item.changeType === "modified") {
47478           _toCheck.push(item.entity.id);
47479         }
47480       }
47481       var _toLoad = withChildNodes(_toCheck, localGraph);
47482       var _loaded = {};
47483       var _toLoadCount = 0;
47484       var _toLoadTotal = _toLoad.length;
47485       if (_toCheck.length) {
47486         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47487         _toLoad.forEach(function(id2) {
47488           _loaded[id2] = false;
47489         });
47490         osm.loadMultiple(_toLoad, loaded);
47491       } else {
47492         upload(changeset);
47493       }
47494       return;
47495       function withChildNodes(ids, graph) {
47496         var s2 = new Set(ids);
47497         ids.forEach(function(id2) {
47498           var entity = graph.entity(id2);
47499           if (entity.type !== "way") return;
47500           graph.childNodes(entity).forEach(function(child) {
47501             if (child.version !== void 0) {
47502               s2.add(child.id);
47503             }
47504           });
47505         });
47506         return Array.from(s2);
47507       }
47508       function loaded(err, result) {
47509         if (_errors.length) return;
47510         if (err) {
47511           _errors.push({
47512             msg: err.message || err.responseText,
47513             details: [_t("save.status_code", { code: err.status })]
47514           });
47515           didResultInErrors();
47516         } else {
47517           var loadMore = [];
47518           result.data.forEach(function(entity) {
47519             remoteGraph.replace(entity);
47520             _loaded[entity.id] = true;
47521             _toLoad = _toLoad.filter(function(val) {
47522               return val !== entity.id;
47523             });
47524             if (!entity.visible) return;
47525             var i4, id2;
47526             if (entity.type === "way") {
47527               for (i4 = 0; i4 < entity.nodes.length; i4++) {
47528                 id2 = entity.nodes[i4];
47529                 if (_loaded[id2] === void 0) {
47530                   _loaded[id2] = false;
47531                   loadMore.push(id2);
47532                 }
47533               }
47534             } else if (entity.type === "relation" && entity.isMultipolygon()) {
47535               for (i4 = 0; i4 < entity.members.length; i4++) {
47536                 id2 = entity.members[i4].id;
47537                 if (_loaded[id2] === void 0) {
47538                   _loaded[id2] = false;
47539                   loadMore.push(id2);
47540                 }
47541               }
47542             }
47543           });
47544           _toLoadCount += result.data.length;
47545           _toLoadTotal += loadMore.length;
47546           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47547           if (loadMore.length) {
47548             _toLoad.push.apply(_toLoad, loadMore);
47549             osm.loadMultiple(loadMore, loaded);
47550           }
47551           if (!_toLoad.length) {
47552             detectConflicts();
47553             upload(changeset);
47554           }
47555         }
47556       }
47557       function detectConflicts() {
47558         function choice(id2, text, action) {
47559           return {
47560             id: id2,
47561             text,
47562             action: function() {
47563               history.replace(action);
47564             }
47565           };
47566         }
47567         function formatUser(d2) {
47568           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
47569         }
47570         function entityName(entity) {
47571           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
47572         }
47573         function sameVersions(local, remote) {
47574           if (local.version !== remote.version) return false;
47575           if (local.type === "way") {
47576             var children2 = utilArrayUnion(local.nodes, remote.nodes);
47577             for (var i4 = 0; i4 < children2.length; i4++) {
47578               var a2 = localGraph.hasEntity(children2[i4]);
47579               var b2 = remoteGraph.hasEntity(children2[i4]);
47580               if (a2 && b2 && a2.version !== b2.version) return false;
47581             }
47582           }
47583           return true;
47584         }
47585         _toCheck.forEach(function(id2) {
47586           var local = localGraph.entity(id2);
47587           var remote = remoteGraph.entity(id2);
47588           if (sameVersions(local, remote)) return;
47589           var merge3 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
47590           history.replace(merge3);
47591           var mergeConflicts = merge3.conflicts();
47592           if (!mergeConflicts.length) {
47593             _anyConflictsAutomaticallyResolved = true;
47594             return;
47595           }
47596           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
47597           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
47598           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
47599           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
47600           _conflicts.push({
47601             id: id2,
47602             name: entityName(local),
47603             details: mergeConflicts,
47604             chosen: 1,
47605             choices: [
47606               choice(id2, keepMine, forceLocal),
47607               choice(id2, keepTheirs, forceRemote)
47608             ]
47609           });
47610         });
47611       }
47612     }
47613     async function upload(changeset) {
47614       var osm = context.connection();
47615       if (!osm) {
47616         _errors.push({ msg: "No OSM Service" });
47617       }
47618       if (_conflicts.length) {
47619         didResultInConflicts(changeset);
47620       } else if (_errors.length) {
47621         didResultInErrors();
47622       } else {
47623         if (_anyConflictsAutomaticallyResolved) {
47624           changeset.tags.merge_conflict_resolved = "automatically";
47625           await osm.updateChangesetTags(changeset);
47626         }
47627         var history = context.history();
47628         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
47629         if (changes.modified.length || changes.created.length || changes.deleted.length) {
47630           dispatch14.call("willAttemptUpload", this);
47631           osm.putChangeset(changeset, changes, uploadCallback);
47632         } else {
47633           didResultInNoChanges();
47634         }
47635       }
47636     }
47637     function uploadCallback(err, changeset) {
47638       if (err) {
47639         if (err.status === 409) {
47640           uploader.save(changeset, true, true);
47641         } else {
47642           _errors.push({
47643             msg: err.message || err.responseText,
47644             details: [_t("save.status_code", { code: err.status })]
47645           });
47646           didResultInErrors();
47647         }
47648       } else {
47649         didResultInSuccess(changeset);
47650       }
47651     }
47652     function didResultInNoChanges() {
47653       dispatch14.call("resultNoChanges", this);
47654       endSave();
47655       context.flush();
47656     }
47657     function didResultInErrors() {
47658       context.history().pop();
47659       dispatch14.call("resultErrors", this, _errors);
47660       endSave();
47661     }
47662     function didResultInConflicts(changeset) {
47663       changeset.tags.merge_conflict_resolved = "manually";
47664       context.connection().updateChangesetTags(changeset);
47665       _conflicts.sort(function(a2, b2) {
47666         return b2.id.localeCompare(a2.id);
47667       });
47668       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
47669       endSave();
47670     }
47671     function didResultInSuccess(changeset) {
47672       context.history().clearSaved();
47673       dispatch14.call("resultSuccess", this, changeset);
47674       window.setTimeout(function() {
47675         endSave();
47676         context.flush();
47677       }, 2500);
47678     }
47679     function endSave() {
47680       _isSaving = false;
47681       dispatch14.call("saveEnded", this);
47682     }
47683     uploader.cancelConflictResolution = function() {
47684       context.history().pop();
47685     };
47686     uploader.processResolvedConflicts = function(changeset) {
47687       var history = context.history();
47688       for (var i3 = 0; i3 < _conflicts.length; i3++) {
47689         if (_conflicts[i3].chosen === 1) {
47690           var entity = context.hasEntity(_conflicts[i3].id);
47691           if (entity && entity.type === "way") {
47692             var children2 = utilArrayUniq(entity.nodes);
47693             for (var j2 = 0; j2 < children2.length; j2++) {
47694               history.replace(actionRevert(children2[j2]));
47695             }
47696           }
47697           history.replace(actionRevert(_conflicts[i3].id));
47698         }
47699       }
47700       uploader.save(changeset, true, false);
47701     };
47702     uploader.reset = function() {
47703     };
47704     return utilRebind(uploader, dispatch14, "on");
47705   }
47706   var init_uploader = __esm({
47707     "modules/core/uploader.js"() {
47708       "use strict";
47709       init_src4();
47710       init_lodash();
47711       init_file_fetcher();
47712       init_discard_tags();
47713       init_merge_remote_changes();
47714       init_noop2();
47715       init_revert();
47716       init_graph();
47717       init_localizer();
47718       init_util();
47719     }
47720   });
47721
47722   // modules/modes/draw_area.js
47723   var draw_area_exports = {};
47724   __export(draw_area_exports, {
47725     modeDrawArea: () => modeDrawArea
47726   });
47727   function modeDrawArea(context, wayID, startGraph, button) {
47728     var mode = {
47729       button,
47730       id: "draw-area"
47731     };
47732     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
47733       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
47734     });
47735     mode.wayID = wayID;
47736     mode.enter = function() {
47737       context.install(behavior);
47738     };
47739     mode.exit = function() {
47740       context.uninstall(behavior);
47741     };
47742     mode.selectedIDs = function() {
47743       return [wayID];
47744     };
47745     mode.activeID = function() {
47746       return behavior && behavior.activeID() || [];
47747     };
47748     return mode;
47749   }
47750   var init_draw_area = __esm({
47751     "modules/modes/draw_area.js"() {
47752       "use strict";
47753       init_localizer();
47754       init_draw_way();
47755     }
47756   });
47757
47758   // modules/modes/add_area.js
47759   var add_area_exports = {};
47760   __export(add_area_exports, {
47761     modeAddArea: () => modeAddArea
47762   });
47763   function modeAddArea(context, mode) {
47764     mode.id = "add-area";
47765     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
47766     function defaultTags(loc) {
47767       var defaultTags2 = { area: "yes" };
47768       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
47769       return defaultTags2;
47770     }
47771     function actionClose(wayId) {
47772       return function(graph) {
47773         return graph.replace(graph.entity(wayId).close());
47774       };
47775     }
47776     function start2(loc) {
47777       var startGraph = context.graph();
47778       var node = osmNode({ loc });
47779       var way = osmWay({ tags: defaultTags(loc) });
47780       context.perform(
47781         actionAddEntity(node),
47782         actionAddEntity(way),
47783         actionAddVertex(way.id, node.id),
47784         actionClose(way.id)
47785       );
47786       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47787     }
47788     function startFromWay(loc, edge) {
47789       var startGraph = context.graph();
47790       var node = osmNode({ loc });
47791       var way = osmWay({ tags: defaultTags(loc) });
47792       context.perform(
47793         actionAddEntity(node),
47794         actionAddEntity(way),
47795         actionAddVertex(way.id, node.id),
47796         actionClose(way.id),
47797         actionAddMidpoint({ loc, edge }, node)
47798       );
47799       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47800     }
47801     function startFromNode(node) {
47802       var startGraph = context.graph();
47803       var way = osmWay({ tags: defaultTags(node.loc) });
47804       context.perform(
47805         actionAddEntity(way),
47806         actionAddVertex(way.id, node.id),
47807         actionClose(way.id)
47808       );
47809       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
47810     }
47811     mode.enter = function() {
47812       context.install(behavior);
47813     };
47814     mode.exit = function() {
47815       context.uninstall(behavior);
47816     };
47817     return mode;
47818   }
47819   var init_add_area = __esm({
47820     "modules/modes/add_area.js"() {
47821       "use strict";
47822       init_add_entity();
47823       init_add_midpoint();
47824       init_add_vertex();
47825       init_add_way();
47826       init_draw_area();
47827       init_osm();
47828     }
47829   });
47830
47831   // modules/modes/add_line.js
47832   var add_line_exports = {};
47833   __export(add_line_exports, {
47834     modeAddLine: () => modeAddLine
47835   });
47836   function modeAddLine(context, mode) {
47837     mode.id = "add-line";
47838     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
47839     function defaultTags(loc) {
47840       var defaultTags2 = {};
47841       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
47842       return defaultTags2;
47843     }
47844     function start2(loc) {
47845       var startGraph = context.graph();
47846       var node = osmNode({ loc });
47847       var way = osmWay({ tags: defaultTags(loc) });
47848       context.perform(
47849         actionAddEntity(node),
47850         actionAddEntity(way),
47851         actionAddVertex(way.id, node.id)
47852       );
47853       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47854     }
47855     function startFromWay(loc, edge) {
47856       var startGraph = context.graph();
47857       var node = osmNode({ loc });
47858       var way = osmWay({ tags: defaultTags(loc) });
47859       context.perform(
47860         actionAddEntity(node),
47861         actionAddEntity(way),
47862         actionAddVertex(way.id, node.id),
47863         actionAddMidpoint({ loc, edge }, node)
47864       );
47865       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47866     }
47867     function startFromNode(node) {
47868       var startGraph = context.graph();
47869       var way = osmWay({ tags: defaultTags(node.loc) });
47870       context.perform(
47871         actionAddEntity(way),
47872         actionAddVertex(way.id, node.id)
47873       );
47874       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
47875     }
47876     mode.enter = function() {
47877       context.install(behavior);
47878     };
47879     mode.exit = function() {
47880       context.uninstall(behavior);
47881     };
47882     return mode;
47883   }
47884   var init_add_line = __esm({
47885     "modules/modes/add_line.js"() {
47886       "use strict";
47887       init_add_entity();
47888       init_add_midpoint();
47889       init_add_vertex();
47890       init_add_way();
47891       init_draw_line();
47892       init_osm();
47893     }
47894   });
47895
47896   // modules/modes/add_point.js
47897   var add_point_exports = {};
47898   __export(add_point_exports, {
47899     modeAddPoint: () => modeAddPoint
47900   });
47901   function modeAddPoint(context, mode) {
47902     mode.id = "add-point";
47903     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
47904     function defaultTags(loc) {
47905       var defaultTags2 = {};
47906       if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
47907       return defaultTags2;
47908     }
47909     function add(loc) {
47910       var node = osmNode({ loc, tags: defaultTags(loc) });
47911       context.perform(
47912         actionAddEntity(node),
47913         _t("operations.add.annotation.point")
47914       );
47915       enterSelectMode(node);
47916     }
47917     function addWay(loc, edge) {
47918       var node = osmNode({ tags: defaultTags(loc) });
47919       context.perform(
47920         actionAddMidpoint({ loc, edge }, node),
47921         _t("operations.add.annotation.vertex")
47922       );
47923       enterSelectMode(node);
47924     }
47925     function enterSelectMode(node) {
47926       context.enter(
47927         modeSelect(context, [node.id]).newFeature(true)
47928       );
47929     }
47930     function addNode(node) {
47931       const _defaultTags = defaultTags(node.loc);
47932       if (Object.keys(_defaultTags).length === 0) {
47933         enterSelectMode(node);
47934         return;
47935       }
47936       var tags = Object.assign({}, node.tags);
47937       for (var key in _defaultTags) {
47938         tags[key] = _defaultTags[key];
47939       }
47940       context.perform(
47941         actionChangeTags(node.id, tags),
47942         _t("operations.add.annotation.point")
47943       );
47944       enterSelectMode(node);
47945     }
47946     function cancel() {
47947       context.enter(modeBrowse(context));
47948     }
47949     mode.enter = function() {
47950       context.install(behavior);
47951     };
47952     mode.exit = function() {
47953       context.uninstall(behavior);
47954     };
47955     return mode;
47956   }
47957   var init_add_point = __esm({
47958     "modules/modes/add_point.js"() {
47959       "use strict";
47960       init_localizer();
47961       init_draw();
47962       init_browse();
47963       init_select5();
47964       init_node2();
47965       init_add_entity();
47966       init_change_tags();
47967       init_add_midpoint();
47968     }
47969   });
47970
47971   // modules/ui/note_comments.js
47972   var note_comments_exports = {};
47973   __export(note_comments_exports, {
47974     uiNoteComments: () => uiNoteComments
47975   });
47976   function uiNoteComments() {
47977     var _note;
47978     function noteComments(selection2) {
47979       if (_note.isNew()) return;
47980       var comments = selection2.selectAll(".comments-container").data([0]);
47981       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
47982       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
47983       commentEnter.append("div").attr("class", function(d2) {
47984         return "comment-avatar user-" + d2.uid;
47985       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
47986       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
47987       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
47988       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
47989         var selection3 = select_default2(this);
47990         var osm = services.osm;
47991         if (osm && d2.user) {
47992           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
47993         }
47994         if (d2.user) {
47995           selection3.text(d2.user);
47996         } else {
47997           selection3.call(_t.append("note.anonymous"));
47998         }
47999       });
48000       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
48001         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
48002       });
48003       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
48004         return d2.html;
48005       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
48006       comments.call(replaceAvatars);
48007     }
48008     function replaceAvatars(selection2) {
48009       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
48010       var osm = services.osm;
48011       if (showThirdPartyIcons !== "true" || !osm) return;
48012       var uids = {};
48013       _note.comments.forEach(function(d2) {
48014         if (d2.uid) uids[d2.uid] = true;
48015       });
48016       Object.keys(uids).forEach(function(uid) {
48017         osm.loadUser(uid, function(err, user) {
48018           if (!user || !user.image_url) return;
48019           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);
48020         });
48021       });
48022     }
48023     function localeDateString2(s2) {
48024       if (!s2) return null;
48025       var options2 = { day: "numeric", month: "short", year: "numeric" };
48026       s2 = s2.replace(/-/g, "/");
48027       var d2 = new Date(s2);
48028       if (isNaN(d2.getTime())) return null;
48029       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
48030     }
48031     noteComments.note = function(val) {
48032       if (!arguments.length) return _note;
48033       _note = val;
48034       return noteComments;
48035     };
48036     return noteComments;
48037   }
48038   var init_note_comments = __esm({
48039     "modules/ui/note_comments.js"() {
48040       "use strict";
48041       init_src5();
48042       init_preferences();
48043       init_localizer();
48044       init_icon();
48045       init_services();
48046     }
48047   });
48048
48049   // modules/ui/note_header.js
48050   var note_header_exports = {};
48051   __export(note_header_exports, {
48052     uiNoteHeader: () => uiNoteHeader
48053   });
48054   function uiNoteHeader() {
48055     var _note;
48056     function noteHeader(selection2) {
48057       var header = selection2.selectAll(".note-header").data(
48058         _note ? [_note] : [],
48059         function(d2) {
48060           return d2.status + d2.id;
48061         }
48062       );
48063       header.exit().remove();
48064       var headerEnter = header.enter().append("div").attr("class", "note-header");
48065       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
48066         return "note-header-icon " + d2.status;
48067       }).classed("new", function(d2) {
48068         return d2.id < 0;
48069       });
48070       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
48071       iconEnter.each(function(d2) {
48072         var statusIcon;
48073         if (d2.id < 0) {
48074           statusIcon = "#iD-icon-plus";
48075         } else if (d2.status === "open") {
48076           statusIcon = "#iD-icon-close";
48077         } else {
48078           statusIcon = "#iD-icon-apply";
48079         }
48080         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
48081       });
48082       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
48083         if (_note.isNew()) {
48084           return _t.html("note.new");
48085         }
48086         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
48087       });
48088     }
48089     noteHeader.note = function(val) {
48090       if (!arguments.length) return _note;
48091       _note = val;
48092       return noteHeader;
48093     };
48094     return noteHeader;
48095   }
48096   var init_note_header = __esm({
48097     "modules/ui/note_header.js"() {
48098       "use strict";
48099       init_localizer();
48100       init_icon();
48101     }
48102   });
48103
48104   // modules/ui/note_report.js
48105   var note_report_exports = {};
48106   __export(note_report_exports, {
48107     uiNoteReport: () => uiNoteReport
48108   });
48109   function uiNoteReport() {
48110     var _note;
48111     function noteReport(selection2) {
48112       var url;
48113       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
48114         url = services.osm.noteReportURL(_note);
48115       }
48116       var link3 = selection2.selectAll(".note-report").data(url ? [url] : []);
48117       link3.exit().remove();
48118       var linkEnter = link3.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
48119         return d2;
48120       }).call(svgIcon("#iD-icon-out-link", "inline"));
48121       linkEnter.append("span").call(_t.append("note.report"));
48122     }
48123     noteReport.note = function(val) {
48124       if (!arguments.length) return _note;
48125       _note = val;
48126       return noteReport;
48127     };
48128     return noteReport;
48129   }
48130   var init_note_report = __esm({
48131     "modules/ui/note_report.js"() {
48132       "use strict";
48133       init_localizer();
48134       init_osm();
48135       init_services();
48136       init_icon();
48137     }
48138   });
48139
48140   // modules/ui/view_on_osm.js
48141   var view_on_osm_exports = {};
48142   __export(view_on_osm_exports, {
48143     uiViewOnOSM: () => uiViewOnOSM
48144   });
48145   function uiViewOnOSM(context) {
48146     var _what;
48147     function viewOnOSM(selection2) {
48148       var url;
48149       if (_what instanceof osmEntity) {
48150         url = context.connection().entityURL(_what);
48151       } else if (_what instanceof osmNote) {
48152         url = context.connection().noteURL(_what);
48153       }
48154       var data = !_what || _what.isNew() ? [] : [_what];
48155       var link3 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
48156         return d2.id;
48157       });
48158       link3.exit().remove();
48159       var linkEnter = link3.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
48160       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
48161     }
48162     viewOnOSM.what = function(_2) {
48163       if (!arguments.length) return _what;
48164       _what = _2;
48165       return viewOnOSM;
48166     };
48167     return viewOnOSM;
48168   }
48169   var init_view_on_osm = __esm({
48170     "modules/ui/view_on_osm.js"() {
48171       "use strict";
48172       init_localizer();
48173       init_osm();
48174       init_icon();
48175     }
48176   });
48177
48178   // modules/ui/note_editor.js
48179   var note_editor_exports = {};
48180   __export(note_editor_exports, {
48181     uiNoteEditor: () => uiNoteEditor
48182   });
48183   function uiNoteEditor(context) {
48184     var dispatch14 = dispatch_default("change");
48185     var noteComments = uiNoteComments(context);
48186     var noteHeader = uiNoteHeader();
48187     var _note;
48188     var _newNote;
48189     function noteEditor(selection2) {
48190       var header = selection2.selectAll(".header").data([0]);
48191       var headerEnter = header.enter().append("div").attr("class", "header fillL");
48192       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
48193         context.enter(modeBrowse(context));
48194       }).call(svgIcon("#iD-icon-close"));
48195       headerEnter.append("h2").call(_t.append("note.title"));
48196       var body = selection2.selectAll(".body").data([0]);
48197       body = body.enter().append("div").attr("class", "body").merge(body);
48198       var editor = body.selectAll(".note-editor").data([0]);
48199       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
48200       var footer = selection2.selectAll(".footer").data([0]);
48201       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
48202       var osm = services.osm;
48203       if (osm) {
48204         osm.on("change.note-save", function() {
48205           selection2.call(noteEditor);
48206         });
48207       }
48208     }
48209     function noteSaveSection(selection2) {
48210       var isSelected = _note && _note.id === context.selectedNoteID();
48211       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
48212         return d2.status + d2.id;
48213       });
48214       noteSave.exit().remove();
48215       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
48216       noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
48217         if (_note.isNew()) {
48218           _t.append("note.newDescription")(select_default2(this));
48219         } else {
48220           _t.append("note.newComment")(select_default2(this));
48221         }
48222       });
48223       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
48224         return d2.newComment;
48225       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
48226       if (!commentTextarea.empty() && _newNote) {
48227         commentTextarea.node().focus();
48228       }
48229       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
48230       function keydown(d3_event) {
48231         if (!(d3_event.keyCode === 13 && // ↩ Return
48232         d3_event.metaKey)) return;
48233         var osm = services.osm;
48234         if (!osm) return;
48235         var hasAuth = osm.authenticated();
48236         if (!hasAuth) return;
48237         if (!_note.newComment) return;
48238         d3_event.preventDefault();
48239         select_default2(this).on("keydown.note-input", null);
48240         window.setTimeout(function() {
48241           if (_note.isNew()) {
48242             noteSave.selectAll(".save-button").node().focus();
48243             clickSave(_note);
48244           } else {
48245             noteSave.selectAll(".comment-button").node().focus();
48246             clickComment(_note);
48247           }
48248         }, 10);
48249       }
48250       function changeInput() {
48251         var input = select_default2(this);
48252         var val = input.property("value").trim() || void 0;
48253         _note = _note.update({ newComment: val });
48254         var osm = services.osm;
48255         if (osm) {
48256           osm.replaceNote(_note);
48257         }
48258         noteSave.call(noteSaveButtons);
48259       }
48260     }
48261     function userDetails(selection2) {
48262       var detailSection = selection2.selectAll(".detail-section").data([0]);
48263       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
48264       var osm = services.osm;
48265       if (!osm) return;
48266       var hasAuth = osm.authenticated();
48267       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
48268       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
48269       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
48270       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
48271       authEnter.append("span").call(_t.append("note.login"));
48272       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) {
48273         d3_event.preventDefault();
48274         osm.authenticate();
48275       });
48276       authEnter.transition().duration(200).style("opacity", 1);
48277       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
48278       prose.exit().remove();
48279       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
48280       osm.userDetails(function(err, user) {
48281         if (err) return;
48282         var userLink = select_default2(document.createElement("div"));
48283         if (user.image_url) {
48284           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
48285         }
48286         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
48287         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
48288       });
48289     }
48290     function noteSaveButtons(selection2) {
48291       var osm = services.osm;
48292       var hasAuth = osm && osm.authenticated();
48293       var isSelected = _note && _note.id === context.selectedNoteID();
48294       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
48295         return d2.status + d2.id;
48296       });
48297       buttonSection.exit().remove();
48298       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
48299       if (_note.isNew()) {
48300         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
48301         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
48302       } else {
48303         buttonEnter.append("button").attr("class", "button status-button action");
48304         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
48305       }
48306       buttonSection = buttonSection.merge(buttonEnter);
48307       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
48308       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
48309       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
48310         var action = d2.status === "open" ? "close" : "open";
48311         var andComment = d2.newComment ? "_comment" : "";
48312         _t.addOrUpdate("note." + action + andComment)(select_default2(this));
48313       }).on("click.status", clickStatus);
48314       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
48315       function isSaveDisabled(d2) {
48316         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
48317       }
48318     }
48319     function clickCancel(d3_event, d2) {
48320       this.blur();
48321       var osm = services.osm;
48322       if (osm) {
48323         osm.removeNote(d2);
48324       }
48325       context.enter(modeBrowse(context));
48326       dispatch14.call("change");
48327     }
48328     function clickSave(d3_event, d2) {
48329       this.blur();
48330       var osm = services.osm;
48331       if (osm) {
48332         osm.postNoteCreate(d2, function(err, note) {
48333           dispatch14.call("change", note);
48334         });
48335       }
48336     }
48337     function clickStatus(d3_event, d2) {
48338       this.blur();
48339       var osm = services.osm;
48340       if (osm) {
48341         var setStatus = d2.status === "open" ? "closed" : "open";
48342         osm.postNoteUpdate(d2, setStatus, function(err, note) {
48343           dispatch14.call("change", note);
48344         });
48345       }
48346     }
48347     function clickComment(d3_event, d2) {
48348       this.blur();
48349       var osm = services.osm;
48350       if (osm) {
48351         osm.postNoteUpdate(d2, d2.status, function(err, note) {
48352           dispatch14.call("change", note);
48353         });
48354       }
48355     }
48356     noteEditor.note = function(val) {
48357       if (!arguments.length) return _note;
48358       _note = val;
48359       return noteEditor;
48360     };
48361     noteEditor.newNote = function(val) {
48362       if (!arguments.length) return _newNote;
48363       _newNote = val;
48364       return noteEditor;
48365     };
48366     return utilRebind(noteEditor, dispatch14, "on");
48367   }
48368   var init_note_editor = __esm({
48369     "modules/ui/note_editor.js"() {
48370       "use strict";
48371       init_src4();
48372       init_src5();
48373       init_localizer();
48374       init_services();
48375       init_browse();
48376       init_icon();
48377       init_note_comments();
48378       init_note_header();
48379       init_note_report();
48380       init_view_on_osm();
48381       init_util();
48382     }
48383   });
48384
48385   // modules/modes/select_note.js
48386   var select_note_exports = {};
48387   __export(select_note_exports, {
48388     modeSelectNote: () => modeSelectNote
48389   });
48390   function modeSelectNote(context, selectedNoteID) {
48391     var mode = {
48392       id: "select-note",
48393       button: "browse"
48394     };
48395     var _keybinding = utilKeybinding("select-note");
48396     var _noteEditor = uiNoteEditor(context).on("change", function() {
48397       context.map().pan([0, 0]);
48398       var note = checkSelectedID();
48399       if (!note) return;
48400       context.ui().sidebar.show(_noteEditor.note(note));
48401     });
48402     var _behaviors = [
48403       behaviorBreathe(context),
48404       behaviorHover(context),
48405       behaviorSelect(context),
48406       behaviorLasso(context),
48407       modeDragNode(context).behavior,
48408       modeDragNote(context).behavior
48409     ];
48410     var _newFeature = false;
48411     function checkSelectedID() {
48412       if (!services.osm) return;
48413       var note = services.osm.getNote(selectedNoteID);
48414       if (!note) {
48415         context.enter(modeBrowse(context));
48416       }
48417       return note;
48418     }
48419     function selectNote(d3_event, drawn) {
48420       if (!checkSelectedID()) return;
48421       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
48422       if (selection2.empty()) {
48423         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
48424         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
48425           context.enter(modeBrowse(context));
48426         }
48427       } else {
48428         selection2.classed("selected", true);
48429         context.selectedNoteID(selectedNoteID);
48430       }
48431     }
48432     function esc() {
48433       if (context.container().select(".combobox").size()) return;
48434       context.enter(modeBrowse(context));
48435     }
48436     mode.zoomToSelected = function() {
48437       if (!services.osm) return;
48438       var note = services.osm.getNote(selectedNoteID);
48439       if (note) {
48440         context.map().centerZoomEase(note.loc, 20);
48441       }
48442     };
48443     mode.newFeature = function(val) {
48444       if (!arguments.length) return _newFeature;
48445       _newFeature = val;
48446       return mode;
48447     };
48448     mode.enter = function() {
48449       var note = checkSelectedID();
48450       if (!note) return;
48451       _behaviors.forEach(context.install);
48452       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
48453       select_default2(document).call(_keybinding);
48454       selectNote();
48455       var sidebar = context.ui().sidebar;
48456       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
48457       sidebar.expand(sidebar.intersects(note.extent()));
48458       context.map().on("drawn.select", selectNote);
48459     };
48460     mode.exit = function() {
48461       _behaviors.forEach(context.uninstall);
48462       select_default2(document).call(_keybinding.unbind);
48463       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
48464       context.map().on("drawn.select", null);
48465       context.ui().sidebar.hide();
48466       context.selectedNoteID(null);
48467     };
48468     return mode;
48469   }
48470   var init_select_note = __esm({
48471     "modules/modes/select_note.js"() {
48472       "use strict";
48473       init_src5();
48474       init_breathe();
48475       init_hover();
48476       init_lasso2();
48477       init_select4();
48478       init_localizer();
48479       init_browse();
48480       init_drag_node();
48481       init_drag_note();
48482       init_services();
48483       init_note_editor();
48484       init_util();
48485     }
48486   });
48487
48488   // modules/modes/add_note.js
48489   var add_note_exports = {};
48490   __export(add_note_exports, {
48491     modeAddNote: () => modeAddNote
48492   });
48493   function modeAddNote(context) {
48494     var mode = {
48495       id: "add-note",
48496       button: "note",
48497       description: _t.append("modes.add_note.description"),
48498       key: _t("modes.add_note.key")
48499     };
48500     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
48501     function add(loc) {
48502       var osm = services.osm;
48503       if (!osm) return;
48504       var note = osmNote({ loc, status: "open", comments: [] });
48505       osm.replaceNote(note);
48506       context.map().pan([0, 0]);
48507       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
48508     }
48509     function cancel() {
48510       context.enter(modeBrowse(context));
48511     }
48512     mode.enter = function() {
48513       context.install(behavior);
48514     };
48515     mode.exit = function() {
48516       context.uninstall(behavior);
48517     };
48518     return mode;
48519   }
48520   var init_add_note = __esm({
48521     "modules/modes/add_note.js"() {
48522       "use strict";
48523       init_localizer();
48524       init_draw();
48525       init_browse();
48526       init_select_note();
48527       init_osm();
48528       init_services();
48529     }
48530   });
48531
48532   // modules/util/jxon.js
48533   var jxon_exports = {};
48534   __export(jxon_exports, {
48535     JXON: () => JXON
48536   });
48537   var JXON;
48538   var init_jxon = __esm({
48539     "modules/util/jxon.js"() {
48540       "use strict";
48541       JXON = new function() {
48542         var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
48543         function parseText(sValue) {
48544           if (rIsNull.test(sValue)) {
48545             return null;
48546           }
48547           if (rIsBool.test(sValue)) {
48548             return sValue.toLowerCase() === "true";
48549           }
48550           if (isFinite(sValue)) {
48551             return parseFloat(sValue);
48552           }
48553           if (isFinite(Date.parse(sValue))) {
48554             return new Date(sValue);
48555           }
48556           return sValue;
48557         }
48558         function EmptyTree() {
48559         }
48560         EmptyTree.prototype.toString = function() {
48561           return "null";
48562         };
48563         EmptyTree.prototype.valueOf = function() {
48564           return null;
48565         };
48566         function objectify(vValue) {
48567           return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
48568         }
48569         function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
48570           var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
48571           var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
48572             /* put here the default value for empty nodes: */
48573             true
48574           );
48575           if (bChildren) {
48576             for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
48577               oNode = oParentNode.childNodes.item(nItem);
48578               if (oNode.nodeType === 4) {
48579                 sCollectedTxt += oNode.nodeValue;
48580               } else if (oNode.nodeType === 3) {
48581                 sCollectedTxt += oNode.nodeValue.trim();
48582               } else if (oNode.nodeType === 1 && !oNode.prefix) {
48583                 aCache.push(oNode);
48584               }
48585             }
48586           }
48587           var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
48588           if (!bHighVerb && (bChildren || bAttributes)) {
48589             vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
48590           }
48591           for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
48592             sProp = aCache[nElId].nodeName.toLowerCase();
48593             vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
48594             if (vResult.hasOwnProperty(sProp)) {
48595               if (vResult[sProp].constructor !== Array) {
48596                 vResult[sProp] = [vResult[sProp]];
48597               }
48598               vResult[sProp].push(vContent);
48599             } else {
48600               vResult[sProp] = vContent;
48601               nLength++;
48602             }
48603           }
48604           if (bAttributes) {
48605             var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
48606             for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
48607               oAttrib = oParentNode.attributes.item(nAttrib);
48608               oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
48609             }
48610             if (bNesteAttr) {
48611               if (bFreeze) {
48612                 Object.freeze(oAttrParent);
48613               }
48614               vResult[sAttributesProp] = oAttrParent;
48615               nLength -= nAttrLen - 1;
48616             }
48617           }
48618           if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
48619             vResult[sValueProp] = vBuiltVal;
48620           } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
48621             vResult = vBuiltVal;
48622           }
48623           if (bFreeze && (bHighVerb || nLength > 0)) {
48624             Object.freeze(vResult);
48625           }
48626           aCache.length = nLevelStart;
48627           return vResult;
48628         }
48629         function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
48630           var vValue, oChild;
48631           if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
48632             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
48633           } else if (oParentObj.constructor === Date) {
48634             oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
48635           }
48636           for (var sName in oParentObj) {
48637             vValue = oParentObj[sName];
48638             if (isFinite(sName) || vValue instanceof Function) {
48639               continue;
48640             }
48641             if (sName === sValueProp) {
48642               if (vValue !== null && vValue !== true) {
48643                 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
48644               }
48645             } else if (sName === sAttributesProp) {
48646               for (var sAttrib in vValue) {
48647                 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
48648               }
48649             } else if (sName.charAt(0) === sAttrPref) {
48650               oParentEl.setAttribute(sName.slice(1), vValue);
48651             } else if (vValue.constructor === Array) {
48652               for (var nItem = 0; nItem < vValue.length; nItem++) {
48653                 oChild = oXMLDoc.createElement(sName);
48654                 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
48655                 oParentEl.appendChild(oChild);
48656               }
48657             } else {
48658               oChild = oXMLDoc.createElement(sName);
48659               if (vValue instanceof Object) {
48660                 loadObjTree(oXMLDoc, oChild, vValue);
48661               } else if (vValue !== null && vValue !== true) {
48662                 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
48663               }
48664               oParentEl.appendChild(oChild);
48665             }
48666           }
48667         }
48668         this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
48669           var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
48670             /* put here the default verbosity level: */
48671             1
48672           );
48673           return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
48674         };
48675         this.unbuild = function(oObjTree) {
48676           var oNewDoc = document.implementation.createDocument("", "", null);
48677           loadObjTree(oNewDoc, oNewDoc, oObjTree);
48678           return oNewDoc;
48679         };
48680         this.stringify = function(oObjTree) {
48681           return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
48682         };
48683       }();
48684     }
48685   });
48686
48687   // modules/ui/conflicts.js
48688   var conflicts_exports = {};
48689   __export(conflicts_exports, {
48690     uiConflicts: () => uiConflicts
48691   });
48692   function uiConflicts(context) {
48693     var dispatch14 = dispatch_default("cancel", "save");
48694     var keybinding = utilKeybinding("conflicts");
48695     var _origChanges;
48696     var _conflictList;
48697     var _shownConflictIndex;
48698     function keybindingOn() {
48699       select_default2(document).call(keybinding.on("\u238B", cancel, true));
48700     }
48701     function keybindingOff() {
48702       select_default2(document).call(keybinding.unbind);
48703     }
48704     function tryAgain() {
48705       keybindingOff();
48706       dispatch14.call("save");
48707     }
48708     function cancel() {
48709       keybindingOff();
48710       dispatch14.call("cancel");
48711     }
48712     function conflicts(selection2) {
48713       keybindingOn();
48714       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
48715       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
48716       headerEnter.append("h2").call(_t.append("save.conflict.header"));
48717       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
48718       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
48719       var changeset = new osmChangeset();
48720       delete changeset.id;
48721       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
48722       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
48723       var fileName = "changes.osc";
48724       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
48725       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
48726       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
48727       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
48728       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
48729       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
48730       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
48731       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
48732     }
48733     function showConflict(selection2, index) {
48734       index = utilWrap(index, _conflictList.length);
48735       _shownConflictIndex = index;
48736       var parent = select_default2(selection2.node().parentNode);
48737       if (index === _conflictList.length - 1) {
48738         window.setTimeout(function() {
48739           parent.select(".conflicts-button").attr("disabled", null);
48740           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
48741         }, 250);
48742       }
48743       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
48744       conflict.exit().remove();
48745       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
48746       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
48747       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
48748         return d2.name;
48749       }).on("click", function(d3_event, d2) {
48750         d3_event.preventDefault();
48751         zoomToEntity(d2.id);
48752       });
48753       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
48754       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
48755         return d2.details || [];
48756       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
48757         return d2;
48758       });
48759       details.append("div").attr("class", "conflict-choices").call(addChoices);
48760       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) {
48761         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
48762       }).on("click", function(d3_event, d2) {
48763         d3_event.preventDefault();
48764         var container = parent.selectAll(".conflict-container");
48765         var sign2 = d2 === "previous" ? -1 : 1;
48766         container.selectAll(".conflict").remove();
48767         container.call(showConflict, index + sign2);
48768       }).each(function(d2) {
48769         _t.append("save.conflict." + d2)(select_default2(this));
48770       });
48771     }
48772     function addChoices(selection2) {
48773       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
48774         return d2.choices || [];
48775       });
48776       var choicesEnter = choices.enter().append("li").attr("class", "layer");
48777       var labelEnter = choicesEnter.append("label");
48778       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
48779         return d2.id;
48780       }).on("change", function(d3_event, d2) {
48781         var ul = this.parentNode.parentNode.parentNode;
48782         ul.__data__.chosen = d2.id;
48783         choose(d3_event, ul, d2);
48784       });
48785       labelEnter.append("span").text(function(d2) {
48786         return d2.text;
48787       });
48788       choicesEnter.merge(choices).each(function(d2) {
48789         var ul = this.parentNode;
48790         if (ul.__data__.chosen === d2.id) {
48791           choose(null, ul, d2);
48792         }
48793       });
48794     }
48795     function choose(d3_event, ul, datum2) {
48796       if (d3_event) d3_event.preventDefault();
48797       select_default2(ul).selectAll("li").classed("active", function(d2) {
48798         return d2 === datum2;
48799       }).selectAll("input").property("checked", function(d2) {
48800         return d2 === datum2;
48801       });
48802       var extent = geoExtent();
48803       var entity;
48804       entity = context.graph().hasEntity(datum2.id);
48805       if (entity) extent._extend(entity.extent(context.graph()));
48806       datum2.action();
48807       entity = context.graph().hasEntity(datum2.id);
48808       if (entity) extent._extend(entity.extent(context.graph()));
48809       zoomToEntity(datum2.id, extent);
48810     }
48811     function zoomToEntity(id2, extent) {
48812       context.surface().selectAll(".hover").classed("hover", false);
48813       var entity = context.graph().hasEntity(id2);
48814       if (entity) {
48815         if (extent) {
48816           context.map().trimmedExtent(extent);
48817         } else {
48818           context.map().zoomToEase(entity);
48819         }
48820         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
48821       }
48822     }
48823     conflicts.conflictList = function(_2) {
48824       if (!arguments.length) return _conflictList;
48825       _conflictList = _2;
48826       return conflicts;
48827     };
48828     conflicts.origChanges = function(_2) {
48829       if (!arguments.length) return _origChanges;
48830       _origChanges = _2;
48831       return conflicts;
48832     };
48833     conflicts.shownEntityIds = function() {
48834       if (_conflictList && typeof _shownConflictIndex === "number") {
48835         return [_conflictList[_shownConflictIndex].id];
48836       }
48837       return [];
48838     };
48839     return utilRebind(conflicts, dispatch14, "on");
48840   }
48841   var init_conflicts = __esm({
48842     "modules/ui/conflicts.js"() {
48843       "use strict";
48844       init_src4();
48845       init_src5();
48846       init_localizer();
48847       init_jxon();
48848       init_geo2();
48849       init_osm();
48850       init_icon();
48851       init_util();
48852     }
48853   });
48854
48855   // modules/ui/confirm.js
48856   var confirm_exports = {};
48857   __export(confirm_exports, {
48858     uiConfirm: () => uiConfirm
48859   });
48860   function uiConfirm(selection2) {
48861     var modalSelection = uiModal(selection2);
48862     modalSelection.select(".modal").classed("modal-alert", true);
48863     var section = modalSelection.select(".content");
48864     section.append("div").attr("class", "modal-section header");
48865     section.append("div").attr("class", "modal-section message-text");
48866     var buttons = section.append("div").attr("class", "modal-section buttons cf");
48867     modalSelection.okButton = function() {
48868       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
48869         modalSelection.remove();
48870       }).call(_t.append("confirm.okay")).node().focus();
48871       return modalSelection;
48872     };
48873     return modalSelection;
48874   }
48875   var init_confirm = __esm({
48876     "modules/ui/confirm.js"() {
48877       "use strict";
48878       init_localizer();
48879       init_modal();
48880     }
48881   });
48882
48883   // modules/ui/popover.js
48884   var popover_exports = {};
48885   __export(popover_exports, {
48886     uiPopover: () => uiPopover
48887   });
48888   function uiPopover(klass) {
48889     var _id = _popoverID++;
48890     var _anchorSelection = select_default2(null);
48891     var popover = function(selection2) {
48892       _anchorSelection = selection2;
48893       selection2.each(setup);
48894     };
48895     var _animation = utilFunctor(false);
48896     var _placement = utilFunctor("top");
48897     var _alignment = utilFunctor("center");
48898     var _scrollContainer = utilFunctor(select_default2(null));
48899     var _content;
48900     var _displayType = utilFunctor("");
48901     var _hasArrow = utilFunctor(true);
48902     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
48903     popover.displayType = function(val) {
48904       if (arguments.length) {
48905         _displayType = utilFunctor(val);
48906         return popover;
48907       } else {
48908         return _displayType;
48909       }
48910     };
48911     popover.hasArrow = function(val) {
48912       if (arguments.length) {
48913         _hasArrow = utilFunctor(val);
48914         return popover;
48915       } else {
48916         return _hasArrow;
48917       }
48918     };
48919     popover.placement = function(val) {
48920       if (arguments.length) {
48921         _placement = utilFunctor(val);
48922         return popover;
48923       } else {
48924         return _placement;
48925       }
48926     };
48927     popover.alignment = function(val) {
48928       if (arguments.length) {
48929         _alignment = utilFunctor(val);
48930         return popover;
48931       } else {
48932         return _alignment;
48933       }
48934     };
48935     popover.scrollContainer = function(val) {
48936       if (arguments.length) {
48937         _scrollContainer = utilFunctor(val);
48938         return popover;
48939       } else {
48940         return _scrollContainer;
48941       }
48942     };
48943     popover.content = function(val) {
48944       if (arguments.length) {
48945         _content = val;
48946         return popover;
48947       } else {
48948         return _content;
48949       }
48950     };
48951     popover.isShown = function() {
48952       var popoverSelection = _anchorSelection.select(".popover-" + _id);
48953       return !popoverSelection.empty() && popoverSelection.classed("in");
48954     };
48955     popover.show = function() {
48956       _anchorSelection.each(show);
48957     };
48958     popover.updateContent = function() {
48959       _anchorSelection.each(updateContent);
48960     };
48961     popover.hide = function() {
48962       _anchorSelection.each(hide);
48963     };
48964     popover.toggle = function() {
48965       _anchorSelection.each(toggle);
48966     };
48967     popover.destroy = function(selection2, selector) {
48968       selector = selector || ".popover-" + _id;
48969       selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("focus.popover", null).on("blur.popover", null).on("click.popover", null).attr("title", function() {
48970         return this.getAttribute("data-original-title") || this.getAttribute("title");
48971       }).attr("data-original-title", null).selectAll(selector).remove();
48972     };
48973     popover.destroyAny = function(selection2) {
48974       selection2.call(popover.destroy, ".popover");
48975     };
48976     function setup() {
48977       var anchor = select_default2(this);
48978       var animate = _animation.apply(this, arguments);
48979       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
48980       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
48981       enter.append("div").attr("class", "popover-arrow");
48982       enter.append("div").attr("class", "popover-inner");
48983       popoverSelection = enter.merge(popoverSelection);
48984       if (animate) {
48985         popoverSelection.classed("fade", true);
48986       }
48987       var display = _displayType.apply(this, arguments);
48988       if (display === "hover") {
48989         var _lastNonMouseEnterTime;
48990         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
48991           if (d3_event.pointerType) {
48992             if (d3_event.pointerType !== "mouse") {
48993               _lastNonMouseEnterTime = d3_event.timeStamp;
48994               return;
48995             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
48996               return;
48997             }
48998           }
48999           if (d3_event.buttons !== 0) return;
49000           show.apply(this, arguments);
49001         }).on(_pointerPrefix + "leave.popover", function() {
49002           hide.apply(this, arguments);
49003         }).on("focus.popover", function() {
49004           show.apply(this, arguments);
49005         }).on("blur.popover", function() {
49006           hide.apply(this, arguments);
49007         });
49008       } else if (display === "clickFocus") {
49009         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
49010           d3_event.preventDefault();
49011           d3_event.stopPropagation();
49012         }).on(_pointerPrefix + "up.popover", function(d3_event) {
49013           d3_event.preventDefault();
49014           d3_event.stopPropagation();
49015         }).on("click.popover", toggle);
49016         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
49017           anchor.each(function() {
49018             hide.apply(this, arguments);
49019           });
49020         });
49021       }
49022     }
49023     function show() {
49024       var anchor = select_default2(this);
49025       var popoverSelection = anchor.selectAll(".popover-" + _id);
49026       if (popoverSelection.empty()) {
49027         anchor.call(popover.destroy);
49028         anchor.each(setup);
49029         popoverSelection = anchor.selectAll(".popover-" + _id);
49030       }
49031       popoverSelection.classed("in", true);
49032       var displayType = _displayType.apply(this, arguments);
49033       if (displayType === "clickFocus") {
49034         anchor.classed("active", true);
49035         popoverSelection.node().focus();
49036       }
49037       anchor.each(updateContent);
49038     }
49039     function updateContent() {
49040       var anchor = select_default2(this);
49041       if (_content) {
49042         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
49043       }
49044       updatePosition.apply(this, arguments);
49045       updatePosition.apply(this, arguments);
49046       updatePosition.apply(this, arguments);
49047     }
49048     function updatePosition() {
49049       var anchor = select_default2(this);
49050       var popoverSelection = anchor.selectAll(".popover-" + _id);
49051       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
49052       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
49053       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
49054       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
49055       var placement = _placement.apply(this, arguments);
49056       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
49057       var alignment = _alignment.apply(this, arguments);
49058       var alignFactor = 0.5;
49059       if (alignment === "leading") {
49060         alignFactor = 0;
49061       } else if (alignment === "trailing") {
49062         alignFactor = 1;
49063       }
49064       var anchorFrame = getFrame(anchor.node());
49065       var popoverFrame = getFrame(popoverSelection.node());
49066       var position;
49067       switch (placement) {
49068         case "top":
49069           position = {
49070             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
49071             y: anchorFrame.y - popoverFrame.h
49072           };
49073           break;
49074         case "bottom":
49075           position = {
49076             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
49077             y: anchorFrame.y + anchorFrame.h
49078           };
49079           break;
49080         case "left":
49081           position = {
49082             x: anchorFrame.x - popoverFrame.w,
49083             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
49084           };
49085           break;
49086         case "right":
49087           position = {
49088             x: anchorFrame.x + anchorFrame.w,
49089             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
49090           };
49091           break;
49092       }
49093       if (position) {
49094         if (scrollNode && (placement === "top" || placement === "bottom")) {
49095           var initialPosX = position.x;
49096           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
49097             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
49098           } else if (position.x < 10) {
49099             position.x = 10;
49100           }
49101           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
49102           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
49103           arrow.style("left", ~~arrowPosX + "px");
49104         }
49105         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
49106       } else {
49107         popoverSelection.style("left", null).style("top", null);
49108       }
49109       function getFrame(node) {
49110         var positionStyle = select_default2(node).style("position");
49111         if (positionStyle === "absolute" || positionStyle === "static") {
49112           return {
49113             x: node.offsetLeft - scrollLeft,
49114             y: node.offsetTop - scrollTop,
49115             w: node.offsetWidth,
49116             h: node.offsetHeight
49117           };
49118         } else {
49119           return {
49120             x: 0,
49121             y: 0,
49122             w: node.offsetWidth,
49123             h: node.offsetHeight
49124           };
49125         }
49126       }
49127     }
49128     function hide() {
49129       var anchor = select_default2(this);
49130       if (_displayType.apply(this, arguments) === "clickFocus") {
49131         anchor.classed("active", false);
49132       }
49133       anchor.selectAll(".popover-" + _id).classed("in", false);
49134     }
49135     function toggle() {
49136       if (select_default2(this).select(".popover-" + _id).classed("in")) {
49137         hide.apply(this, arguments);
49138       } else {
49139         show.apply(this, arguments);
49140       }
49141     }
49142     return popover;
49143   }
49144   var _popoverID;
49145   var init_popover = __esm({
49146     "modules/ui/popover.js"() {
49147       "use strict";
49148       init_src5();
49149       init_util2();
49150       _popoverID = 0;
49151     }
49152   });
49153
49154   // modules/ui/tooltip.js
49155   var tooltip_exports = {};
49156   __export(tooltip_exports, {
49157     uiTooltip: () => uiTooltip
49158   });
49159   function uiTooltip(klass) {
49160     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
49161     var _title = function() {
49162       var title = this.getAttribute("data-original-title");
49163       if (title) {
49164         return title;
49165       } else {
49166         title = this.getAttribute("title");
49167         this.removeAttribute("title");
49168         this.setAttribute("data-original-title", title);
49169       }
49170       return title;
49171     };
49172     var _heading = utilFunctor(null);
49173     var _keys = utilFunctor(null);
49174     tooltip.title = function(val) {
49175       if (!arguments.length) return _title;
49176       _title = utilFunctor(val);
49177       return tooltip;
49178     };
49179     tooltip.heading = function(val) {
49180       if (!arguments.length) return _heading;
49181       _heading = utilFunctor(val);
49182       return tooltip;
49183     };
49184     tooltip.keys = function(val) {
49185       if (!arguments.length) return _keys;
49186       _keys = utilFunctor(val);
49187       return tooltip;
49188     };
49189     tooltip.content(function() {
49190       var heading2 = _heading.apply(this, arguments);
49191       var text = _title.apply(this, arguments);
49192       var keys2 = _keys.apply(this, arguments);
49193       var headingCallback = typeof heading2 === "function" ? heading2 : (s2) => s2.text(heading2);
49194       var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
49195       return function(selection2) {
49196         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading2 ? [heading2] : []);
49197         headingSelect.exit().remove();
49198         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
49199         var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
49200         textSelect.exit().remove();
49201         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
49202         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
49203         keyhintWrap.exit().remove();
49204         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
49205         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
49206         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
49207         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
49208           return d2;
49209         });
49210       };
49211     });
49212     return tooltip;
49213   }
49214   var init_tooltip = __esm({
49215     "modules/ui/tooltip.js"() {
49216       "use strict";
49217       init_util2();
49218       init_localizer();
49219       init_popover();
49220     }
49221   });
49222
49223   // modules/ui/combobox.js
49224   var combobox_exports = {};
49225   __export(combobox_exports, {
49226     uiCombobox: () => uiCombobox
49227   });
49228   function uiCombobox(context, klass) {
49229     var dispatch14 = dispatch_default("accept", "cancel", "update");
49230     var container = context.container();
49231     var _suggestions = [];
49232     var _data = [];
49233     var _fetched = {};
49234     var _selected = null;
49235     var _canAutocomplete = true;
49236     var _caseSensitive = false;
49237     var _cancelFetch = false;
49238     var _minItems = 2;
49239     var _tDown = 0;
49240     var _mouseEnterHandler, _mouseLeaveHandler;
49241     var _fetcher = function(val, cb) {
49242       cb(_data.filter(function(d2) {
49243         var terms = d2.terms || [];
49244         terms.push(d2.value);
49245         if (d2.key) {
49246           terms.push(d2.key);
49247         }
49248         return terms.some(function(term) {
49249           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
49250         });
49251       }));
49252     };
49253     var combobox = function(input, attachTo) {
49254       if (!input || input.empty()) return;
49255       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() {
49256         var parent = this.parentNode;
49257         var sibling = this.nextSibling;
49258         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
49259           return d2 === input.node();
49260         }).data([input.node()]).enter().insert("div", function() {
49261           return sibling;
49262         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
49263           d3_event.preventDefault();
49264           input.node().focus();
49265           mousedown(d3_event);
49266         }).on("mouseup.combo-caret", function(d3_event) {
49267           d3_event.preventDefault();
49268           mouseup(d3_event);
49269         });
49270       });
49271       function mousedown(d3_event) {
49272         if (d3_event.button !== 0) return;
49273         if (input.classed("disabled")) return;
49274         _tDown = +/* @__PURE__ */ new Date();
49275         var start2 = input.property("selectionStart");
49276         var end = input.property("selectionEnd");
49277         if (start2 !== end) {
49278           var val = utilGetSetValue(input);
49279           input.node().setSelectionRange(val.length, val.length);
49280           return;
49281         }
49282         input.on("mouseup.combo-input", mouseup);
49283       }
49284       function mouseup(d3_event) {
49285         input.on("mouseup.combo-input", null);
49286         if (d3_event.button !== 0) return;
49287         if (input.classed("disabled")) return;
49288         if (input.node() !== document.activeElement) return;
49289         var start2 = input.property("selectionStart");
49290         var end = input.property("selectionEnd");
49291         if (start2 !== end) return;
49292         var combo = container.selectAll(".combobox");
49293         if (combo.empty() || combo.datum() !== input.node()) {
49294           var tOrig = _tDown;
49295           window.setTimeout(function() {
49296             if (tOrig !== _tDown) return;
49297             fetchComboData("", function() {
49298               show();
49299               render();
49300             });
49301           }, 250);
49302         } else {
49303           hide();
49304         }
49305       }
49306       function focus() {
49307         fetchComboData("");
49308       }
49309       function blur() {
49310         _comboHideTimerID = window.setTimeout(hide, 75);
49311       }
49312       function show() {
49313         hide();
49314         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) {
49315           d3_event.preventDefault();
49316         });
49317         container.on("scroll.combo-scroll", render, true);
49318       }
49319       function hide() {
49320         _hide(container);
49321       }
49322       function keydown(d3_event) {
49323         var shown = !container.selectAll(".combobox").empty();
49324         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
49325         switch (d3_event.keyCode) {
49326           case 8:
49327           // ⌫ Backspace
49328           case 46:
49329             d3_event.stopPropagation();
49330             _selected = null;
49331             render();
49332             input.on("input.combo-input", function() {
49333               var start2 = input.property("selectionStart");
49334               input.node().setSelectionRange(start2, start2);
49335               input.on("input.combo-input", change);
49336               change(false);
49337             });
49338             break;
49339           case 9:
49340             accept(d3_event);
49341             break;
49342           case 13:
49343             d3_event.preventDefault();
49344             d3_event.stopPropagation();
49345             accept(d3_event);
49346             break;
49347           case 38:
49348             if (tagName === "textarea" && !shown) return;
49349             d3_event.preventDefault();
49350             if (tagName === "input" && !shown) {
49351               show();
49352             }
49353             nav(-1);
49354             break;
49355           case 40:
49356             if (tagName === "textarea" && !shown) return;
49357             d3_event.preventDefault();
49358             if (tagName === "input" && !shown) {
49359               show();
49360             }
49361             nav(1);
49362             break;
49363         }
49364       }
49365       function keyup(d3_event) {
49366         switch (d3_event.keyCode) {
49367           case 27:
49368             cancel();
49369             break;
49370         }
49371       }
49372       function change(doAutoComplete) {
49373         if (doAutoComplete === void 0) doAutoComplete = true;
49374         fetchComboData(value(), function(skipAutosuggest) {
49375           _selected = null;
49376           var val = input.property("value");
49377           if (_suggestions.length) {
49378             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
49379               _selected = tryAutocomplete();
49380             }
49381             if (!_selected) {
49382               _selected = val;
49383             }
49384           }
49385           if (val.length) {
49386             var combo = container.selectAll(".combobox");
49387             if (combo.empty()) {
49388               show();
49389             }
49390           } else {
49391             hide();
49392           }
49393           render();
49394         });
49395       }
49396       function nav(dir) {
49397         if (_suggestions.length) {
49398           var index = -1;
49399           for (var i3 = 0; i3 < _suggestions.length; i3++) {
49400             if (_selected && _suggestions[i3].value === _selected) {
49401               index = i3;
49402               break;
49403             }
49404           }
49405           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
49406           _selected = _suggestions[index].value;
49407           utilGetSetValue(input, _selected);
49408           dispatch14.call("update");
49409         }
49410         render();
49411         ensureVisible();
49412       }
49413       function ensureVisible() {
49414         var _a3;
49415         var combo = container.selectAll(".combobox");
49416         if (combo.empty()) return;
49417         var containerRect = container.node().getBoundingClientRect();
49418         var comboRect = combo.node().getBoundingClientRect();
49419         if (comboRect.bottom > containerRect.bottom) {
49420           var node = attachTo ? attachTo.node() : input.node();
49421           node.scrollIntoView({ behavior: "instant", block: "center" });
49422           render();
49423         }
49424         var selected = combo.selectAll(".combobox-option.selected").node();
49425         if (selected) {
49426           (_a3 = selected.scrollIntoView) == null ? void 0 : _a3.call(selected, { behavior: "smooth", block: "nearest" });
49427         }
49428       }
49429       function value() {
49430         var value2 = input.property("value");
49431         var start2 = input.property("selectionStart");
49432         var end = input.property("selectionEnd");
49433         if (start2 && end) {
49434           value2 = value2.substring(0, start2);
49435         }
49436         return value2;
49437       }
49438       function fetchComboData(v2, cb) {
49439         _cancelFetch = false;
49440         _fetcher.call(input, v2, function(results, skipAutosuggest) {
49441           if (_cancelFetch) return;
49442           _suggestions = results;
49443           results.forEach(function(d2) {
49444             _fetched[d2.value] = d2;
49445           });
49446           if (cb) {
49447             cb(skipAutosuggest);
49448           }
49449         });
49450       }
49451       function tryAutocomplete() {
49452         if (!_canAutocomplete) return;
49453         var val = _caseSensitive ? value() : value().toLowerCase();
49454         if (!val) return;
49455         if (isFinite(val)) return;
49456         const suggestionValues = [];
49457         _suggestions.forEach((s2) => {
49458           suggestionValues.push(s2.value);
49459           if (s2.key && s2.key !== s2.value) {
49460             suggestionValues.push(s2.key);
49461           }
49462         });
49463         var bestIndex = -1;
49464         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
49465           var suggestion = suggestionValues[i3];
49466           var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
49467           if (compare2 === val) {
49468             bestIndex = i3;
49469             break;
49470           } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
49471             bestIndex = i3;
49472           }
49473         }
49474         if (bestIndex !== -1) {
49475           var bestVal = suggestionValues[bestIndex];
49476           input.property("value", bestVal);
49477           input.node().setSelectionRange(val.length, bestVal.length);
49478           dispatch14.call("update");
49479           return bestVal;
49480         }
49481       }
49482       function render() {
49483         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
49484           hide();
49485           return;
49486         }
49487         var shown = !container.selectAll(".combobox").empty();
49488         if (!shown) return;
49489         var combo = container.selectAll(".combobox");
49490         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
49491           return d2.value;
49492         });
49493         options2.exit().remove();
49494         options2.enter().append("a").attr("class", function(d2) {
49495           return "combobox-option " + (d2.klass || "");
49496         }).attr("title", function(d2) {
49497           return d2.title;
49498         }).each(function(d2) {
49499           if (d2.display) {
49500             d2.display(select_default2(this));
49501           } else {
49502             select_default2(this).text(d2.value);
49503           }
49504         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
49505           return d2.value === _selected || d2.key === _selected;
49506         }).on("click.combo-option", accept).order();
49507         var node = attachTo ? attachTo.node() : input.node();
49508         var containerRect = container.node().getBoundingClientRect();
49509         var rect = node.getBoundingClientRect();
49510         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
49511       }
49512       function accept(d3_event, d2) {
49513         _cancelFetch = true;
49514         var thiz = input.node();
49515         if (d2) {
49516           utilGetSetValue(input, d2.value);
49517           utilTriggerEvent(input, "change");
49518         }
49519         var val = utilGetSetValue(input);
49520         thiz.setSelectionRange(val.length, val.length);
49521         if (!d2) {
49522           d2 = _fetched[val];
49523         }
49524         dispatch14.call("accept", thiz, d2, val);
49525         hide();
49526       }
49527       function cancel() {
49528         _cancelFetch = true;
49529         var thiz = input.node();
49530         var val = utilGetSetValue(input);
49531         var start2 = input.property("selectionStart");
49532         var end = input.property("selectionEnd");
49533         val = val.slice(0, start2) + val.slice(end);
49534         utilGetSetValue(input, val);
49535         thiz.setSelectionRange(val.length, val.length);
49536         dispatch14.call("cancel", thiz);
49537         hide();
49538       }
49539     };
49540     combobox.canAutocomplete = function(val) {
49541       if (!arguments.length) return _canAutocomplete;
49542       _canAutocomplete = val;
49543       return combobox;
49544     };
49545     combobox.caseSensitive = function(val) {
49546       if (!arguments.length) return _caseSensitive;
49547       _caseSensitive = val;
49548       return combobox;
49549     };
49550     combobox.data = function(val) {
49551       if (!arguments.length) return _data;
49552       _data = val;
49553       return combobox;
49554     };
49555     combobox.fetcher = function(val) {
49556       if (!arguments.length) return _fetcher;
49557       _fetcher = val;
49558       return combobox;
49559     };
49560     combobox.minItems = function(val) {
49561       if (!arguments.length) return _minItems;
49562       _minItems = val;
49563       return combobox;
49564     };
49565     combobox.itemsMouseEnter = function(val) {
49566       if (!arguments.length) return _mouseEnterHandler;
49567       _mouseEnterHandler = val;
49568       return combobox;
49569     };
49570     combobox.itemsMouseLeave = function(val) {
49571       if (!arguments.length) return _mouseLeaveHandler;
49572       _mouseLeaveHandler = val;
49573       return combobox;
49574     };
49575     return utilRebind(combobox, dispatch14, "on");
49576   }
49577   function _hide(container) {
49578     if (_comboHideTimerID) {
49579       window.clearTimeout(_comboHideTimerID);
49580       _comboHideTimerID = void 0;
49581     }
49582     container.selectAll(".combobox").remove();
49583     container.on("scroll.combo-scroll", null);
49584   }
49585   var _comboHideTimerID;
49586   var init_combobox = __esm({
49587     "modules/ui/combobox.js"() {
49588       "use strict";
49589       init_src4();
49590       init_src5();
49591       init_util();
49592       uiCombobox.off = function(input, context) {
49593         _hide(context.container());
49594         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);
49595         context.container().on("scroll.combo-scroll", null);
49596       };
49597     }
49598   });
49599
49600   // modules/ui/intro/helper.js
49601   var helper_exports = {};
49602   __export(helper_exports, {
49603     helpHtml: () => helpHtml,
49604     icon: () => icon,
49605     isMostlySquare: () => isMostlySquare,
49606     localize: () => localize,
49607     missingStrings: () => missingStrings,
49608     pad: () => pad2,
49609     pointBox: () => pointBox,
49610     selectMenuItem: () => selectMenuItem,
49611     transitionTime: () => transitionTime
49612   });
49613   function pointBox(loc, context) {
49614     var rect = context.surfaceRect();
49615     var point = context.curtainProjection(loc);
49616     return {
49617       left: point[0] + rect.left - 40,
49618       top: point[1] + rect.top - 60,
49619       width: 80,
49620       height: 90
49621     };
49622   }
49623   function pad2(locOrBox, padding, context) {
49624     var box;
49625     if (locOrBox instanceof Array) {
49626       var rect = context.surfaceRect();
49627       var point = context.curtainProjection(locOrBox);
49628       box = {
49629         left: point[0] + rect.left,
49630         top: point[1] + rect.top
49631       };
49632     } else {
49633       box = locOrBox;
49634     }
49635     return {
49636       left: box.left - padding,
49637       top: box.top - padding,
49638       width: (box.width || 0) + 2 * padding,
49639       height: (box.width || 0) + 2 * padding
49640     };
49641   }
49642   function icon(name, svgklass, useklass) {
49643     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
49644   }
49645   function helpHtml(id2, replacements) {
49646     if (!helpStringReplacements) {
49647       helpStringReplacements = {
49648         // insert icons corresponding to various UI elements
49649         point_icon: icon("#iD-icon-point", "inline"),
49650         line_icon: icon("#iD-icon-line", "inline"),
49651         area_icon: icon("#iD-icon-area", "inline"),
49652         note_icon: icon("#iD-icon-note", "inline add-note"),
49653         plus: icon("#iD-icon-plus", "inline"),
49654         minus: icon("#iD-icon-minus", "inline"),
49655         layers_icon: icon("#iD-icon-layers", "inline"),
49656         data_icon: icon("#iD-icon-data", "inline"),
49657         inspect: icon("#iD-icon-inspect", "inline"),
49658         help_icon: icon("#iD-icon-help", "inline"),
49659         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
49660         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
49661         save_icon: icon("#iD-icon-save", "inline"),
49662         // operation icons
49663         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
49664         continue_icon: icon("#iD-operation-continue", "inline operation"),
49665         copy_icon: icon("#iD-operation-copy", "inline operation"),
49666         delete_icon: icon("#iD-operation-delete", "inline operation"),
49667         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
49668         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
49669         extract_icon: icon("#iD-operation-extract", "inline operation"),
49670         merge_icon: icon("#iD-operation-merge", "inline operation"),
49671         move_icon: icon("#iD-operation-move", "inline operation"),
49672         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
49673         paste_icon: icon("#iD-operation-paste", "inline operation"),
49674         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
49675         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
49676         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
49677         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
49678         split_icon: icon("#iD-operation-split", "inline operation"),
49679         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
49680         // interaction icons
49681         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
49682         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
49683         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
49684         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
49685         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
49686         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
49687         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
49688         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
49689         // insert keys; may be localized and platform-dependent
49690         shift: uiCmd.display("\u21E7"),
49691         alt: uiCmd.display("\u2325"),
49692         return: uiCmd.display("\u21B5"),
49693         esc: _t.html("shortcuts.key.esc"),
49694         space: _t.html("shortcuts.key.space"),
49695         add_note_key: _t.html("modes.add_note.key"),
49696         help_key: _t.html("help.key"),
49697         shortcuts_key: _t.html("shortcuts.toggle.key"),
49698         // reference localized UI labels directly so that they'll always match
49699         save: _t.html("save.title"),
49700         undo: _t.html("undo.title"),
49701         redo: _t.html("redo.title"),
49702         upload: _t.html("commit.save"),
49703         point: _t.html("modes.add_point.title"),
49704         line: _t.html("modes.add_line.title"),
49705         area: _t.html("modes.add_area.title"),
49706         note: _t.html("modes.add_note.label"),
49707         circularize: _t.html("operations.circularize.title"),
49708         continue: _t.html("operations.continue.title"),
49709         copy: _t.html("operations.copy.title"),
49710         delete: _t.html("operations.delete.title"),
49711         disconnect: _t.html("operations.disconnect.title"),
49712         downgrade: _t.html("operations.downgrade.title"),
49713         extract: _t.html("operations.extract.title"),
49714         merge: _t.html("operations.merge.title"),
49715         move: _t.html("operations.move.title"),
49716         orthogonalize: _t.html("operations.orthogonalize.title"),
49717         paste: _t.html("operations.paste.title"),
49718         reflect_long: _t.html("operations.reflect.title.long"),
49719         reflect_short: _t.html("operations.reflect.title.short"),
49720         reverse: _t.html("operations.reverse.title"),
49721         rotate: _t.html("operations.rotate.title"),
49722         split: _t.html("operations.split.title"),
49723         straighten: _t.html("operations.straighten.title"),
49724         map_data: _t.html("map_data.title"),
49725         osm_notes: _t.html("map_data.layers.notes.title"),
49726         fields: _t.html("inspector.fields"),
49727         tags: _t.html("inspector.tags"),
49728         relations: _t.html("inspector.relations"),
49729         new_relation: _t.html("inspector.new_relation"),
49730         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
49731         background_settings: _t.html("background.description"),
49732         imagery_offset: _t.html("background.fix_misalignment"),
49733         start_the_walkthrough: _t.html("splash.walkthrough"),
49734         help: _t.html("help.title"),
49735         ok: _t.html("intro.ok")
49736       };
49737       for (var key in helpStringReplacements) {
49738         helpStringReplacements[key] = { html: helpStringReplacements[key] };
49739       }
49740     }
49741     var reps;
49742     if (replacements) {
49743       reps = Object.assign(replacements, helpStringReplacements);
49744     } else {
49745       reps = helpStringReplacements;
49746     }
49747     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
49748   }
49749   function slugify(text) {
49750     return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
49751   }
49752   function checkKey(key, text) {
49753     if (_t(key, { default: void 0 }) === void 0) {
49754       if (missingStrings.hasOwnProperty(key)) return;
49755       missingStrings[key] = text;
49756       var missing = key + ": " + text;
49757       if (typeof console !== "undefined") console.log(missing);
49758     }
49759   }
49760   function localize(obj) {
49761     var key;
49762     var name = obj.tags && obj.tags.name;
49763     if (name) {
49764       key = "intro.graph.name." + slugify(name);
49765       obj.tags.name = _t(key, { default: name });
49766       checkKey(key, name);
49767     }
49768     var street = obj.tags && obj.tags["addr:street"];
49769     if (street) {
49770       key = "intro.graph.name." + slugify(street);
49771       obj.tags["addr:street"] = _t(key, { default: street });
49772       checkKey(key, street);
49773       var addrTags = [
49774         "block_number",
49775         "city",
49776         "county",
49777         "district",
49778         "hamlet",
49779         "neighbourhood",
49780         "postcode",
49781         "province",
49782         "quarter",
49783         "state",
49784         "subdistrict",
49785         "suburb"
49786       ];
49787       addrTags.forEach(function(k2) {
49788         var key2 = "intro.graph." + k2;
49789         var tag2 = "addr:" + k2;
49790         var val = obj.tags && obj.tags[tag2];
49791         var str = _t(key2, { default: val });
49792         if (str) {
49793           if (str.match(/^<.*>$/) !== null) {
49794             delete obj.tags[tag2];
49795           } else {
49796             obj.tags[tag2] = str;
49797           }
49798         }
49799       });
49800     }
49801     return obj;
49802   }
49803   function isMostlySquare(points) {
49804     var threshold = 15;
49805     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
49806     var upperBound = Math.cos(threshold * Math.PI / 180);
49807     for (var i3 = 0; i3 < points.length; i3++) {
49808       var a2 = points[(i3 - 1 + points.length) % points.length];
49809       var origin = points[i3];
49810       var b2 = points[(i3 + 1) % points.length];
49811       var dotp = geoVecNormalizedDot(a2, b2, origin);
49812       var mag = Math.abs(dotp);
49813       if (mag > lowerBound && mag < upperBound) {
49814         return false;
49815       }
49816     }
49817     return true;
49818   }
49819   function selectMenuItem(context, operation2) {
49820     return context.container().select(".edit-menu .edit-menu-item-" + operation2);
49821   }
49822   function transitionTime(point1, point2) {
49823     var distance = geoSphericalDistance(point1, point2);
49824     if (distance === 0) {
49825       return 0;
49826     } else if (distance < 80) {
49827       return 500;
49828     } else {
49829       return 1e3;
49830     }
49831   }
49832   var helpStringReplacements, missingStrings;
49833   var init_helper = __esm({
49834     "modules/ui/intro/helper.js"() {
49835       "use strict";
49836       init_localizer();
49837       init_geo2();
49838       init_cmd();
49839       missingStrings = {};
49840     }
49841   });
49842
49843   // modules/ui/field_help.js
49844   var field_help_exports = {};
49845   __export(field_help_exports, {
49846     uiFieldHelp: () => uiFieldHelp
49847   });
49848   function uiFieldHelp(context, fieldName) {
49849     var fieldHelp = {};
49850     var _inspector = select_default2(null);
49851     var _wrap = select_default2(null);
49852     var _body = select_default2(null);
49853     var fieldHelpKeys = {
49854       restrictions: [
49855         ["about", [
49856           "about",
49857           "from_via_to",
49858           "maxdist",
49859           "maxvia"
49860         ]],
49861         ["inspecting", [
49862           "about",
49863           "from_shadow",
49864           "allow_shadow",
49865           "restrict_shadow",
49866           "only_shadow",
49867           "restricted",
49868           "only"
49869         ]],
49870         ["modifying", [
49871           "about",
49872           "indicators",
49873           "allow_turn",
49874           "restrict_turn",
49875           "only_turn"
49876         ]],
49877         ["tips", [
49878           "simple",
49879           "simple_example",
49880           "indirect",
49881           "indirect_example",
49882           "indirect_noedit"
49883         ]]
49884       ]
49885     };
49886     var fieldHelpHeadings = {};
49887     var replacements = {
49888       distField: { html: _t.html("restriction.controls.distance") },
49889       viaField: { html: _t.html("restriction.controls.via") },
49890       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
49891       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
49892       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
49893       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
49894       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
49895       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
49896       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
49897     };
49898     var docs = fieldHelpKeys[fieldName].map(function(key) {
49899       var helpkey = "help.field." + fieldName + "." + key[0];
49900       var text = key[1].reduce(function(all, part) {
49901         var subkey = helpkey + "." + part;
49902         var depth = fieldHelpHeadings[subkey];
49903         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
49904         return all + hhh + _t.html(subkey, replacements) + "\n\n";
49905       }, "");
49906       return {
49907         key: helpkey,
49908         title: _t.html(helpkey + ".title"),
49909         html: marked(text.trim())
49910       };
49911     });
49912     function show() {
49913       updatePosition();
49914       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
49915     }
49916     function hide() {
49917       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
49918         _body.classed("hide", true);
49919       });
49920     }
49921     function clickHelp(index) {
49922       var d2 = docs[index];
49923       var tkeys = fieldHelpKeys[fieldName][index][1];
49924       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
49925         return i3 === index;
49926       });
49927       var content = _body.selectAll(".field-help-content").html(d2.html);
49928       content.selectAll("p").attr("class", function(d4, i3) {
49929         return tkeys[i3];
49930       });
49931       if (d2.key === "help.field.restrictions.inspecting") {
49932         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
49933       } else if (d2.key === "help.field.restrictions.modifying") {
49934         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
49935       }
49936     }
49937     fieldHelp.button = function(selection2) {
49938       if (_body.empty()) return;
49939       var button = selection2.selectAll(".field-help-button").data([0]);
49940       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
49941         d3_event.stopPropagation();
49942         d3_event.preventDefault();
49943         if (_body.classed("hide")) {
49944           show();
49945         } else {
49946           hide();
49947         }
49948       });
49949     };
49950     function updatePosition() {
49951       var wrap2 = _wrap.node();
49952       var inspector = _inspector.node();
49953       var wRect = wrap2.getBoundingClientRect();
49954       var iRect = inspector.getBoundingClientRect();
49955       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
49956     }
49957     fieldHelp.body = function(selection2) {
49958       _wrap = selection2.selectAll(".form-field-input-wrap");
49959       if (_wrap.empty()) return;
49960       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
49961       if (_inspector.empty()) return;
49962       _body = _inspector.selectAll(".field-help-body").data([0]);
49963       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
49964       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
49965       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
49966       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
49967         d3_event.stopPropagation();
49968         d3_event.preventDefault();
49969         hide();
49970       }).call(svgIcon("#iD-icon-close"));
49971       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
49972       var titles = docs.map(function(d2) {
49973         return d2.title;
49974       });
49975       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
49976         return d2;
49977       }).on("click", function(d3_event, d2) {
49978         d3_event.stopPropagation();
49979         d3_event.preventDefault();
49980         clickHelp(titles.indexOf(d2));
49981       });
49982       enter.append("div").attr("class", "field-help-content");
49983       _body = _body.merge(enter);
49984       clickHelp(0);
49985     };
49986     return fieldHelp;
49987   }
49988   var init_field_help = __esm({
49989     "modules/ui/field_help.js"() {
49990       "use strict";
49991       init_src5();
49992       init_marked_esm();
49993       init_localizer();
49994       init_icon();
49995       init_helper();
49996     }
49997   });
49998
49999   // modules/ui/fields/check.js
50000   var check_exports = {};
50001   __export(check_exports, {
50002     uiFieldCheck: () => uiFieldCheck,
50003     uiFieldDefaultCheck: () => uiFieldCheck,
50004     uiFieldOnewayCheck: () => uiFieldCheck
50005   });
50006   function uiFieldCheck(field, context) {
50007     var dispatch14 = dispatch_default("change");
50008     var options2 = field.options;
50009     var values = [];
50010     var texts = [];
50011     var _tags;
50012     var input = select_default2(null);
50013     var text = select_default2(null);
50014     var label = select_default2(null);
50015     var reverser = select_default2(null);
50016     var _impliedYes;
50017     var _entityIDs = [];
50018     var _value;
50019     var stringsField = field.resolveReference("stringsCrossReference");
50020     if (!options2 && stringsField.options) {
50021       options2 = stringsField.options;
50022     }
50023     if (options2) {
50024       for (var i3 in options2) {
50025         var v2 = options2[i3];
50026         values.push(v2 === "undefined" ? void 0 : v2);
50027         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
50028       }
50029     } else {
50030       values = [void 0, "yes"];
50031       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
50032       if (field.type !== "defaultCheck") {
50033         values.push("no");
50034         texts.push(_t.html("inspector.check.no"));
50035       }
50036     }
50037     function checkImpliedYes() {
50038       _impliedYes = field.id === "oneway_yes";
50039       if (field.id === "oneway") {
50040         var entity = context.entity(_entityIDs[0]);
50041         if (entity.type === "way" && entity.isOneWay()) {
50042           _impliedYes = true;
50043           texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
50044         }
50045       }
50046     }
50047     function reverserHidden() {
50048       if (!context.container().select("div.inspector-hover").empty()) return true;
50049       return !(_value === "yes" || _impliedYes && !_value);
50050     }
50051     function reverserSetText(selection2) {
50052       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
50053       if (reverserHidden() || !entity) return selection2;
50054       var first = entity.first();
50055       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
50056       var pseudoDirection = first < last;
50057       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
50058       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
50059       return selection2;
50060     }
50061     var check = function(selection2) {
50062       checkImpliedYes();
50063       label = selection2.selectAll(".form-field-input-wrap").data([0]);
50064       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
50065       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
50066       enter.append("span").html(texts[0]).attr("class", "value");
50067       if (field.type === "onewayCheck") {
50068         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
50069       }
50070       label = label.merge(enter);
50071       input = label.selectAll("input");
50072       text = label.selectAll("span.value");
50073       input.on("click", function(d3_event) {
50074         d3_event.stopPropagation();
50075         var t2 = {};
50076         if (Array.isArray(_tags[field.key])) {
50077           if (values.indexOf("yes") !== -1) {
50078             t2[field.key] = "yes";
50079           } else {
50080             t2[field.key] = values[0];
50081           }
50082         } else {
50083           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
50084         }
50085         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
50086           t2[field.key] = values[0];
50087         }
50088         dispatch14.call("change", this, t2);
50089       });
50090       if (field.type === "onewayCheck") {
50091         reverser = label.selectAll(".reverser");
50092         reverser.call(reverserSetText).on("click", function(d3_event) {
50093           d3_event.preventDefault();
50094           d3_event.stopPropagation();
50095           context.perform(
50096             function(graph) {
50097               for (var i4 in _entityIDs) {
50098                 graph = actionReverse(_entityIDs[i4])(graph);
50099               }
50100               return graph;
50101             },
50102             _t("operations.reverse.annotation.line", { n: 1 })
50103           );
50104           context.validator().validate();
50105           select_default2(this).call(reverserSetText);
50106         });
50107       }
50108     };
50109     check.entityIDs = function(val) {
50110       if (!arguments.length) return _entityIDs;
50111       _entityIDs = val;
50112       return check;
50113     };
50114     check.tags = function(tags) {
50115       _tags = tags;
50116       function isChecked(val) {
50117         return val !== "no" && val !== "" && val !== void 0 && val !== null;
50118       }
50119       function textFor(val) {
50120         if (val === "") val = void 0;
50121         var index = values.indexOf(val);
50122         return index !== -1 ? texts[index] : '"' + val + '"';
50123       }
50124       checkImpliedYes();
50125       var isMixed = Array.isArray(tags[field.key]);
50126       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
50127       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
50128         _value = "yes";
50129       }
50130       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
50131       text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
50132       label.classed("set", !!_value);
50133       if (field.type === "onewayCheck") {
50134         reverser.classed("hide", reverserHidden()).call(reverserSetText);
50135       }
50136     };
50137     check.focus = function() {
50138       input.node().focus();
50139     };
50140     return utilRebind(check, dispatch14, "on");
50141   }
50142   var init_check = __esm({
50143     "modules/ui/fields/check.js"() {
50144       "use strict";
50145       init_src4();
50146       init_src5();
50147       init_rebind();
50148       init_localizer();
50149       init_reverse();
50150       init_icon();
50151     }
50152   });
50153
50154   // modules/svg/helpers.js
50155   var helpers_exports = {};
50156   __export(helpers_exports, {
50157     svgMarkerSegments: () => svgMarkerSegments,
50158     svgPassiveVertex: () => svgPassiveVertex,
50159     svgPath: () => svgPath,
50160     svgPointTransform: () => svgPointTransform,
50161     svgRelationMemberTags: () => svgRelationMemberTags,
50162     svgSegmentWay: () => svgSegmentWay
50163   });
50164   function svgPassiveVertex(node, graph, activeID) {
50165     if (!activeID) return 1;
50166     if (activeID === node.id) return 0;
50167     var parents = graph.parentWays(node);
50168     var i3, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
50169     for (i3 = 0; i3 < parents.length; i3++) {
50170       nodes = parents[i3].nodes;
50171       isClosed = parents[i3].isClosed();
50172       for (j2 = 0; j2 < nodes.length; j2++) {
50173         if (nodes[j2] === node.id) {
50174           ix1 = j2 - 2;
50175           ix2 = j2 - 1;
50176           ix3 = j2 + 1;
50177           ix4 = j2 + 2;
50178           if (isClosed) {
50179             max3 = nodes.length - 1;
50180             if (ix1 < 0) ix1 = max3 + ix1;
50181             if (ix2 < 0) ix2 = max3 + ix2;
50182             if (ix3 > max3) ix3 = ix3 - max3;
50183             if (ix4 > max3) ix4 = ix4 - max3;
50184           }
50185           if (nodes[ix1] === activeID) return 0;
50186           else if (nodes[ix2] === activeID) return 2;
50187           else if (nodes[ix3] === activeID) return 2;
50188           else if (nodes[ix4] === activeID) return 0;
50189           else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
50190         }
50191       }
50192     }
50193     return 1;
50194   }
50195   function svgMarkerSegments(projection2, graph, dt2, shouldReverse = () => false, bothDirections = () => false) {
50196     return function(entity) {
50197       let i3 = 0;
50198       let offset = dt2 / 2;
50199       const segments = [];
50200       const clip = paddedClipExtent(projection2);
50201       const coordinates = graph.childNodes(entity).map(function(n3) {
50202         return n3.loc;
50203       });
50204       let a2, b2;
50205       const _shouldReverse = shouldReverse(entity);
50206       const _bothDirections = bothDirections(entity);
50207       stream_default({
50208         type: "LineString",
50209         coordinates
50210       }, projection2.stream(clip({
50211         lineStart: function() {
50212         },
50213         lineEnd: function() {
50214           a2 = null;
50215         },
50216         point: function(x2, y2) {
50217           b2 = [x2, y2];
50218           if (a2) {
50219             let span = geoVecLength(a2, b2) - offset;
50220             if (span >= 0) {
50221               const heading2 = geoVecAngle(a2, b2);
50222               const dx = dt2 * Math.cos(heading2);
50223               const dy = dt2 * Math.sin(heading2);
50224               let p2 = [
50225                 a2[0] + offset * Math.cos(heading2),
50226                 a2[1] + offset * Math.sin(heading2)
50227               ];
50228               const coord2 = [a2, p2];
50229               for (span -= dt2; span >= 0; span -= dt2) {
50230                 p2 = geoVecAdd(p2, [dx, dy]);
50231                 coord2.push(p2);
50232               }
50233               coord2.push(b2);
50234               let segment = "";
50235               if (!_shouldReverse || _bothDirections) {
50236                 for (let j2 = 0; j2 < coord2.length; j2++) {
50237                   segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
50238                 }
50239                 segments.push({ id: entity.id, index: i3++, d: segment });
50240               }
50241               if (_shouldReverse || _bothDirections) {
50242                 segment = "";
50243                 for (let j2 = coord2.length - 1; j2 >= 0; j2--) {
50244                   segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
50245                 }
50246                 segments.push({ id: entity.id, index: i3++, d: segment });
50247               }
50248             }
50249             offset = -span;
50250           }
50251           a2 = b2;
50252         }
50253       })));
50254       return segments;
50255     };
50256   }
50257   function svgPath(projection2, graph, isArea) {
50258     const cache = {};
50259     const project = projection2.stream;
50260     const clip = paddedClipExtent(projection2, isArea);
50261     const path = path_default().projection({ stream: function(output) {
50262       return project(clip(output));
50263     } });
50264     const svgpath = function(entity) {
50265       if (entity.id in cache) {
50266         return cache[entity.id];
50267       } else {
50268         return cache[entity.id] = path(entity.asGeoJSON(graph));
50269       }
50270     };
50271     svgpath.geojson = function(d2) {
50272       if (d2.__featurehash__ !== void 0) {
50273         if (d2.__featurehash__ in cache) {
50274           return cache[d2.__featurehash__];
50275         } else {
50276           return cache[d2.__featurehash__] = path(d2);
50277         }
50278       } else {
50279         return path(d2);
50280       }
50281     };
50282     return svgpath;
50283   }
50284   function svgPointTransform(projection2) {
50285     var svgpoint = function(entity) {
50286       var pt2 = projection2(entity.loc);
50287       return "translate(" + pt2[0] + "," + pt2[1] + ")";
50288     };
50289     svgpoint.geojson = function(d2) {
50290       return svgpoint(d2.properties.entity);
50291     };
50292     return svgpoint;
50293   }
50294   function svgRelationMemberTags(graph) {
50295     return function(entity) {
50296       var tags = entity.tags;
50297       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
50298       graph.parentRelations(entity).forEach(function(relation) {
50299         var type2 = relation.tags.type;
50300         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
50301           tags = Object.assign({}, relation.tags, tags);
50302         }
50303       });
50304       return tags;
50305     };
50306   }
50307   function svgSegmentWay(way, graph, activeID) {
50308     if (activeID === void 0) {
50309       return graph.transient(way, "waySegments", getWaySegments);
50310     } else {
50311       return getWaySegments();
50312     }
50313     function getWaySegments() {
50314       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
50315       var features = { passive: [], active: [] };
50316       var start2 = {};
50317       var end = {};
50318       var node, type2;
50319       for (var i3 = 0; i3 < way.nodes.length; i3++) {
50320         node = graph.entity(way.nodes[i3]);
50321         type2 = svgPassiveVertex(node, graph, activeID);
50322         end = { node, type: type2 };
50323         if (start2.type !== void 0) {
50324           if (start2.node.id === activeID || end.node.id === activeID) {
50325           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
50326             pushActive(start2, end, i3);
50327           } else if (start2.type === 0 && end.type === 0) {
50328             pushActive(start2, end, i3);
50329           } else {
50330             pushPassive(start2, end, i3);
50331           }
50332         }
50333         start2 = end;
50334       }
50335       return features;
50336       function pushActive(start3, end2, index) {
50337         features.active.push({
50338           type: "Feature",
50339           id: way.id + "-" + index + "-nope",
50340           properties: {
50341             nope: true,
50342             target: true,
50343             entity: way,
50344             nodes: [start3.node, end2.node],
50345             index
50346           },
50347           geometry: {
50348             type: "LineString",
50349             coordinates: [start3.node.loc, end2.node.loc]
50350           }
50351         });
50352       }
50353       function pushPassive(start3, end2, index) {
50354         features.passive.push({
50355           type: "Feature",
50356           id: way.id + "-" + index,
50357           properties: {
50358             target: true,
50359             entity: way,
50360             nodes: [start3.node, end2.node],
50361             index
50362           },
50363           geometry: {
50364             type: "LineString",
50365             coordinates: [start3.node.loc, end2.node.loc]
50366           }
50367         });
50368       }
50369     }
50370   }
50371   function paddedClipExtent(projection2, isArea = false) {
50372     var padding = isArea ? 65 : 5;
50373     var viewport = projection2.clipExtent();
50374     var paddedExtent = [
50375       [viewport[0][0] - padding, viewport[0][1] - padding],
50376       [viewport[1][0] + padding, viewport[1][1] + padding]
50377     ];
50378     return identity_default2().clipExtent(paddedExtent).stream;
50379   }
50380   var init_helpers = __esm({
50381     "modules/svg/helpers.js"() {
50382       "use strict";
50383       init_src2();
50384       init_geo2();
50385     }
50386   });
50387
50388   // modules/svg/tag_classes.js
50389   var tag_classes_exports = {};
50390   __export(tag_classes_exports, {
50391     svgTagClasses: () => svgTagClasses
50392   });
50393   function svgTagClasses() {
50394     var primaries = [
50395       "building",
50396       "highway",
50397       "railway",
50398       "waterway",
50399       "aeroway",
50400       "aerialway",
50401       "piste:type",
50402       "boundary",
50403       "power",
50404       "amenity",
50405       "natural",
50406       "landuse",
50407       "leisure",
50408       "military",
50409       "place",
50410       "man_made",
50411       "route",
50412       "attraction",
50413       "roller_coaster",
50414       "building:part",
50415       "indoor"
50416     ];
50417     var statuses = Object.keys(osmLifecyclePrefixes);
50418     var secondaries = [
50419       "oneway",
50420       "bridge",
50421       "tunnel",
50422       "embankment",
50423       "cutting",
50424       "barrier",
50425       "surface",
50426       "tracktype",
50427       "footway",
50428       "crossing",
50429       "service",
50430       "sport",
50431       "public_transport",
50432       "location",
50433       "parking",
50434       "golf",
50435       "type",
50436       "leisure",
50437       "man_made",
50438       "indoor",
50439       "construction",
50440       "proposed"
50441     ];
50442     var _tags = function(entity) {
50443       return entity.tags;
50444     };
50445     var tagClasses = function(selection2) {
50446       selection2.each(function tagClassesEach(entity) {
50447         var value = this.className;
50448         if (value.baseVal !== void 0) {
50449           value = value.baseVal;
50450         }
50451         var t2 = _tags(entity);
50452         var computed = tagClasses.getClassesString(t2, value);
50453         if (computed !== value) {
50454           select_default2(this).attr("class", computed);
50455         }
50456       });
50457     };
50458     tagClasses.getClassesString = function(t2, value) {
50459       var primary, status;
50460       var i3, j2, k2, v2;
50461       var overrideGeometry;
50462       if (/\bstroke\b/.test(value)) {
50463         if (!!t2.barrier && t2.barrier !== "no") {
50464           overrideGeometry = "line";
50465         }
50466       }
50467       var classes = value.trim().split(/\s+/).filter(function(klass) {
50468         return klass.length && !/^tag-/.test(klass);
50469       }).map(function(klass) {
50470         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
50471       });
50472       for (i3 = 0; i3 < primaries.length; i3++) {
50473         k2 = primaries[i3];
50474         v2 = t2[k2];
50475         if (!v2 || v2 === "no") continue;
50476         if (k2 === "piste:type") {
50477           k2 = "piste";
50478         } else if (k2 === "building:part") {
50479           k2 = "building_part";
50480         }
50481         primary = k2;
50482         if (statuses.indexOf(v2) !== -1) {
50483           status = v2;
50484           classes.push("tag-" + k2);
50485         } else {
50486           classes.push("tag-" + k2);
50487           classes.push("tag-" + k2 + "-" + v2);
50488         }
50489         break;
50490       }
50491       if (!primary) {
50492         for (i3 = 0; i3 < statuses.length; i3++) {
50493           for (j2 = 0; j2 < primaries.length; j2++) {
50494             k2 = statuses[i3] + ":" + primaries[j2];
50495             v2 = t2[k2];
50496             if (!v2 || v2 === "no") continue;
50497             status = statuses[i3];
50498             break;
50499           }
50500         }
50501       }
50502       if (!status) {
50503         for (i3 = 0; i3 < statuses.length; i3++) {
50504           k2 = statuses[i3];
50505           v2 = t2[k2];
50506           if (!v2 || v2 === "no") continue;
50507           if (v2 === "yes") {
50508             status = k2;
50509           } else if (primary && primary === v2) {
50510             status = k2;
50511           } else if (!primary && primaries.indexOf(v2) !== -1) {
50512             status = k2;
50513             primary = v2;
50514             classes.push("tag-" + v2);
50515           }
50516           if (status) break;
50517         }
50518       }
50519       if (status) {
50520         classes.push("tag-status");
50521         classes.push("tag-status-" + status);
50522       }
50523       for (i3 = 0; i3 < secondaries.length; i3++) {
50524         k2 = secondaries[i3];
50525         v2 = t2[k2];
50526         if (!v2 || v2 === "no" || k2 === primary) continue;
50527         classes.push("tag-" + k2);
50528         classes.push("tag-" + k2 + "-" + v2);
50529       }
50530       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
50531         var surface = t2.highway === "track" ? "unpaved" : "paved";
50532         for (k2 in t2) {
50533           v2 = t2[k2];
50534           if (k2 in osmPavedTags) {
50535             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
50536           }
50537           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
50538             surface = "semipaved";
50539           }
50540         }
50541         classes.push("tag-" + surface);
50542       }
50543       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
50544       if (qid) {
50545         classes.push("tag-wikidata");
50546       }
50547       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
50548     };
50549     tagClasses.tags = function(val) {
50550       if (!arguments.length) return _tags;
50551       _tags = val;
50552       return tagClasses;
50553     };
50554     return tagClasses;
50555   }
50556   var init_tag_classes = __esm({
50557     "modules/svg/tag_classes.js"() {
50558       "use strict";
50559       init_src5();
50560       init_tags();
50561     }
50562   });
50563
50564   // modules/svg/tag_pattern.js
50565   var tag_pattern_exports = {};
50566   __export(tag_pattern_exports, {
50567     svgTagPattern: () => svgTagPattern
50568   });
50569   function svgTagPattern(tags) {
50570     if (tags.building && tags.building !== "no") {
50571       return null;
50572     }
50573     for (var tag2 in patterns) {
50574       var entityValue = tags[tag2];
50575       if (!entityValue) continue;
50576       if (typeof patterns[tag2] === "string") {
50577         return "pattern-" + patterns[tag2];
50578       } else {
50579         var values = patterns[tag2];
50580         for (var value in values) {
50581           if (entityValue !== value) continue;
50582           var rules = values[value];
50583           if (typeof rules === "string") {
50584             return "pattern-" + rules;
50585           }
50586           for (var ruleKey in rules) {
50587             var rule = rules[ruleKey];
50588             var pass = true;
50589             for (var criterion in rule) {
50590               if (criterion !== "pattern") {
50591                 var v2 = tags[criterion];
50592                 if (!v2 || v2 !== rule[criterion]) {
50593                   pass = false;
50594                   break;
50595                 }
50596               }
50597             }
50598             if (pass) {
50599               return "pattern-" + rule.pattern;
50600             }
50601           }
50602         }
50603       }
50604     }
50605     return null;
50606   }
50607   var patterns;
50608   var init_tag_pattern = __esm({
50609     "modules/svg/tag_pattern.js"() {
50610       "use strict";
50611       patterns = {
50612         // tag - pattern name
50613         // -or-
50614         // tag - value - pattern name
50615         // -or-
50616         // tag - value - rules (optional tag-values, pattern name)
50617         // (matches earlier rules first, so fallback should be last entry)
50618         amenity: {
50619           grave_yard: "cemetery",
50620           fountain: "water_standing"
50621         },
50622         landuse: {
50623           cemetery: [
50624             { religion: "christian", pattern: "cemetery_christian" },
50625             { religion: "buddhist", pattern: "cemetery_buddhist" },
50626             { religion: "muslim", pattern: "cemetery_muslim" },
50627             { religion: "jewish", pattern: "cemetery_jewish" },
50628             { pattern: "cemetery" }
50629           ],
50630           construction: "construction",
50631           farmland: "farmland",
50632           farmyard: "farmyard",
50633           forest: [
50634             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
50635             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
50636             { leaf_type: "leafless", pattern: "forest_leafless" },
50637             { pattern: "forest" }
50638             // same as 'leaf_type:mixed'
50639           ],
50640           grave_yard: "cemetery",
50641           grass: "grass",
50642           landfill: "landfill",
50643           meadow: "meadow",
50644           military: "construction",
50645           orchard: "orchard",
50646           quarry: "quarry",
50647           vineyard: "vineyard"
50648         },
50649         leisure: {
50650           horse_riding: "farmyard"
50651         },
50652         natural: {
50653           beach: "beach",
50654           grassland: "grass",
50655           sand: "beach",
50656           scrub: "scrub",
50657           water: [
50658             { water: "pond", pattern: "pond" },
50659             { water: "reservoir", pattern: "water_standing" },
50660             { pattern: "waves" }
50661           ],
50662           wetland: [
50663             { wetland: "marsh", pattern: "wetland_marsh" },
50664             { wetland: "swamp", pattern: "wetland_swamp" },
50665             { wetland: "bog", pattern: "wetland_bog" },
50666             { wetland: "reedbed", pattern: "wetland_reedbed" },
50667             { pattern: "wetland" }
50668           ],
50669           wood: [
50670             { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
50671             { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
50672             { leaf_type: "leafless", pattern: "forest_leafless" },
50673             { pattern: "forest" }
50674             // same as 'leaf_type:mixed'
50675           ]
50676         },
50677         golf: {
50678           green: "golf_green",
50679           tee: "grass",
50680           fairway: "grass",
50681           rough: "scrub"
50682         },
50683         surface: {
50684           grass: "grass",
50685           sand: "beach"
50686         }
50687       };
50688     }
50689   });
50690
50691   // modules/svg/areas.js
50692   var areas_exports = {};
50693   __export(areas_exports, {
50694     svgAreas: () => svgAreas
50695   });
50696   function svgAreas(projection2, context) {
50697     function getPatternStyle(tags) {
50698       var imageID = svgTagPattern(tags);
50699       if (imageID) {
50700         return 'url("#ideditor-' + imageID + '")';
50701       }
50702       return "";
50703     }
50704     function drawTargets(selection2, graph, entities, filter2) {
50705       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
50706       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
50707       var getPath = svgPath(projection2).geojson;
50708       var activeID = context.activeID();
50709       var base = context.history().base();
50710       var data = { targets: [], nopes: [] };
50711       entities.forEach(function(way) {
50712         var features = svgSegmentWay(way, graph, activeID);
50713         data.targets.push.apply(data.targets, features.passive);
50714         data.nopes.push.apply(data.nopes, features.active);
50715       });
50716       var targetData = data.targets.filter(getPath);
50717       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
50718         return filter2(d2.properties.entity);
50719       }).data(targetData, function key(d2) {
50720         return d2.id;
50721       });
50722       targets.exit().remove();
50723       var segmentWasEdited = function(d2) {
50724         var wayID = d2.properties.entity.id;
50725         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
50726           return false;
50727         }
50728         return d2.properties.nodes.some(function(n3) {
50729           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
50730         });
50731       };
50732       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
50733         return "way area target target-allowed " + targetClass + d2.id;
50734       }).classed("segment-edited", segmentWasEdited);
50735       var nopeData = data.nopes.filter(getPath);
50736       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
50737         return filter2(d2.properties.entity);
50738       }).data(nopeData, function key(d2) {
50739         return d2.id;
50740       });
50741       nopes.exit().remove();
50742       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
50743         return "way area target target-nope " + nopeClass + d2.id;
50744       }).classed("segment-edited", segmentWasEdited);
50745     }
50746     function drawAreas(selection2, graph, entities, filter2) {
50747       var path = svgPath(projection2, graph, true);
50748       var areas = {};
50749       var base = context.history().base();
50750       for (var i3 = 0; i3 < entities.length; i3++) {
50751         var entity = entities[i3];
50752         if (entity.geometry(graph) !== "area") continue;
50753         if (!areas[entity.id]) {
50754           areas[entity.id] = {
50755             entity,
50756             area: Math.abs(entity.area(graph))
50757           };
50758         }
50759       }
50760       var fills = Object.values(areas).filter(function hasPath(a2) {
50761         return path(a2.entity);
50762       });
50763       fills.sort(function areaSort(a2, b2) {
50764         return b2.area - a2.area;
50765       });
50766       fills = fills.map(function(a2) {
50767         return a2.entity;
50768       });
50769       var strokes = fills.filter(function(area) {
50770         return area.type === "way";
50771       });
50772       var data = {
50773         clip: fills,
50774         shadow: strokes,
50775         stroke: strokes,
50776         fill: fills
50777       };
50778       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
50779       clipPaths.exit().remove();
50780       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
50781         return "ideditor-" + entity2.id + "-clippath";
50782       });
50783       clipPathsEnter.append("path");
50784       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
50785       var drawLayer = selection2.selectAll(".layer-osm.areas");
50786       var touchLayer = selection2.selectAll(".layer-touch.areas");
50787       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
50788       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
50789         return "areagroup area-" + d2;
50790       }).merge(areagroup);
50791       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
50792         return data[layer];
50793       }, osmEntity.key);
50794       paths.exit().remove();
50795       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
50796       var bisect = bisector(function(node) {
50797         return -node.__data__.area(graph);
50798       }).left;
50799       function sortedByArea(entity2) {
50800         if (this._parent.__data__ === "fill") {
50801           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
50802         }
50803       }
50804       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
50805         var layer = this.parentNode.__data__;
50806         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
50807         if (layer === "fill") {
50808           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
50809           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
50810         }
50811       }).classed("added", function(d2) {
50812         return !base.entities[d2.id];
50813       }).classed("geometry-edited", function(d2) {
50814         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);
50815       }).classed("retagged", function(d2) {
50816         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);
50817       }).call(svgTagClasses()).attr("d", path);
50818       touchLayer.call(drawTargets, graph, data.stroke, filter2);
50819     }
50820     return drawAreas;
50821   }
50822   var import_fast_deep_equal5;
50823   var init_areas = __esm({
50824     "modules/svg/areas.js"() {
50825       "use strict";
50826       import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
50827       init_src();
50828       init_osm();
50829       init_helpers();
50830       init_tag_classes();
50831       init_tag_pattern();
50832     }
50833   });
50834
50835   // node_modules/fast-json-stable-stringify/index.js
50836   var require_fast_json_stable_stringify = __commonJS({
50837     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
50838       "use strict";
50839       module2.exports = function(data, opts) {
50840         if (!opts) opts = {};
50841         if (typeof opts === "function") opts = { cmp: opts };
50842         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
50843         var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
50844           return function(node) {
50845             return function(a2, b2) {
50846               var aobj = { key: a2, value: node[a2] };
50847               var bobj = { key: b2, value: node[b2] };
50848               return f2(aobj, bobj);
50849             };
50850           };
50851         }(opts.cmp);
50852         var seen = [];
50853         return function stringify3(node) {
50854           if (node && node.toJSON && typeof node.toJSON === "function") {
50855             node = node.toJSON();
50856           }
50857           if (node === void 0) return;
50858           if (typeof node == "number") return isFinite(node) ? "" + node : "null";
50859           if (typeof node !== "object") return JSON.stringify(node);
50860           var i3, out;
50861           if (Array.isArray(node)) {
50862             out = "[";
50863             for (i3 = 0; i3 < node.length; i3++) {
50864               if (i3) out += ",";
50865               out += stringify3(node[i3]) || "null";
50866             }
50867             return out + "]";
50868           }
50869           if (node === null) return "null";
50870           if (seen.indexOf(node) !== -1) {
50871             if (cycles) return JSON.stringify("__cycle__");
50872             throw new TypeError("Converting circular structure to JSON");
50873           }
50874           var seenIndex = seen.push(node) - 1;
50875           var keys2 = Object.keys(node).sort(cmp && cmp(node));
50876           out = "";
50877           for (i3 = 0; i3 < keys2.length; i3++) {
50878             var key = keys2[i3];
50879             var value = stringify3(node[key]);
50880             if (!value) continue;
50881             if (out) out += ",";
50882             out += JSON.stringify(key) + ":" + value;
50883           }
50884           seen.splice(seenIndex, 1);
50885           return "{" + out + "}";
50886         }(data);
50887       };
50888     }
50889   });
50890
50891   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
50892   function $(element, tagName) {
50893     return Array.from(element.getElementsByTagName(tagName));
50894   }
50895   function normalizeId(id2) {
50896     return id2[0] === "#" ? id2 : `#${id2}`;
50897   }
50898   function $ns(element, tagName, ns) {
50899     return Array.from(element.getElementsByTagNameNS(ns, tagName));
50900   }
50901   function nodeVal(node) {
50902     node == null ? void 0 : node.normalize();
50903     return (node == null ? void 0 : node.textContent) || "";
50904   }
50905   function get1(node, tagName, callback) {
50906     const n3 = node.getElementsByTagName(tagName);
50907     const result = n3.length ? n3[0] : null;
50908     if (result && callback)
50909       callback(result);
50910     return result;
50911   }
50912   function get3(node, tagName, callback) {
50913     const properties = {};
50914     if (!node)
50915       return properties;
50916     const n3 = node.getElementsByTagName(tagName);
50917     const result = n3.length ? n3[0] : null;
50918     if (result && callback) {
50919       return callback(result, properties);
50920     }
50921     return properties;
50922   }
50923   function val1(node, tagName, callback) {
50924     const val = nodeVal(get1(node, tagName));
50925     if (val && callback)
50926       return callback(val) || {};
50927     return {};
50928   }
50929   function $num(node, tagName, callback) {
50930     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
50931     if (Number.isNaN(val))
50932       return void 0;
50933     if (val && callback)
50934       return callback(val) || {};
50935     return {};
50936   }
50937   function num1(node, tagName, callback) {
50938     const val = Number.parseFloat(nodeVal(get1(node, tagName)));
50939     if (Number.isNaN(val))
50940       return void 0;
50941     if (callback)
50942       callback(val);
50943     return val;
50944   }
50945   function getMulti(node, propertyNames) {
50946     const properties = {};
50947     for (const property of propertyNames) {
50948       val1(node, property, (val) => {
50949         properties[property] = val;
50950       });
50951     }
50952     return properties;
50953   }
50954   function isElement(node) {
50955     return (node == null ? void 0 : node.nodeType) === 1;
50956   }
50957   function getExtensions(node) {
50958     let values = [];
50959     if (node === null)
50960       return values;
50961     for (const child of Array.from(node.childNodes)) {
50962       if (!isElement(child))
50963         continue;
50964       const name = abbreviateName(child.nodeName);
50965       if (name === "gpxtpx:TrackPointExtension") {
50966         values = values.concat(getExtensions(child));
50967       } else {
50968         const val = nodeVal(child);
50969         values.push([name, parseNumeric(val)]);
50970       }
50971     }
50972     return values;
50973   }
50974   function abbreviateName(name) {
50975     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
50976   }
50977   function parseNumeric(val) {
50978     const num = Number.parseFloat(val);
50979     return Number.isNaN(num) ? val : num;
50980   }
50981   function coordPair$1(node) {
50982     const ll = [
50983       Number.parseFloat(node.getAttribute("lon") || ""),
50984       Number.parseFloat(node.getAttribute("lat") || "")
50985     ];
50986     if (Number.isNaN(ll[0]) || Number.isNaN(ll[1])) {
50987       return null;
50988     }
50989     num1(node, "ele", (val) => {
50990       ll.push(val);
50991     });
50992     const time = get1(node, "time");
50993     return {
50994       coordinates: ll,
50995       time: time ? nodeVal(time) : null,
50996       extendedValues: getExtensions(get1(node, "extensions"))
50997     };
50998   }
50999   function getLineStyle(node) {
51000     return get3(node, "line", (lineStyle) => {
51001       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
51002         return { stroke: `#${color2}` };
51003       }), $num(lineStyle, "opacity", (opacity) => {
51004         return { "stroke-opacity": opacity };
51005       }), $num(lineStyle, "width", (width) => {
51006         return { "stroke-width": width * 96 / 25.4 };
51007       }));
51008       return val;
51009     });
51010   }
51011   function extractProperties(ns, node) {
51012     var _a3;
51013     const properties = getMulti(node, [
51014       "name",
51015       "cmt",
51016       "desc",
51017       "type",
51018       "time",
51019       "keywords"
51020     ]);
51021     for (const [n3, url] of ns) {
51022       for (const child of Array.from(node.getElementsByTagNameNS(url, "*"))) {
51023         properties[child.tagName.replace(":", "_")] = (_a3 = nodeVal(child)) == null ? void 0 : _a3.trim();
51024       }
51025     }
51026     const links = $(node, "link");
51027     if (links.length) {
51028       properties.links = links.map((link3) => Object.assign({ href: link3.getAttribute("href") }, getMulti(link3, ["text", "type"])));
51029     }
51030     return properties;
51031   }
51032   function getPoints$1(node, pointname) {
51033     const pts = $(node, pointname);
51034     const line = [];
51035     const times = [];
51036     const extendedValues = {};
51037     for (let i3 = 0; i3 < pts.length; i3++) {
51038       const c2 = coordPair$1(pts[i3]);
51039       if (!c2) {
51040         continue;
51041       }
51042       line.push(c2.coordinates);
51043       if (c2.time)
51044         times.push(c2.time);
51045       for (const [name, val] of c2.extendedValues) {
51046         const plural = name === "heart" ? name : `${name.replace("gpxtpx:", "")}s`;
51047         if (!extendedValues[plural]) {
51048           extendedValues[plural] = Array(pts.length).fill(null);
51049         }
51050         extendedValues[plural][i3] = val;
51051       }
51052     }
51053     if (line.length < 2)
51054       return;
51055     return {
51056       line,
51057       times,
51058       extendedValues
51059     };
51060   }
51061   function getRoute(ns, node) {
51062     const line = getPoints$1(node, "rtept");
51063     if (!line)
51064       return;
51065     return {
51066       type: "Feature",
51067       properties: Object.assign({ _gpxType: "rte" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions"))),
51068       geometry: {
51069         type: "LineString",
51070         coordinates: line.line
51071       }
51072     };
51073   }
51074   function getTrack(ns, node) {
51075     var _a3;
51076     const segments = $(node, "trkseg");
51077     const track = [];
51078     const times = [];
51079     const extractedLines = [];
51080     for (const segment of segments) {
51081       const line = getPoints$1(segment, "trkpt");
51082       if (line) {
51083         extractedLines.push(line);
51084         if ((_a3 = line.times) == null ? void 0 : _a3.length)
51085           times.push(line.times);
51086       }
51087     }
51088     if (extractedLines.length === 0)
51089       return null;
51090     const multi = extractedLines.length > 1;
51091     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(ns, node), getLineStyle(get1(node, "extensions")), times.length ? {
51092       coordinateProperties: {
51093         times: multi ? times : times[0]
51094       }
51095     } : {});
51096     for (const line of extractedLines) {
51097       track.push(line.line);
51098       if (!properties.coordinateProperties) {
51099         properties.coordinateProperties = {};
51100       }
51101       const props = properties.coordinateProperties;
51102       const entries = Object.entries(line.extendedValues);
51103       for (let i3 = 0; i3 < entries.length; i3++) {
51104         const [name, val] = entries[i3];
51105         if (multi) {
51106           if (!props[name]) {
51107             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
51108           }
51109           props[name][i3] = val;
51110         } else {
51111           props[name] = val;
51112         }
51113       }
51114     }
51115     return {
51116       type: "Feature",
51117       properties,
51118       geometry: multi ? {
51119         type: "MultiLineString",
51120         coordinates: track
51121       } : {
51122         type: "LineString",
51123         coordinates: track[0]
51124       }
51125     };
51126   }
51127   function getPoint(ns, node) {
51128     const properties = Object.assign(extractProperties(ns, node), getMulti(node, ["sym"]));
51129     const pair3 = coordPair$1(node);
51130     if (!pair3)
51131       return null;
51132     return {
51133       type: "Feature",
51134       properties,
51135       geometry: {
51136         type: "Point",
51137         coordinates: pair3.coordinates
51138       }
51139     };
51140   }
51141   function* gpxGen(node) {
51142     var _a3, _b2;
51143     const n3 = node;
51144     const GPXX = "gpxx";
51145     const GPXX_URI = "http://www.garmin.com/xmlschemas/GpxExtensions/v3";
51146     const ns = [[GPXX, GPXX_URI]];
51147     const attrs = (_a3 = n3.getElementsByTagName("gpx")[0]) == null ? void 0 : _a3.attributes;
51148     if (attrs) {
51149       for (const attr of Array.from(attrs)) {
51150         if (((_b2 = attr.name) == null ? void 0 : _b2.startsWith("xmlns:")) && attr.value !== GPXX_URI) {
51151           ns.push([attr.name, attr.value]);
51152         }
51153       }
51154     }
51155     for (const track of $(n3, "trk")) {
51156       const feature3 = getTrack(ns, track);
51157       if (feature3)
51158         yield feature3;
51159     }
51160     for (const route of $(n3, "rte")) {
51161       const feature3 = getRoute(ns, route);
51162       if (feature3)
51163         yield feature3;
51164     }
51165     for (const waypoint of $(n3, "wpt")) {
51166       const point = getPoint(ns, waypoint);
51167       if (point)
51168         yield point;
51169     }
51170   }
51171   function gpx(node) {
51172     return {
51173       type: "FeatureCollection",
51174       features: Array.from(gpxGen(node))
51175     };
51176   }
51177   function fixColor(v2, prefix) {
51178     const properties = {};
51179     const colorProp = prefix === "stroke" || prefix === "fill" ? prefix : `${prefix}-color`;
51180     if (v2[0] === "#") {
51181       v2 = v2.substring(1);
51182     }
51183     if (v2.length === 6 || v2.length === 3) {
51184       properties[colorProp] = `#${v2}`;
51185     } else if (v2.length === 8) {
51186       properties[`${prefix}-opacity`] = Number.parseInt(v2.substring(0, 2), 16) / 255;
51187       properties[colorProp] = `#${v2.substring(6, 8)}${v2.substring(4, 6)}${v2.substring(2, 4)}`;
51188     }
51189     return properties;
51190   }
51191   function numericProperty(node, source, target) {
51192     const properties = {};
51193     num1(node, source, (val) => {
51194       properties[target] = val;
51195     });
51196     return properties;
51197   }
51198   function getColor(node, output) {
51199     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
51200   }
51201   function extractIconHref(node) {
51202     return get3(node, "Icon", (icon2, properties) => {
51203       val1(icon2, "href", (href) => {
51204         properties.icon = href;
51205       });
51206       return properties;
51207     });
51208   }
51209   function extractIcon(node) {
51210     return get3(node, "IconStyle", (iconStyle) => {
51211       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
51212         const left = Number.parseFloat(hotspot.getAttribute("x") || "");
51213         const top = Number.parseFloat(hotspot.getAttribute("y") || "");
51214         const xunits = hotspot.getAttribute("xunits") || "";
51215         const yunits = hotspot.getAttribute("yunits") || "";
51216         if (!Number.isNaN(left) && !Number.isNaN(top))
51217           return {
51218             "icon-offset": [left, top],
51219             "icon-offset-units": [xunits, yunits]
51220           };
51221         return {};
51222       }), extractIconHref(iconStyle));
51223     });
51224   }
51225   function extractLabel(node) {
51226     return get3(node, "LabelStyle", (labelStyle) => {
51227       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
51228     });
51229   }
51230   function extractLine(node) {
51231     return get3(node, "LineStyle", (lineStyle) => {
51232       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
51233     });
51234   }
51235   function extractPoly(node) {
51236     return get3(node, "PolyStyle", (polyStyle, properties) => {
51237       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
51238         if (fill === "0")
51239           return { "fill-opacity": 0 };
51240       }), val1(polyStyle, "outline", (outline) => {
51241         if (outline === "0")
51242           return { "stroke-opacity": 0 };
51243       }));
51244     });
51245   }
51246   function extractStyle(node) {
51247     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
51248   }
51249   function coord1(value) {
51250     return value.replace(removeSpace, "").split(",").map(Number.parseFloat).filter((num) => !Number.isNaN(num)).slice(0, 3);
51251   }
51252   function coord(value) {
51253     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
51254       return coord2.length >= 2;
51255     });
51256   }
51257   function gxCoords(node) {
51258     let elems = $(node, "coord");
51259     if (elems.length === 0) {
51260       elems = $ns(node, "coord", "*");
51261     }
51262     const coordinates = elems.map((elem) => {
51263       return nodeVal(elem).split(" ").map(Number.parseFloat);
51264     });
51265     if (coordinates.length === 0) {
51266       return null;
51267     }
51268     return {
51269       geometry: coordinates.length > 2 ? {
51270         type: "LineString",
51271         coordinates
51272       } : {
51273         type: "Point",
51274         coordinates: coordinates[0]
51275       },
51276       times: $(node, "when").map((elem) => nodeVal(elem))
51277     };
51278   }
51279   function fixRing(ring) {
51280     if (ring.length === 0)
51281       return ring;
51282     const first = ring[0];
51283     const last = ring[ring.length - 1];
51284     let equal = true;
51285     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
51286       if (first[i3] !== last[i3]) {
51287         equal = false;
51288         break;
51289       }
51290     }
51291     if (!equal) {
51292       return ring.concat([ring[0]]);
51293     }
51294     return ring;
51295   }
51296   function getCoordinates(node) {
51297     return nodeVal(get1(node, "coordinates"));
51298   }
51299   function getGeometry(node) {
51300     let geometries = [];
51301     let coordTimes = [];
51302     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
51303       const child = node.childNodes.item(i3);
51304       if (isElement(child)) {
51305         switch (child.tagName) {
51306           case "MultiGeometry":
51307           case "MultiTrack":
51308           case "gx:MultiTrack": {
51309             const childGeometries = getGeometry(child);
51310             geometries = geometries.concat(childGeometries.geometries);
51311             coordTimes = coordTimes.concat(childGeometries.coordTimes);
51312             break;
51313           }
51314           case "Point": {
51315             const coordinates = coord1(getCoordinates(child));
51316             if (coordinates.length >= 2) {
51317               geometries.push({
51318                 type: "Point",
51319                 coordinates
51320               });
51321             }
51322             break;
51323           }
51324           case "LinearRing":
51325           case "LineString": {
51326             const coordinates = coord(getCoordinates(child));
51327             if (coordinates.length >= 2) {
51328               geometries.push({
51329                 type: "LineString",
51330                 coordinates
51331               });
51332             }
51333             break;
51334           }
51335           case "Polygon": {
51336             const coords = [];
51337             for (const linearRing of $(child, "LinearRing")) {
51338               const ring = fixRing(coord(getCoordinates(linearRing)));
51339               if (ring.length >= 4) {
51340                 coords.push(ring);
51341               }
51342             }
51343             if (coords.length) {
51344               geometries.push({
51345                 type: "Polygon",
51346                 coordinates: coords
51347               });
51348             }
51349             break;
51350           }
51351           case "Track":
51352           case "gx:Track": {
51353             const gx = gxCoords(child);
51354             if (!gx)
51355               break;
51356             const { times, geometry } = gx;
51357             geometries.push(geometry);
51358             if (times.length)
51359               coordTimes.push(times);
51360             break;
51361           }
51362         }
51363       }
51364     }
51365     return {
51366       geometries,
51367       coordTimes
51368     };
51369   }
51370   function extractExtendedData(node, schema) {
51371     return get3(node, "ExtendedData", (extendedData, properties) => {
51372       for (const data of $(extendedData, "Data")) {
51373         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
51374       }
51375       for (const simpleData of $(extendedData, "SimpleData")) {
51376         const name = simpleData.getAttribute("name") || "";
51377         const typeConverter = schema[name] || typeConverters.string;
51378         properties[name] = typeConverter(nodeVal(simpleData));
51379       }
51380       return properties;
51381     });
51382   }
51383   function getMaybeHTMLDescription(node) {
51384     const descriptionNode = get1(node, "description");
51385     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
51386       if (c2.nodeType === 4) {
51387         return {
51388           description: {
51389             "@type": "html",
51390             value: nodeVal(c2)
51391           }
51392         };
51393       }
51394     }
51395     return {};
51396   }
51397   function extractTimeSpan(node) {
51398     return get3(node, "TimeSpan", (timeSpan) => {
51399       return {
51400         timespan: {
51401           begin: nodeVal(get1(timeSpan, "begin")),
51402           end: nodeVal(get1(timeSpan, "end"))
51403         }
51404       };
51405     });
51406   }
51407   function extractTimeStamp(node) {
51408     return get3(node, "TimeStamp", (timeStamp) => {
51409       return { timestamp: nodeVal(get1(timeStamp, "when")) };
51410     });
51411   }
51412   function extractCascadedStyle(node, styleMap) {
51413     return val1(node, "styleUrl", (styleUrl) => {
51414       styleUrl = normalizeId(styleUrl);
51415       if (styleMap[styleUrl]) {
51416         return Object.assign({ styleUrl }, styleMap[styleUrl]);
51417       }
51418       return { styleUrl };
51419     });
51420   }
51421   function processAltitudeMode(mode) {
51422     switch (mode == null ? void 0 : mode.textContent) {
51423       case AltitudeMode.ABSOLUTE:
51424         return AltitudeMode.ABSOLUTE;
51425       case AltitudeMode.CLAMP_TO_GROUND:
51426         return AltitudeMode.CLAMP_TO_GROUND;
51427       case AltitudeMode.CLAMP_TO_SEAFLOOR:
51428         return AltitudeMode.CLAMP_TO_SEAFLOOR;
51429       case AltitudeMode.RELATIVE_TO_GROUND:
51430         return AltitudeMode.RELATIVE_TO_GROUND;
51431       case AltitudeMode.RELATIVE_TO_SEAFLOOR:
51432         return AltitudeMode.RELATIVE_TO_SEAFLOOR;
51433     }
51434     return null;
51435   }
51436   function getGroundOverlayBox(node) {
51437     const latLonQuad = get1(node, "gx:LatLonQuad");
51438     if (latLonQuad) {
51439       const ring = fixRing(coord(getCoordinates(node)));
51440       return {
51441         geometry: {
51442           type: "Polygon",
51443           coordinates: [ring]
51444         }
51445       };
51446     }
51447     return getLatLonBox(node);
51448   }
51449   function rotateBox(bbox2, coordinates, rotation) {
51450     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
51451     return [
51452       coordinates[0].map((coordinate) => {
51453         const dy = coordinate[1] - center[1];
51454         const dx = coordinate[0] - center[0];
51455         const distance = Math.sqrt(dy ** 2 + dx ** 2);
51456         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
51457         return [
51458           center[0] + Math.cos(angle2) * distance,
51459           center[1] + Math.sin(angle2) * distance
51460         ];
51461       })
51462     ];
51463   }
51464   function getLatLonBox(node) {
51465     const latLonBox = get1(node, "LatLonBox");
51466     if (latLonBox) {
51467       const north = num1(latLonBox, "north");
51468       const west = num1(latLonBox, "west");
51469       const east = num1(latLonBox, "east");
51470       const south = num1(latLonBox, "south");
51471       const rotation = num1(latLonBox, "rotation");
51472       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
51473         const bbox2 = [west, south, east, north];
51474         let coordinates = [
51475           [
51476             [west, north],
51477             // top left
51478             [east, north],
51479             // top right
51480             [east, south],
51481             // top right
51482             [west, south],
51483             // bottom left
51484             [west, north]
51485             // top left (again)
51486           ]
51487         ];
51488         if (typeof rotation === "number") {
51489           coordinates = rotateBox(bbox2, coordinates, rotation);
51490         }
51491         return {
51492           bbox: bbox2,
51493           geometry: {
51494             type: "Polygon",
51495             coordinates
51496           }
51497         };
51498       }
51499     }
51500     return null;
51501   }
51502   function getGroundOverlay(node, styleMap, schema, options2) {
51503     var _a3;
51504     const box = getGroundOverlayBox(node);
51505     const geometry = (box == null ? void 0 : box.geometry) || null;
51506     if (!geometry && options2.skipNullGeometry) {
51507       return null;
51508     }
51509     const feature3 = {
51510       type: "Feature",
51511       geometry,
51512       properties: Object.assign(
51513         /**
51514          * Related to
51515          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
51516          */
51517         { "@geometry-type": "groundoverlay" },
51518         getMulti(node, [
51519           "name",
51520           "address",
51521           "visibility",
51522           "open",
51523           "phoneNumber",
51524           "description"
51525         ]),
51526         getMaybeHTMLDescription(node),
51527         extractCascadedStyle(node, styleMap),
51528         extractStyle(node),
51529         extractIconHref(node),
51530         extractExtendedData(node, schema),
51531         extractTimeSpan(node),
51532         extractTimeStamp(node)
51533       )
51534     };
51535     if (box == null ? void 0 : box.bbox) {
51536       feature3.bbox = box.bbox;
51537     }
51538     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
51539       feature3.properties.visibility = feature3.properties.visibility !== "0";
51540     }
51541     const id2 = node.getAttribute("id");
51542     if (id2 !== null && id2 !== "")
51543       feature3.id = id2;
51544     return feature3;
51545   }
51546   function getNetworkLinkRegion(node) {
51547     const region = get1(node, "Region");
51548     if (region) {
51549       return {
51550         coordinateBox: getLatLonAltBox(region),
51551         lod: getLod(node)
51552       };
51553     }
51554     return null;
51555   }
51556   function getLod(node) {
51557     var _a3, _b2, _c, _d;
51558     const lod = get1(node, "Lod");
51559     if (lod) {
51560       return [
51561         (_a3 = num1(lod, "minLodPixels")) != null ? _a3 : -1,
51562         (_b2 = num1(lod, "maxLodPixels")) != null ? _b2 : -1,
51563         (_c = num1(lod, "minFadeExtent")) != null ? _c : null,
51564         (_d = num1(lod, "maxFadeExtent")) != null ? _d : null
51565       ];
51566     }
51567     return null;
51568   }
51569   function getLatLonAltBox(node) {
51570     const latLonAltBox = get1(node, "LatLonAltBox");
51571     if (latLonAltBox) {
51572       const north = num1(latLonAltBox, "north");
51573       const west = num1(latLonAltBox, "west");
51574       const east = num1(latLonAltBox, "east");
51575       const south = num1(latLonAltBox, "south");
51576       const altitudeMode = processAltitudeMode(get1(latLonAltBox, "altitudeMode") || get1(latLonAltBox, "gx:altitudeMode"));
51577       if (altitudeMode) {
51578         console.debug("Encountered an unsupported feature of KML for togeojson: please contact developers for support of altitude mode.");
51579       }
51580       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
51581         const bbox2 = [west, south, east, north];
51582         const coordinates = [
51583           [
51584             [west, north],
51585             // top left
51586             [east, north],
51587             // top right
51588             [east, south],
51589             // top right
51590             [west, south],
51591             // bottom left
51592             [west, north]
51593             // top left (again)
51594           ]
51595         ];
51596         return {
51597           bbox: bbox2,
51598           geometry: {
51599             type: "Polygon",
51600             coordinates
51601           }
51602         };
51603       }
51604     }
51605     return null;
51606   }
51607   function getLinkObject(node) {
51608     const linkObj = get1(node, "Link");
51609     if (linkObj) {
51610       return getMulti(linkObj, [
51611         "href",
51612         "refreshMode",
51613         "refreshInterval",
51614         "viewRefreshMode",
51615         "viewRefreshTime",
51616         "viewBoundScale",
51617         "viewFormat",
51618         "httpQuery"
51619       ]);
51620     }
51621     return {};
51622   }
51623   function getNetworkLink(node, styleMap, schema, options2) {
51624     var _a3, _b2, _c;
51625     const box = getNetworkLinkRegion(node);
51626     const geometry = ((_a3 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _a3.geometry) || null;
51627     if (!geometry && options2.skipNullGeometry) {
51628       return null;
51629     }
51630     const feature3 = {
51631       type: "Feature",
51632       geometry,
51633       properties: Object.assign(
51634         /**
51635          * Related to
51636          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
51637          */
51638         { "@geometry-type": "networklink" },
51639         getMulti(node, [
51640           "name",
51641           "address",
51642           "visibility",
51643           "open",
51644           "phoneNumber",
51645           "styleUrl",
51646           "refreshVisibility",
51647           "flyToView",
51648           "description"
51649         ]),
51650         getMaybeHTMLDescription(node),
51651         extractCascadedStyle(node, styleMap),
51652         extractStyle(node),
51653         extractIconHref(node),
51654         extractExtendedData(node, schema),
51655         extractTimeSpan(node),
51656         extractTimeStamp(node),
51657         getLinkObject(node),
51658         (box == null ? void 0 : box.lod) ? { lod: box.lod } : {}
51659       )
51660     };
51661     if ((_b2 = box == null ? void 0 : box.coordinateBox) == null ? void 0 : _b2.bbox) {
51662       feature3.bbox = box.coordinateBox.bbox;
51663     }
51664     if (((_c = feature3.properties) == null ? void 0 : _c.visibility) !== void 0) {
51665       feature3.properties.visibility = feature3.properties.visibility !== "0";
51666     }
51667     const id2 = node.getAttribute("id");
51668     if (id2 !== null && id2 !== "")
51669       feature3.id = id2;
51670     return feature3;
51671   }
51672   function geometryListToGeometry(geometries) {
51673     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
51674       type: "GeometryCollection",
51675       geometries
51676     };
51677   }
51678   function getPlacemark(node, styleMap, schema, options2) {
51679     var _a3;
51680     const { coordTimes, geometries } = getGeometry(node);
51681     const geometry = geometryListToGeometry(geometries);
51682     if (!geometry && options2.skipNullGeometry) {
51683       return null;
51684     }
51685     const feature3 = {
51686       type: "Feature",
51687       geometry,
51688       properties: Object.assign(getMulti(node, [
51689         "name",
51690         "address",
51691         "visibility",
51692         "open",
51693         "phoneNumber",
51694         "description"
51695       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
51696         coordinateProperties: {
51697           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
51698         }
51699       } : {})
51700     };
51701     if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
51702       feature3.properties.visibility = feature3.properties.visibility !== "0";
51703     }
51704     const id2 = node.getAttribute("id");
51705     if (id2 !== null && id2 !== "")
51706       feature3.id = id2;
51707     return feature3;
51708   }
51709   function getStyleId(style) {
51710     let id2 = style.getAttribute("id");
51711     const parentNode = style.parentNode;
51712     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
51713       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
51714     }
51715     return normalizeId(id2 || "");
51716   }
51717   function buildStyleMap(node) {
51718     const styleMap = {};
51719     for (const style of $(node, "Style")) {
51720       styleMap[getStyleId(style)] = extractStyle(style);
51721     }
51722     for (const map2 of $(node, "StyleMap")) {
51723       const id2 = normalizeId(map2.getAttribute("id") || "");
51724       val1(map2, "styleUrl", (styleUrl) => {
51725         styleUrl = normalizeId(styleUrl);
51726         if (styleMap[styleUrl]) {
51727           styleMap[id2] = styleMap[styleUrl];
51728         }
51729       });
51730     }
51731     return styleMap;
51732   }
51733   function buildSchema(node) {
51734     const schema = {};
51735     for (const field of $(node, "SimpleField")) {
51736       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters.string;
51737     }
51738     return schema;
51739   }
51740   function* kmlGen(node, options2 = {
51741     skipNullGeometry: false
51742   }) {
51743     const n3 = node;
51744     const styleMap = buildStyleMap(n3);
51745     const schema = buildSchema(n3);
51746     for (const placemark of $(n3, "Placemark")) {
51747       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
51748       if (feature3)
51749         yield feature3;
51750     }
51751     for (const groundOverlay of $(n3, "GroundOverlay")) {
51752       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
51753       if (feature3)
51754         yield feature3;
51755     }
51756     for (const networkLink of $(n3, "NetworkLink")) {
51757       const feature3 = getNetworkLink(networkLink, styleMap, schema, options2);
51758       if (feature3)
51759         yield feature3;
51760     }
51761   }
51762   function kml(node, options2 = {
51763     skipNullGeometry: false
51764   }) {
51765     return {
51766       type: "FeatureCollection",
51767       features: Array.from(kmlGen(node, options2))
51768     };
51769   }
51770   var removeSpace, trimSpace, splitSpace, toNumber2, typeConverters, AltitudeMode, DEGREES_TO_RADIANS;
51771   var init_togeojson_es = __esm({
51772     "node_modules/@tmcw/togeojson/dist/togeojson.es.mjs"() {
51773       removeSpace = /\s*/g;
51774       trimSpace = /^\s*|\s*$/g;
51775       splitSpace = /\s+/;
51776       toNumber2 = (x2) => Number(x2);
51777       typeConverters = {
51778         string: (x2) => x2,
51779         int: toNumber2,
51780         uint: toNumber2,
51781         short: toNumber2,
51782         ushort: toNumber2,
51783         float: toNumber2,
51784         double: toNumber2,
51785         bool: (x2) => Boolean(x2)
51786       };
51787       (function(AltitudeMode2) {
51788         AltitudeMode2["ABSOLUTE"] = "absolute";
51789         AltitudeMode2["RELATIVE_TO_GROUND"] = "relativeToGround";
51790         AltitudeMode2["CLAMP_TO_GROUND"] = "clampToGround";
51791         AltitudeMode2["CLAMP_TO_SEAFLOOR"] = "clampToSeaFloor";
51792         AltitudeMode2["RELATIVE_TO_SEAFLOOR"] = "relativeToSeaFloor";
51793       })(AltitudeMode || (AltitudeMode = {}));
51794       DEGREES_TO_RADIANS = Math.PI / 180;
51795     }
51796   });
51797
51798   // modules/svg/data.js
51799   var data_exports = {};
51800   __export(data_exports, {
51801     svgData: () => svgData
51802   });
51803   function svgData(projection2, context, dispatch14) {
51804     var throttledRedraw = throttle_default(function() {
51805       dispatch14.call("change");
51806     }, 1e3);
51807     var _showLabels = true;
51808     var detected = utilDetect();
51809     var layer = select_default2(null);
51810     var _vtService;
51811     var _fileList;
51812     var _template;
51813     var _src;
51814     const supportedFormats = [
51815       ".gpx",
51816       ".kml",
51817       ".geojson",
51818       ".json"
51819     ];
51820     function init2() {
51821       if (_initialized) return;
51822       _geojson = {};
51823       _enabled = true;
51824       function over(d3_event) {
51825         d3_event.stopPropagation();
51826         d3_event.preventDefault();
51827         d3_event.dataTransfer.dropEffect = "copy";
51828       }
51829       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
51830         d3_event.stopPropagation();
51831         d3_event.preventDefault();
51832         if (!detected.filedrop) return;
51833         var f2 = d3_event.dataTransfer.files[0];
51834         var extension = getExtension(f2.name);
51835         if (!supportedFormats.includes(extension)) return;
51836         drawData.fileList(d3_event.dataTransfer.files);
51837       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
51838       _initialized = true;
51839     }
51840     function getService() {
51841       if (services.vectorTile && !_vtService) {
51842         _vtService = services.vectorTile;
51843         _vtService.event.on("loadedData", throttledRedraw);
51844       } else if (!services.vectorTile && _vtService) {
51845         _vtService = null;
51846       }
51847       return _vtService;
51848     }
51849     function showLayer() {
51850       layerOn();
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", layerOff);
51858     }
51859     function layerOn() {
51860       layer.style("display", "block");
51861     }
51862     function layerOff() {
51863       layer.selectAll(".viewfield-group").remove();
51864       layer.style("display", "none");
51865     }
51866     function ensureIDs(gj) {
51867       if (!gj) return null;
51868       if (gj.type === "FeatureCollection") {
51869         for (var i3 = 0; i3 < gj.features.length; i3++) {
51870           ensureFeatureID(gj.features[i3]);
51871         }
51872       } else {
51873         ensureFeatureID(gj);
51874       }
51875       return gj;
51876     }
51877     function ensureFeatureID(feature3) {
51878       if (!feature3) return;
51879       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
51880       return feature3;
51881     }
51882     function getFeatures(gj) {
51883       if (!gj) return [];
51884       if (gj.type === "FeatureCollection") {
51885         return gj.features;
51886       } else {
51887         return [gj];
51888       }
51889     }
51890     function featureKey(d2) {
51891       return d2.__featurehash__;
51892     }
51893     function isPolygon(d2) {
51894       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
51895     }
51896     function clipPathID(d2) {
51897       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
51898     }
51899     function featureClasses(d2) {
51900       return [
51901         "data" + d2.__featurehash__,
51902         d2.geometry.type,
51903         isPolygon(d2) ? "area" : "",
51904         d2.__layerID__ || ""
51905       ].filter(Boolean).join(" ");
51906     }
51907     function drawData(selection2) {
51908       var vtService = getService();
51909       var getPath = svgPath(projection2).geojson;
51910       var getAreaPath = svgPath(projection2, null, true).geojson;
51911       var hasData = drawData.hasData();
51912       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
51913       layer.exit().remove();
51914       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
51915       var surface = context.surface();
51916       if (!surface || surface.empty()) return;
51917       var geoData, polygonData;
51918       if (_template && vtService) {
51919         var sourceID = _template;
51920         vtService.loadTiles(sourceID, _template, projection2);
51921         geoData = vtService.data(sourceID, projection2);
51922       } else {
51923         geoData = getFeatures(_geojson);
51924       }
51925       geoData = geoData.filter(getPath);
51926       polygonData = geoData.filter(isPolygon);
51927       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
51928       clipPaths.exit().remove();
51929       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
51930       clipPathsEnter.append("path");
51931       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
51932       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
51933       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
51934         return "datagroup datagroup-" + d2;
51935       }).merge(datagroups);
51936       var pathData = {
51937         fill: polygonData,
51938         shadow: geoData,
51939         stroke: geoData
51940       };
51941       var paths = datagroups.selectAll("path").data(function(layer2) {
51942         return pathData[layer2];
51943       }, featureKey);
51944       paths.exit().remove();
51945       paths = paths.enter().append("path").attr("class", function(d2) {
51946         var datagroup = this.parentNode.__data__;
51947         return "pathdata " + datagroup + " " + featureClasses(d2);
51948       }).attr("clip-path", function(d2) {
51949         var datagroup = this.parentNode.__data__;
51950         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
51951       }).merge(paths).attr("d", function(d2) {
51952         var datagroup = this.parentNode.__data__;
51953         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
51954       });
51955       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
51956       function drawLabels(selection3, textClass, data) {
51957         var labelPath = path_default(projection2);
51958         var labelData = data.filter(function(d2) {
51959           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
51960         });
51961         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
51962         labels.exit().remove();
51963         labels = labels.enter().append("text").attr("class", function(d2) {
51964           return textClass + " " + featureClasses(d2);
51965         }).merge(labels).text(function(d2) {
51966           return d2.properties.desc || d2.properties.name;
51967         }).attr("x", function(d2) {
51968           var centroid = labelPath.centroid(d2);
51969           return centroid[0] + 11;
51970         }).attr("y", function(d2) {
51971           var centroid = labelPath.centroid(d2);
51972           return centroid[1];
51973         });
51974       }
51975     }
51976     function getExtension(fileName) {
51977       if (!fileName) return;
51978       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
51979       var match = fileName.toLowerCase().match(re3);
51980       return match && match.length && match[0];
51981     }
51982     function xmlToDom(textdata) {
51983       return new DOMParser().parseFromString(textdata, "text/xml");
51984     }
51985     function stringifyGeojsonProperties(feature3) {
51986       const properties = feature3.properties;
51987       for (const key in properties) {
51988         const property = properties[key];
51989         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
51990           properties[key] = property.toString();
51991         } else if (property === null) {
51992           properties[key] = "null";
51993         } else if (typeof property === "object") {
51994           properties[key] = JSON.stringify(property);
51995         }
51996       }
51997     }
51998     drawData.setFile = function(extension, data) {
51999       _template = null;
52000       _fileList = null;
52001       _geojson = null;
52002       _src = null;
52003       var gj;
52004       switch (extension) {
52005         case ".gpx":
52006           gj = gpx(xmlToDom(data));
52007           break;
52008         case ".kml":
52009           gj = kml(xmlToDom(data));
52010           break;
52011         case ".geojson":
52012         case ".json":
52013           gj = JSON.parse(data);
52014           if (gj.type === "FeatureCollection") {
52015             gj.features.forEach(stringifyGeojsonProperties);
52016           } else if (gj.type === "Feature") {
52017             stringifyGeojsonProperties(gj);
52018           }
52019           break;
52020       }
52021       gj = gj || {};
52022       if (Object.keys(gj).length) {
52023         _geojson = ensureIDs(gj);
52024         _src = extension + " data file";
52025         this.fitZoom();
52026       }
52027       dispatch14.call("change");
52028       return this;
52029     };
52030     drawData.showLabels = function(val) {
52031       if (!arguments.length) return _showLabels;
52032       _showLabels = val;
52033       return this;
52034     };
52035     drawData.enabled = function(val) {
52036       if (!arguments.length) return _enabled;
52037       _enabled = val;
52038       if (_enabled) {
52039         showLayer();
52040       } else {
52041         hideLayer();
52042       }
52043       dispatch14.call("change");
52044       return this;
52045     };
52046     drawData.hasData = function() {
52047       var gj = _geojson || {};
52048       return !!(_template || Object.keys(gj).length);
52049     };
52050     drawData.template = function(val, src) {
52051       if (!arguments.length) return _template;
52052       var osm = context.connection();
52053       if (osm) {
52054         var blocklists = osm.imageryBlocklists();
52055         var fail = false;
52056         var tested = 0;
52057         var regex;
52058         for (var i3 = 0; i3 < blocklists.length; i3++) {
52059           regex = blocklists[i3];
52060           fail = regex.test(val);
52061           tested++;
52062           if (fail) break;
52063         }
52064         if (!tested) {
52065           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
52066           fail = regex.test(val);
52067         }
52068       }
52069       _template = val;
52070       _fileList = null;
52071       _geojson = null;
52072       _src = src || "vectortile:" + val.split(/[?#]/)[0];
52073       dispatch14.call("change");
52074       return this;
52075     };
52076     drawData.geojson = function(gj, src) {
52077       if (!arguments.length) return _geojson;
52078       _template = null;
52079       _fileList = null;
52080       _geojson = null;
52081       _src = null;
52082       gj = gj || {};
52083       if (Object.keys(gj).length) {
52084         _geojson = ensureIDs(gj);
52085         _src = src || "unknown.geojson";
52086       }
52087       dispatch14.call("change");
52088       return this;
52089     };
52090     drawData.fileList = function(fileList) {
52091       if (!arguments.length) return _fileList;
52092       _template = null;
52093       _geojson = null;
52094       _src = null;
52095       _fileList = fileList;
52096       if (!fileList || !fileList.length) return this;
52097       var f2 = fileList[0];
52098       var extension = getExtension(f2.name);
52099       var reader = new FileReader();
52100       reader.onload = /* @__PURE__ */ function() {
52101         return function(e3) {
52102           drawData.setFile(extension, e3.target.result);
52103         };
52104       }(f2);
52105       reader.readAsText(f2);
52106       return this;
52107     };
52108     drawData.url = function(url, defaultExtension) {
52109       _template = null;
52110       _fileList = null;
52111       _geojson = null;
52112       _src = null;
52113       var testUrl = url.split(/[?#]/)[0];
52114       var extension = getExtension(testUrl) || defaultExtension;
52115       if (extension) {
52116         _template = null;
52117         text_default3(url).then(function(data) {
52118           drawData.setFile(extension, data);
52119         }).catch(function() {
52120         });
52121       } else {
52122         drawData.template(url);
52123       }
52124       return this;
52125     };
52126     drawData.getSrc = function() {
52127       return _src || "";
52128     };
52129     drawData.fitZoom = function() {
52130       var features = getFeatures(_geojson);
52131       if (!features.length) return;
52132       var map2 = context.map();
52133       var viewport = map2.trimmedExtent().polygon();
52134       var coords = features.reduce(function(coords2, feature3) {
52135         var geom = feature3.geometry;
52136         if (!geom) return coords2;
52137         var c2 = geom.coordinates;
52138         switch (geom.type) {
52139           case "Point":
52140             c2 = [c2];
52141           case "MultiPoint":
52142           case "LineString":
52143             break;
52144           case "MultiPolygon":
52145             c2 = utilArrayFlatten(c2);
52146           case "Polygon":
52147           case "MultiLineString":
52148             c2 = utilArrayFlatten(c2);
52149             break;
52150         }
52151         return utilArrayUnion(coords2, c2);
52152       }, []);
52153       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
52154         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
52155         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
52156       }
52157       return this;
52158     };
52159     init2();
52160     return drawData;
52161   }
52162   var import_fast_json_stable_stringify, _initialized, _enabled, _geojson;
52163   var init_data2 = __esm({
52164     "modules/svg/data.js"() {
52165       "use strict";
52166       init_throttle();
52167       init_src2();
52168       init_src18();
52169       init_src5();
52170       import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
52171       init_togeojson_es();
52172       init_geo2();
52173       init_services();
52174       init_helpers();
52175       init_detect();
52176       init_util();
52177       _initialized = false;
52178       _enabled = false;
52179     }
52180   });
52181
52182   // modules/svg/debug.js
52183   var debug_exports = {};
52184   __export(debug_exports, {
52185     svgDebug: () => svgDebug
52186   });
52187   function svgDebug(projection2, context) {
52188     function drawDebug(selection2) {
52189       const showTile = context.getDebug("tile");
52190       const showCollision = context.getDebug("collision");
52191       const showImagery = context.getDebug("imagery");
52192       const showTouchTargets = context.getDebug("target");
52193       const showDownloaded = context.getDebug("downloaded");
52194       let debugData = [];
52195       if (showTile) {
52196         debugData.push({ class: "red", label: "tile" });
52197       }
52198       if (showCollision) {
52199         debugData.push({ class: "yellow", label: "collision" });
52200       }
52201       if (showImagery) {
52202         debugData.push({ class: "orange", label: "imagery" });
52203       }
52204       if (showTouchTargets) {
52205         debugData.push({ class: "pink", label: "touchTargets" });
52206       }
52207       if (showDownloaded) {
52208         debugData.push({ class: "purple", label: "downloaded" });
52209       }
52210       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
52211       legend.exit().remove();
52212       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
52213       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
52214       legendItems.exit().remove();
52215       legendItems.enter().append("span").attr("class", (d2) => `debug-legend-item ${d2.class}`).text((d2) => d2.label);
52216       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
52217       layer.exit().remove();
52218       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
52219       const extent = context.map().extent();
52220       _mainFileFetcher.get("imagery").then((d2) => {
52221         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
52222         const features = hits.map((d4) => d4.features[d4.id]);
52223         let imagery = layer.selectAll("path.debug-imagery").data(features);
52224         imagery.exit().remove();
52225         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
52226       }).catch(() => {
52227       });
52228       const osm = context.connection();
52229       let dataDownloaded = [];
52230       if (osm && showDownloaded) {
52231         const rtree = osm.caches("get").tile.rtree;
52232         dataDownloaded = rtree.all().map((bbox2) => {
52233           return {
52234             type: "Feature",
52235             properties: { id: bbox2.id },
52236             geometry: {
52237               type: "Polygon",
52238               coordinates: [[
52239                 [bbox2.minX, bbox2.minY],
52240                 [bbox2.minX, bbox2.maxY],
52241                 [bbox2.maxX, bbox2.maxY],
52242                 [bbox2.maxX, bbox2.minY],
52243                 [bbox2.minX, bbox2.minY]
52244               ]]
52245             }
52246           };
52247         });
52248       }
52249       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
52250       downloaded.exit().remove();
52251       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
52252       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
52253     }
52254     drawDebug.enabled = function() {
52255       if (!arguments.length) {
52256         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
52257       } else {
52258         return this;
52259       }
52260     };
52261     return drawDebug;
52262   }
52263   var init_debug = __esm({
52264     "modules/svg/debug.js"() {
52265       "use strict";
52266       init_file_fetcher();
52267       init_helpers();
52268     }
52269   });
52270
52271   // modules/svg/defs.js
52272   var defs_exports = {};
52273   __export(defs_exports, {
52274     svgDefs: () => svgDefs
52275   });
52276   function svgDefs(context) {
52277     var _defsSelection = select_default2(null);
52278     var _spritesheetIds = [
52279       "iD-sprite",
52280       "maki-sprite",
52281       "temaki-sprite",
52282       "fa-sprite",
52283       "roentgen-sprite",
52284       "community-sprite"
52285     ];
52286     function drawDefs(selection2) {
52287       _defsSelection = selection2.append("defs");
52288       function addOnewayMarker(name, colour) {
52289         _defsSelection.append("marker").attr("id", `ideditor-oneway-marker-${name}`).attr("viewBox", "0 0 10 5").attr("refX", 4).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 6,3 L 0,3 L 0,2 L 6,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", colour).attr("opacity", "1");
52290       }
52291       addOnewayMarker("black", "#333");
52292       addOnewayMarker("white", "#fff");
52293       addOnewayMarker("gray", "#eee");
52294       function addSidedMarker(name, color2, offset) {
52295         _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);
52296       }
52297       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
52298       addSidedMarker("coastline", "#77dede", 1);
52299       addSidedMarker("waterway", "#77dede", 1);
52300       addSidedMarker("barrier", "#ddd", 1);
52301       addSidedMarker("man_made", "#fff", 0);
52302       _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");
52303       _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");
52304       var patterns2 = _defsSelection.selectAll("pattern").data([
52305         // pattern name, pattern image name
52306         ["beach", "dots"],
52307         ["construction", "construction"],
52308         ["cemetery", "cemetery"],
52309         ["cemetery_christian", "cemetery_christian"],
52310         ["cemetery_buddhist", "cemetery_buddhist"],
52311         ["cemetery_muslim", "cemetery_muslim"],
52312         ["cemetery_jewish", "cemetery_jewish"],
52313         ["farmland", "farmland"],
52314         ["farmyard", "farmyard"],
52315         ["forest", "forest"],
52316         ["forest_broadleaved", "forest_broadleaved"],
52317         ["forest_needleleaved", "forest_needleleaved"],
52318         ["forest_leafless", "forest_leafless"],
52319         ["golf_green", "grass"],
52320         ["grass", "grass"],
52321         ["landfill", "landfill"],
52322         ["meadow", "grass"],
52323         ["orchard", "orchard"],
52324         ["pond", "pond"],
52325         ["quarry", "quarry"],
52326         ["scrub", "bushes"],
52327         ["vineyard", "vineyard"],
52328         ["water_standing", "lines"],
52329         ["waves", "waves"],
52330         ["wetland", "wetland"],
52331         ["wetland_marsh", "wetland_marsh"],
52332         ["wetland_swamp", "wetland_swamp"],
52333         ["wetland_bog", "wetland_bog"],
52334         ["wetland_reedbed", "wetland_reedbed"]
52335       ]).enter().append("pattern").attr("id", function(d2) {
52336         return "ideditor-pattern-" + d2[0];
52337       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
52338       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
52339         return "pattern-color-" + d2[0];
52340       });
52341       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
52342         return context.imagePath("pattern/" + d2[1] + ".png");
52343       });
52344       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
52345         return "ideditor-clip-square-" + d2;
52346       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
52347         return d2;
52348       }).attr("height", function(d2) {
52349         return d2;
52350       });
52351       const filters = _defsSelection.selectAll("filter").data(["alpha-slope5"]).enter().append("filter").attr("id", (d2) => d2);
52352       const alphaSlope5 = filters.filter("#alpha-slope5").append("feComponentTransfer");
52353       alphaSlope5.append("feFuncR").attr("type", "identity");
52354       alphaSlope5.append("feFuncG").attr("type", "identity");
52355       alphaSlope5.append("feFuncB").attr("type", "identity");
52356       alphaSlope5.append("feFuncA").attr("type", "linear").attr("slope", 5);
52357       addSprites(_spritesheetIds, true);
52358     }
52359     function addSprites(ids, overrideColors) {
52360       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
52361       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
52362       spritesheets.enter().append("g").attr("class", function(d2) {
52363         return "spritesheet spritesheet-" + d2;
52364       }).each(function(d2) {
52365         var url = context.imagePath(d2 + ".svg");
52366         var node = select_default2(this).node();
52367         svg(url).then(function(svg2) {
52368           node.appendChild(
52369             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
52370           );
52371           if (overrideColors && d2 !== "iD-sprite") {
52372             select_default2(node).selectAll("path").attr("fill", "currentColor");
52373           }
52374         }).catch(function() {
52375         });
52376       });
52377       spritesheets.exit().remove();
52378     }
52379     drawDefs.addSprites = addSprites;
52380     return drawDefs;
52381   }
52382   var init_defs = __esm({
52383     "modules/svg/defs.js"() {
52384       "use strict";
52385       init_src18();
52386       init_src5();
52387       init_util();
52388     }
52389   });
52390
52391   // modules/svg/keepRight.js
52392   var keepRight_exports2 = {};
52393   __export(keepRight_exports2, {
52394     svgKeepRight: () => svgKeepRight
52395   });
52396   function svgKeepRight(projection2, context, dispatch14) {
52397     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
52398     const minZoom5 = 12;
52399     let touchLayer = select_default2(null);
52400     let drawLayer = select_default2(null);
52401     let layerVisible = false;
52402     function markerPath(selection2, klass) {
52403       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");
52404     }
52405     function getService() {
52406       if (services.keepRight && !_qaService) {
52407         _qaService = services.keepRight;
52408         _qaService.on("loaded", throttledRedraw);
52409       } else if (!services.keepRight && _qaService) {
52410         _qaService = null;
52411       }
52412       return _qaService;
52413     }
52414     function editOn() {
52415       if (!layerVisible) {
52416         layerVisible = true;
52417         drawLayer.style("display", "block");
52418       }
52419     }
52420     function editOff() {
52421       if (layerVisible) {
52422         layerVisible = false;
52423         drawLayer.style("display", "none");
52424         drawLayer.selectAll(".qaItem.keepRight").remove();
52425         touchLayer.selectAll(".qaItem.keepRight").remove();
52426       }
52427     }
52428     function layerOn() {
52429       editOn();
52430       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
52431     }
52432     function layerOff() {
52433       throttledRedraw.cancel();
52434       drawLayer.interrupt();
52435       touchLayer.selectAll(".qaItem.keepRight").remove();
52436       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
52437         editOff();
52438         dispatch14.call("change");
52439       });
52440     }
52441     function updateMarkers() {
52442       if (!layerVisible || !_layerEnabled) return;
52443       const service = getService();
52444       const selectedID = context.selectedErrorID();
52445       const data = service ? service.getItems(projection2) : [];
52446       const getTransform = svgPointTransform(projection2);
52447       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
52448       markers.exit().remove();
52449       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`);
52450       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
52451       markersEnter.append("path").call(markerPath, "shadow");
52452       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");
52453       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
52454       if (touchLayer.empty()) return;
52455       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
52456       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
52457       targets.exit().remove();
52458       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
52459       function sortY(a2, b2) {
52460         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];
52461       }
52462     }
52463     function drawKeepRight(selection2) {
52464       const service = getService();
52465       const surface = context.surface();
52466       if (surface && !surface.empty()) {
52467         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
52468       }
52469       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
52470       drawLayer.exit().remove();
52471       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
52472       if (_layerEnabled) {
52473         if (service && ~~context.map().zoom() >= minZoom5) {
52474           editOn();
52475           service.loadIssues(projection2);
52476           updateMarkers();
52477         } else {
52478           editOff();
52479         }
52480       }
52481     }
52482     drawKeepRight.enabled = function(val) {
52483       if (!arguments.length) return _layerEnabled;
52484       _layerEnabled = val;
52485       if (_layerEnabled) {
52486         layerOn();
52487       } else {
52488         layerOff();
52489         if (context.selectedErrorID()) {
52490           context.enter(modeBrowse(context));
52491         }
52492       }
52493       dispatch14.call("change");
52494       return this;
52495     };
52496     drawKeepRight.supported = () => !!getService();
52497     return drawKeepRight;
52498   }
52499   var _layerEnabled, _qaService;
52500   var init_keepRight2 = __esm({
52501     "modules/svg/keepRight.js"() {
52502       "use strict";
52503       init_throttle();
52504       init_src5();
52505       init_browse();
52506       init_helpers();
52507       init_services();
52508       _layerEnabled = false;
52509     }
52510   });
52511
52512   // modules/svg/geolocate.js
52513   var geolocate_exports = {};
52514   __export(geolocate_exports, {
52515     svgGeolocate: () => svgGeolocate
52516   });
52517   function svgGeolocate(projection2) {
52518     var layer = select_default2(null);
52519     var _position;
52520     function init2() {
52521       if (svgGeolocate.initialized) return;
52522       svgGeolocate.enabled = false;
52523       svgGeolocate.initialized = true;
52524     }
52525     function showLayer() {
52526       layer.style("display", "block");
52527     }
52528     function hideLayer() {
52529       layer.transition().duration(250).style("opacity", 0);
52530     }
52531     function layerOn() {
52532       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
52533     }
52534     function layerOff() {
52535       layer.style("display", "none");
52536     }
52537     function transform2(d2) {
52538       return svgPointTransform(projection2)(d2);
52539     }
52540     function accuracy(accuracy2, loc) {
52541       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
52542       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
52543     }
52544     function update() {
52545       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
52546       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
52547       groups.exit().remove();
52548       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
52549       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");
52550       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");
52551       groups.merge(pointsEnter).attr("transform", transform2);
52552       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
52553     }
52554     function drawLocation(selection2) {
52555       var enabled = svgGeolocate.enabled;
52556       layer = selection2.selectAll(".layer-geolocate").data([0]);
52557       layer.exit().remove();
52558       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
52559       layerEnter.append("g").attr("class", "geolocations");
52560       layer = layerEnter.merge(layer);
52561       if (enabled) {
52562         update();
52563       } else {
52564         layerOff();
52565       }
52566     }
52567     drawLocation.enabled = function(position, enabled) {
52568       if (!arguments.length) return svgGeolocate.enabled;
52569       _position = position;
52570       svgGeolocate.enabled = enabled;
52571       if (svgGeolocate.enabled) {
52572         showLayer();
52573         layerOn();
52574       } else {
52575         hideLayer();
52576       }
52577       return this;
52578     };
52579     init2();
52580     return drawLocation;
52581   }
52582   var init_geolocate = __esm({
52583     "modules/svg/geolocate.js"() {
52584       "use strict";
52585       init_src5();
52586       init_helpers();
52587       init_geo2();
52588     }
52589   });
52590
52591   // modules/svg/labels.js
52592   var labels_exports = {};
52593   __export(labels_exports, {
52594     svgLabels: () => svgLabels
52595   });
52596   function svgLabels(projection2, context) {
52597     var path = path_default(projection2);
52598     var detected = utilDetect();
52599     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
52600     var _rdrawn = new RBush();
52601     var _rskipped = new RBush();
52602     var _textWidthCache = {};
52603     var _entitybboxes = {};
52604     var labelStack = [
52605       ["line", "aeroway", "*", 12],
52606       ["line", "highway", "motorway", 12],
52607       ["line", "highway", "trunk", 12],
52608       ["line", "highway", "primary", 12],
52609       ["line", "highway", "secondary", 12],
52610       ["line", "highway", "tertiary", 12],
52611       ["line", "highway", "*", 12],
52612       ["line", "railway", "*", 12],
52613       ["line", "waterway", "*", 12],
52614       ["area", "aeroway", "*", 12],
52615       ["area", "amenity", "*", 12],
52616       ["area", "building", "*", 12],
52617       ["area", "historic", "*", 12],
52618       ["area", "leisure", "*", 12],
52619       ["area", "man_made", "*", 12],
52620       ["area", "natural", "*", 12],
52621       ["area", "shop", "*", 12],
52622       ["area", "tourism", "*", 12],
52623       ["area", "camp_site", "*", 12],
52624       ["point", "aeroway", "*", 10],
52625       ["point", "amenity", "*", 10],
52626       ["point", "building", "*", 10],
52627       ["point", "historic", "*", 10],
52628       ["point", "leisure", "*", 10],
52629       ["point", "man_made", "*", 10],
52630       ["point", "natural", "*", 10],
52631       ["point", "shop", "*", 10],
52632       ["point", "tourism", "*", 10],
52633       ["point", "camp_site", "*", 10],
52634       ["line", "ref", "*", 12],
52635       ["area", "ref", "*", 12],
52636       ["point", "ref", "*", 10],
52637       ["line", "name", "*", 12],
52638       ["area", "name", "*", 12],
52639       ["point", "name", "*", 10]
52640     ];
52641     function shouldSkipIcon(preset) {
52642       var noIcons = ["building", "landuse", "natural"];
52643       return noIcons.some(function(s2) {
52644         return preset.id.indexOf(s2) >= 0;
52645       });
52646     }
52647     function get4(array2, prop) {
52648       return function(d2, i3) {
52649         return array2[i3][prop];
52650       };
52651     }
52652     function textWidth(text, size, elem) {
52653       var c2 = _textWidthCache[size];
52654       if (!c2) c2 = _textWidthCache[size] = {};
52655       if (c2[text]) {
52656         return c2[text];
52657       } else if (elem) {
52658         c2[text] = elem.getComputedTextLength();
52659         return c2[text];
52660       } else {
52661         var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
52662         if (str === null) {
52663           return size / 3 * 2 * text.length;
52664         } else {
52665           return size / 3 * (2 * text.length + str.length);
52666         }
52667       }
52668     }
52669     function drawLinePaths(selection2, entities, filter2, classes, labels) {
52670       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
52671       paths.exit().remove();
52672       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
52673         return "ideditor-labelpath-" + d2.id;
52674       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
52675     }
52676     function drawLineLabels(selection2, entities, filter2, classes, labels) {
52677       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
52678       texts.exit().remove();
52679       texts.enter().append("text").attr("class", function(d2, i3) {
52680         return classes + " " + labels[i3].classes + " " + d2.id;
52681       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
52682       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
52683         return "#ideditor-labelpath-" + d2.id;
52684       }).text(utilDisplayNameForPath);
52685     }
52686     function drawPointLabels(selection2, entities, filter2, classes, labels) {
52687       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
52688       texts.exit().remove();
52689       texts.enter().append("text").attr("class", function(d2, i3) {
52690         return classes + " " + labels[i3].classes + " " + d2.id;
52691       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
52692         textWidth(utilDisplayName(d2), labels[i3].height, this);
52693       });
52694     }
52695     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
52696       entities = entities.filter(hasText);
52697       labels = labels.filter(hasText);
52698       drawPointLabels(selection2, entities, filter2, classes, labels);
52699       function hasText(d2, i3) {
52700         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
52701       }
52702     }
52703     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
52704       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
52705       icons.exit().remove();
52706       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) {
52707         var preset = _mainPresetIndex.match(d2, context.graph());
52708         var picon = preset && preset.icon;
52709         return picon ? "#" + picon : "";
52710       });
52711     }
52712     function drawCollisionBoxes(selection2, rtree, which) {
52713       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
52714       var gj = [];
52715       if (context.getDebug("collision")) {
52716         gj = rtree.all().map(function(d2) {
52717           return { type: "Polygon", coordinates: [[
52718             [d2.minX, d2.minY],
52719             [d2.maxX, d2.minY],
52720             [d2.maxX, d2.maxY],
52721             [d2.minX, d2.maxY],
52722             [d2.minX, d2.minY]
52723           ]] };
52724         });
52725       }
52726       var boxes = selection2.selectAll("." + which).data(gj);
52727       boxes.exit().remove();
52728       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
52729     }
52730     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
52731       var wireframe = context.surface().classed("fill-wireframe");
52732       var zoom = geoScaleToZoom(projection2.scale());
52733       var labelable = [];
52734       var renderNodeAs = {};
52735       var i3, j2, k2, entity, geometry;
52736       for (i3 = 0; i3 < labelStack.length; i3++) {
52737         labelable.push([]);
52738       }
52739       if (fullRedraw) {
52740         _rdrawn.clear();
52741         _rskipped.clear();
52742         _entitybboxes = {};
52743       } else {
52744         for (i3 = 0; i3 < entities.length; i3++) {
52745           entity = entities[i3];
52746           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
52747           for (j2 = 0; j2 < toRemove.length; j2++) {
52748             _rdrawn.remove(toRemove[j2]);
52749             _rskipped.remove(toRemove[j2]);
52750           }
52751         }
52752       }
52753       for (i3 = 0; i3 < entities.length; i3++) {
52754         entity = entities[i3];
52755         geometry = entity.geometry(graph);
52756         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
52757           var hasDirections = entity.directions(graph, projection2).length;
52758           var markerPadding;
52759           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
52760             renderNodeAs[entity.id] = "point";
52761             markerPadding = 20;
52762           } else {
52763             renderNodeAs[entity.id] = "vertex";
52764             markerPadding = 0;
52765           }
52766           var coord2 = projection2(entity.loc);
52767           var nodePadding = 10;
52768           var bbox2 = {
52769             minX: coord2[0] - nodePadding,
52770             minY: coord2[1] - nodePadding - markerPadding,
52771             maxX: coord2[0] + nodePadding,
52772             maxY: coord2[1] + nodePadding
52773           };
52774           doInsert(bbox2, entity.id + "P");
52775         }
52776         if (geometry === "vertex") {
52777           geometry = "point";
52778         }
52779         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
52780         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
52781         if (!icon2 && !utilDisplayName(entity)) continue;
52782         for (k2 = 0; k2 < labelStack.length; k2++) {
52783           var matchGeom = labelStack[k2][0];
52784           var matchKey = labelStack[k2][1];
52785           var matchVal = labelStack[k2][2];
52786           var hasVal = entity.tags[matchKey];
52787           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
52788             labelable[k2].push(entity);
52789             break;
52790           }
52791         }
52792       }
52793       var positions = {
52794         point: [],
52795         line: [],
52796         area: []
52797       };
52798       var labelled = {
52799         point: [],
52800         line: [],
52801         area: []
52802       };
52803       for (k2 = 0; k2 < labelable.length; k2++) {
52804         var fontSize = labelStack[k2][3];
52805         for (i3 = 0; i3 < labelable[k2].length; i3++) {
52806           entity = labelable[k2][i3];
52807           geometry = entity.geometry(graph);
52808           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
52809           var name = getName(entity);
52810           var width = name && textWidth(name, fontSize);
52811           var p2 = null;
52812           if (geometry === "point" || geometry === "vertex") {
52813             if (wireframe) continue;
52814             var renderAs = renderNodeAs[entity.id];
52815             if (renderAs === "vertex" && zoom < 17) continue;
52816             p2 = getPointLabel(entity, width, fontSize, renderAs);
52817           } else if (geometry === "line") {
52818             p2 = getLineLabel(entity, width, fontSize);
52819           } else if (geometry === "area") {
52820             p2 = getAreaLabel(entity, width, fontSize);
52821           }
52822           if (p2) {
52823             if (geometry === "vertex") {
52824               geometry = "point";
52825             }
52826             p2.classes = geometry + " tag-" + labelStack[k2][1];
52827             positions[geometry].push(p2);
52828             labelled[geometry].push(entity);
52829           }
52830         }
52831       }
52832       function isInterestingVertex(entity2) {
52833         var selectedIDs = context.selectedIDs();
52834         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
52835           return selectedIDs.indexOf(parent.id) !== -1;
52836         });
52837       }
52838       function getPointLabel(entity2, width2, height, geometry2) {
52839         var y2 = geometry2 === "point" ? -12 : 0;
52840         var pointOffsets = {
52841           ltr: [15, y2, "start"],
52842           rtl: [-15, y2, "end"]
52843         };
52844         var textDirection = _mainLocalizer.textDirection();
52845         var coord3 = projection2(entity2.loc);
52846         var textPadding = 2;
52847         var offset = pointOffsets[textDirection];
52848         var p3 = {
52849           height,
52850           width: width2,
52851           x: coord3[0] + offset[0],
52852           y: coord3[1] + offset[1],
52853           textAnchor: offset[2]
52854         };
52855         var bbox3;
52856         if (textDirection === "rtl") {
52857           bbox3 = {
52858             minX: p3.x - width2 - textPadding,
52859             minY: p3.y - height / 2 - textPadding,
52860             maxX: p3.x + textPadding,
52861             maxY: p3.y + height / 2 + textPadding
52862           };
52863         } else {
52864           bbox3 = {
52865             minX: p3.x - textPadding,
52866             minY: p3.y - height / 2 - textPadding,
52867             maxX: p3.x + width2 + textPadding,
52868             maxY: p3.y + height / 2 + textPadding
52869           };
52870         }
52871         if (tryInsert([bbox3], entity2.id, true)) {
52872           return p3;
52873         }
52874       }
52875       function getLineLabel(entity2, width2, height) {
52876         var viewport = geoExtent(context.projection.clipExtent()).polygon();
52877         var points = graph.childNodes(entity2).map(function(node) {
52878           return projection2(node.loc);
52879         });
52880         var length2 = geoPathLength(points);
52881         if (length2 < width2 + 20) return;
52882         var lineOffsets = [
52883           50,
52884           45,
52885           55,
52886           40,
52887           60,
52888           35,
52889           65,
52890           30,
52891           70,
52892           25,
52893           75,
52894           20,
52895           80,
52896           15,
52897           95,
52898           10,
52899           90,
52900           5,
52901           95
52902         ];
52903         var padding = 3;
52904         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
52905           var offset = lineOffsets[i4];
52906           var middle = offset / 100 * length2;
52907           var start2 = middle - width2 / 2;
52908           if (start2 < 0 || start2 + width2 > length2) continue;
52909           var sub = subpath(points, start2, start2 + width2);
52910           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
52911             continue;
52912           }
52913           var isReverse = reverse(sub);
52914           if (isReverse) {
52915             sub = sub.reverse();
52916           }
52917           var bboxes = [];
52918           var boxsize = (height + 2) / 2;
52919           for (var j3 = 0; j3 < sub.length - 1; j3++) {
52920             var a2 = sub[j3];
52921             var b2 = sub[j3 + 1];
52922             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
52923             for (var box = 0; box < num; box++) {
52924               var p3 = geoVecInterp(a2, b2, box / num);
52925               var x05 = p3[0] - boxsize - padding;
52926               var y05 = p3[1] - boxsize - padding;
52927               var x12 = p3[0] + boxsize + padding;
52928               var y12 = p3[1] + boxsize + padding;
52929               bboxes.push({
52930                 minX: Math.min(x05, x12),
52931                 minY: Math.min(y05, y12),
52932                 maxX: Math.max(x05, x12),
52933                 maxY: Math.max(y05, y12)
52934               });
52935             }
52936           }
52937           if (tryInsert(bboxes, entity2.id, false)) {
52938             return {
52939               "font-size": height + 2,
52940               lineString: lineString2(sub),
52941               startOffset: offset + "%"
52942             };
52943           }
52944         }
52945         function reverse(p4) {
52946           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
52947           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
52948         }
52949         function lineString2(points2) {
52950           return "M" + points2.join("L");
52951         }
52952         function subpath(points2, from, to) {
52953           var sofar = 0;
52954           var start3, end, i0, i1;
52955           for (var i5 = 0; i5 < points2.length - 1; i5++) {
52956             var a3 = points2[i5];
52957             var b3 = points2[i5 + 1];
52958             var current = geoVecLength(a3, b3);
52959             var portion;
52960             if (!start3 && sofar + current >= from) {
52961               portion = (from - sofar) / current;
52962               start3 = [
52963                 a3[0] + portion * (b3[0] - a3[0]),
52964                 a3[1] + portion * (b3[1] - a3[1])
52965               ];
52966               i0 = i5 + 1;
52967             }
52968             if (!end && sofar + current >= to) {
52969               portion = (to - sofar) / current;
52970               end = [
52971                 a3[0] + portion * (b3[0] - a3[0]),
52972                 a3[1] + portion * (b3[1] - a3[1])
52973               ];
52974               i1 = i5 + 1;
52975             }
52976             sofar += current;
52977           }
52978           var result = points2.slice(i0, i1);
52979           result.unshift(start3);
52980           result.push(end);
52981           return result;
52982         }
52983       }
52984       function getAreaLabel(entity2, width2, height) {
52985         var centroid = path.centroid(entity2.asGeoJSON(graph));
52986         var extent = entity2.extent(graph);
52987         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
52988         if (isNaN(centroid[0]) || areaWidth < 20) return;
52989         var preset2 = _mainPresetIndex.match(entity2, context.graph());
52990         var picon = preset2 && preset2.icon;
52991         var iconSize = 17;
52992         var padding = 2;
52993         var p3 = {};
52994         if (picon) {
52995           if (addIcon()) {
52996             addLabel(iconSize + padding);
52997             return p3;
52998           }
52999         } else {
53000           if (addLabel(0)) {
53001             return p3;
53002           }
53003         }
53004         function addIcon() {
53005           var iconX = centroid[0] - iconSize / 2;
53006           var iconY = centroid[1] - iconSize / 2;
53007           var bbox3 = {
53008             minX: iconX,
53009             minY: iconY,
53010             maxX: iconX + iconSize,
53011             maxY: iconY + iconSize
53012           };
53013           if (tryInsert([bbox3], entity2.id + "I", true)) {
53014             p3.transform = "translate(" + iconX + "," + iconY + ")";
53015             return true;
53016           }
53017           return false;
53018         }
53019         function addLabel(yOffset) {
53020           if (width2 && areaWidth >= width2 + 20) {
53021             var labelX = centroid[0];
53022             var labelY = centroid[1] + yOffset;
53023             var bbox3 = {
53024               minX: labelX - width2 / 2 - padding,
53025               minY: labelY - height / 2 - padding,
53026               maxX: labelX + width2 / 2 + padding,
53027               maxY: labelY + height / 2 + padding
53028             };
53029             if (tryInsert([bbox3], entity2.id, true)) {
53030               p3.x = labelX;
53031               p3.y = labelY;
53032               p3.textAnchor = "middle";
53033               p3.height = height;
53034               return true;
53035             }
53036           }
53037           return false;
53038         }
53039       }
53040       function doInsert(bbox3, id2) {
53041         bbox3.id = id2;
53042         var oldbox = _entitybboxes[id2];
53043         if (oldbox) {
53044           _rdrawn.remove(oldbox);
53045         }
53046         _entitybboxes[id2] = bbox3;
53047         _rdrawn.insert(bbox3);
53048       }
53049       function tryInsert(bboxes, id2, saveSkipped) {
53050         var skipped = false;
53051         for (var i4 = 0; i4 < bboxes.length; i4++) {
53052           var bbox3 = bboxes[i4];
53053           bbox3.id = id2;
53054           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
53055             skipped = true;
53056             break;
53057           }
53058           if (_rdrawn.collides(bbox3)) {
53059             skipped = true;
53060             break;
53061           }
53062         }
53063         _entitybboxes[id2] = bboxes;
53064         if (skipped) {
53065           if (saveSkipped) {
53066             _rskipped.load(bboxes);
53067           }
53068         } else {
53069           _rdrawn.load(bboxes);
53070         }
53071         return !skipped;
53072       }
53073       var layer = selection2.selectAll(".layer-osm.labels");
53074       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
53075         return "labels-group " + d2;
53076       });
53077       var halo = layer.selectAll(".labels-group.halo");
53078       var label = layer.selectAll(".labels-group.label");
53079       var debug2 = layer.selectAll(".labels-group.debug");
53080       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
53081       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
53082       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
53083       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
53084       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
53085       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
53086       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
53087       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
53088       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
53089       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
53090       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
53091       layer.call(filterLabels);
53092     }
53093     function filterLabels(selection2) {
53094       var drawLayer = selection2.selectAll(".layer-osm.labels");
53095       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
53096       layers.selectAll(".nolabel").classed("nolabel", false);
53097       var mouse = context.map().mouse();
53098       var graph = context.graph();
53099       var selectedIDs = context.selectedIDs();
53100       var ids = [];
53101       var pad3, bbox2;
53102       if (mouse) {
53103         pad3 = 20;
53104         bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
53105         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
53106           return entity2.id;
53107         });
53108         ids.push.apply(ids, nearMouse);
53109       }
53110       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
53111         var entity = graph.hasEntity(selectedIDs[i3]);
53112         if (entity && entity.type === "node") {
53113           ids.push(selectedIDs[i3]);
53114         }
53115       }
53116       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
53117       var debug2 = selection2.selectAll(".labels-group.debug");
53118       var gj = [];
53119       if (context.getDebug("collision")) {
53120         gj = bbox2 ? [{
53121           type: "Polygon",
53122           coordinates: [[
53123             [bbox2.minX, bbox2.minY],
53124             [bbox2.maxX, bbox2.minY],
53125             [bbox2.maxX, bbox2.maxY],
53126             [bbox2.minX, bbox2.maxY],
53127             [bbox2.minX, bbox2.minY]
53128           ]]
53129         }] : [];
53130       }
53131       var box = debug2.selectAll(".debug-mouse").data(gj);
53132       box.exit().remove();
53133       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
53134     }
53135     var throttleFilterLabels = throttle_default(filterLabels, 100);
53136     drawLabels.observe = function(selection2) {
53137       var listener = function() {
53138         throttleFilterLabels(selection2);
53139       };
53140       selection2.on("mousemove.hidelabels", listener);
53141       context.on("enter.hidelabels", listener);
53142     };
53143     drawLabels.off = function(selection2) {
53144       throttleFilterLabels.cancel();
53145       selection2.on("mousemove.hidelabels", null);
53146       context.on("enter.hidelabels", null);
53147     };
53148     return drawLabels;
53149   }
53150   var init_labels = __esm({
53151     "modules/svg/labels.js"() {
53152       "use strict";
53153       init_throttle();
53154       init_src2();
53155       init_rbush();
53156       init_localizer();
53157       init_geo2();
53158       init_presets();
53159       init_osm();
53160       init_detect();
53161       init_util();
53162     }
53163   });
53164
53165   // node_modules/exifr/dist/full.esm.mjs
53166   function l(e3, t2 = o) {
53167     if (n2) try {
53168       return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
53169         /* webpackIgnore: true */
53170         e3
53171       ).then(t2);
53172     } catch (t3) {
53173       console.warn(`Couldn't load ${e3}`);
53174     }
53175   }
53176   function c(e3, t2, i3) {
53177     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
53178   }
53179   function p(e3) {
53180     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
53181   }
53182   function g2(e3) {
53183     let t2 = new Error(e3);
53184     throw delete t2.stack, t2;
53185   }
53186   function m(e3) {
53187     return "" === (e3 = function(e4) {
53188       for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
53189       return e4;
53190     }(e3).trim()) ? void 0 : e3;
53191   }
53192   function S(e3) {
53193     let t2 = function(e4) {
53194       let t3 = 0;
53195       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;
53196     }(e3);
53197     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
53198   }
53199   function b(e3) {
53200     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
53201   }
53202   function P(e3, t2) {
53203     g2(`${e3} '${t2}' was not loaded, try using full build of exifr.`);
53204   }
53205   function D(e3, n3) {
53206     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");
53207   }
53208   function O(e3, i3) {
53209     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");
53210     var s2;
53211   }
53212   async function x(e3, t2, i3, n3) {
53213     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
53214       let i4 = await t3(e4);
53215       return new I(i4);
53216     }(e3, n3) : void g2(`Parser ${i3} is not loaded`);
53217   }
53218   async function v(e3, t2, i3) {
53219     let n3 = new (A.get(i3))(e3, t2);
53220     return await n3.read(), n3;
53221   }
53222   function U(e3, t2, i3) {
53223     let n3 = new L();
53224     for (let [e4, t3] of i3) n3.set(e4, t3);
53225     if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
53226     else e3.set(t2, n3);
53227     return n3;
53228   }
53229   function F(e3, t2, i3) {
53230     let n3, s2 = e3.get(t2);
53231     for (n3 of i3) s2.set(n3[0], n3[1]);
53232   }
53233   function Q(e3, t2) {
53234     let i3, n3, s2, r2, a2 = [];
53235     for (s2 of t2) {
53236       for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
53237       n3.length && a2.push([s2, n3]);
53238     }
53239     return a2;
53240   }
53241   function Z(e3, t2) {
53242     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
53243   }
53244   function ee(e3, t2) {
53245     for (let i3 of t2) e3.add(i3);
53246   }
53247   async function ie(e3, t2) {
53248     let i3 = new te(t2);
53249     return await i3.read(e3), i3.parse();
53250   }
53251   function ae(e3) {
53252     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
53253   }
53254   function oe(e3) {
53255     return e3 >= 224 && e3 <= 239;
53256   }
53257   function le(e3, t2, i3) {
53258     for (let [n3, s2] of T) if (s2.canHandle(e3, t2, i3)) return n3;
53259   }
53260   function de(e3, t2, i3, n3) {
53261     var s2 = e3 + t2 / 60 + i3 / 3600;
53262     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
53263   }
53264   async function Se(e3) {
53265     let t2 = new te(me);
53266     await t2.read(e3);
53267     let i3 = await t2.parse();
53268     if (i3 && i3.gps) {
53269       let { latitude: e4, longitude: t3 } = i3.gps;
53270       return { latitude: e4, longitude: t3 };
53271     }
53272   }
53273   async function ye(e3) {
53274     let t2 = new te(Ce);
53275     await t2.read(e3);
53276     let i3 = await t2.extractThumbnail();
53277     return i3 && a ? s.from(i3) : i3;
53278   }
53279   async function be(e3) {
53280     let t2 = await this.thumbnail(e3);
53281     if (void 0 !== t2) {
53282       let e4 = new Blob([t2]);
53283       return URL.createObjectURL(e4);
53284     }
53285   }
53286   async function Pe(e3) {
53287     let t2 = new te(Ie);
53288     await t2.read(e3);
53289     let i3 = await t2.parse();
53290     if (i3 && i3.ifd0) return i3.ifd0[274];
53291   }
53292   async function Ae(e3) {
53293     let t2 = await Pe(e3);
53294     return Object.assign({ canvas: we, css: Te }, ke[t2]);
53295   }
53296   function xe(e3, t2, i3) {
53297     return e3 <= t2 && t2 <= i3;
53298   }
53299   function Ge(e3) {
53300     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
53301   }
53302   function Ve(e3) {
53303     let t2 = Array.from(e3).slice(1);
53304     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
53305   }
53306   function ze(e3) {
53307     if ("string" == typeof e3) {
53308       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
53309       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
53310     }
53311   }
53312   function He(e3) {
53313     if ("string" == typeof e3) return e3;
53314     let t2 = [];
53315     if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3 + 1], e3[i3]));
53316     else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3], e3[i3 + 1]));
53317     return m(String.fromCodePoint(...t2));
53318   }
53319   function je(e3, t2) {
53320     return e3 << 8 | t2;
53321   }
53322   function _e(e3, t2) {
53323     let i3 = e3.serialize();
53324     void 0 !== i3 && (t2[e3.name] = i3);
53325   }
53326   function qe(e3, t2) {
53327     let i3, n3 = [];
53328     if (!e3) return n3;
53329     for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
53330     return n3;
53331   }
53332   function Qe(e3) {
53333     if (function(e4) {
53334       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
53335     }(e3)) return;
53336     let t2 = Number(e3);
53337     if (!Number.isNaN(t2)) return t2;
53338     let i3 = e3.toLowerCase();
53339     return "true" === i3 || "false" !== i3 && e3.trim();
53340   }
53341   function mt(e3, t2) {
53342     return m(e3.getString(t2, 4));
53343   }
53344   var e, t, i2, n2, s, r, a, o, h, u, f, d, C, y, I, k, w, T, A, M, R, L, E, B, N, G, V, z, H, j, W, K, X, _, Y, $2, J, q, te, ne, se, re2, he, ue, ce, fe, pe, ge, me, Ce, Ie, ke, we, Te, De, Oe, ve, Me, Re, Le, Ue, Fe, Ee, Be, Ne, We, Ke, Xe, Ye, $e, Je, Ze, et, tt, at, ot, lt, ht, ut, ct, ft, dt, pt, gt, St, Ct, yt, full_esm_default;
53345   var init_full_esm = __esm({
53346     "node_modules/exifr/dist/full.esm.mjs"() {
53347       e = "undefined" != typeof self ? self : global;
53348       t = "undefined" != typeof navigator;
53349       i2 = t && "undefined" == typeof HTMLImageElement;
53350       n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
53351       s = e.Buffer;
53352       r = e.BigInt;
53353       a = !!s;
53354       o = (e3) => e3;
53355       h = e.fetch;
53356       u = (e3) => h = e3;
53357       if (!e.fetch) {
53358         const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
53359           let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
53360           const f2 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
53361           "" !== o2 && (f2.port = Number(o2));
53362           const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
53363             if (301 === e4.statusCode || 302 === e4.statusCode) {
53364               let t3 = new URL(e4.headers.location, n3).toString();
53365               return i3(t3, { headers: s2 }).then(r2).catch(a2);
53366             }
53367             r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
53368               let i4 = [];
53369               e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
53370             }) });
53371           });
53372           d2.on("error", a2), d2.end();
53373         });
53374         u(i3);
53375       }
53376       f = (e3) => p(e3) ? void 0 : e3;
53377       d = (e3) => void 0 !== e3;
53378       C = (e3) => String.fromCharCode.apply(null, e3);
53379       y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
53380       I = class _I {
53381         static from(e3, t2) {
53382           return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
53383         }
53384         constructor(e3, t2 = 0, i3, n3) {
53385           if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
53386           else if (e3 instanceof ArrayBuffer) {
53387             void 0 === i3 && (i3 = e3.byteLength - t2);
53388             let n4 = new DataView(e3, t2, i3);
53389             this._swapDataView(n4);
53390           } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
53391             void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
53392             let n4 = new DataView(e3.buffer, t2, i3);
53393             this._swapDataView(n4);
53394           } else if ("number" == typeof e3) {
53395             let t3 = new DataView(new ArrayBuffer(e3));
53396             this._swapDataView(t3);
53397           } else g2("Invalid input argument for BufferView: " + e3);
53398         }
53399         _swapArrayBuffer(e3) {
53400           this._swapDataView(new DataView(e3));
53401         }
53402         _swapBuffer(e3) {
53403           this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
53404         }
53405         _swapDataView(e3) {
53406           this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
53407         }
53408         _lengthToEnd(e3) {
53409           return this.byteLength - e3;
53410         }
53411         set(e3, t2, i3 = _I) {
53412           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);
53413         }
53414         subarray(e3, t2) {
53415           return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
53416         }
53417         toUint8() {
53418           return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
53419         }
53420         getUint8Array(e3, t2) {
53421           return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
53422         }
53423         getString(e3 = 0, t2 = this.byteLength) {
53424           return b(this.getUint8Array(e3, t2));
53425         }
53426         getLatin1String(e3 = 0, t2 = this.byteLength) {
53427           let i3 = this.getUint8Array(e3, t2);
53428           return C(i3);
53429         }
53430         getUnicodeString(e3 = 0, t2 = this.byteLength) {
53431           const i3 = [];
53432           for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
53433           return C(i3);
53434         }
53435         getInt8(e3) {
53436           return this.dataView.getInt8(e3);
53437         }
53438         getUint8(e3) {
53439           return this.dataView.getUint8(e3);
53440         }
53441         getInt16(e3, t2 = this.le) {
53442           return this.dataView.getInt16(e3, t2);
53443         }
53444         getInt32(e3, t2 = this.le) {
53445           return this.dataView.getInt32(e3, t2);
53446         }
53447         getUint16(e3, t2 = this.le) {
53448           return this.dataView.getUint16(e3, t2);
53449         }
53450         getUint32(e3, t2 = this.le) {
53451           return this.dataView.getUint32(e3, t2);
53452         }
53453         getFloat32(e3, t2 = this.le) {
53454           return this.dataView.getFloat32(e3, t2);
53455         }
53456         getFloat64(e3, t2 = this.le) {
53457           return this.dataView.getFloat64(e3, t2);
53458         }
53459         getFloat(e3, t2 = this.le) {
53460           return this.dataView.getFloat32(e3, t2);
53461         }
53462         getDouble(e3, t2 = this.le) {
53463           return this.dataView.getFloat64(e3, t2);
53464         }
53465         getUintBytes(e3, t2, i3) {
53466           switch (t2) {
53467             case 1:
53468               return this.getUint8(e3, i3);
53469             case 2:
53470               return this.getUint16(e3, i3);
53471             case 4:
53472               return this.getUint32(e3, i3);
53473             case 8:
53474               return this.getUint64 && this.getUint64(e3, i3);
53475           }
53476         }
53477         getUint(e3, t2, i3) {
53478           switch (t2) {
53479             case 8:
53480               return this.getUint8(e3, i3);
53481             case 16:
53482               return this.getUint16(e3, i3);
53483             case 32:
53484               return this.getUint32(e3, i3);
53485             case 64:
53486               return this.getUint64 && this.getUint64(e3, i3);
53487           }
53488         }
53489         toString(e3) {
53490           return this.dataView.toString(e3, this.constructor.name);
53491         }
53492         ensureChunk() {
53493         }
53494       };
53495       k = class extends Map {
53496         constructor(e3) {
53497           super(), this.kind = e3;
53498         }
53499         get(e3, t2) {
53500           return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
53501             g2(`Unknown ${e4} '${t3}'.`);
53502           }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
53503         }
53504         keyList() {
53505           return Array.from(this.keys());
53506         }
53507       };
53508       w = new k("file parser");
53509       T = new k("segment parser");
53510       A = new k("file reader");
53511       M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
53512       R = (e3) => new Promise((t2, i3) => {
53513         let n3 = new FileReader();
53514         n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
53515       });
53516       L = class extends Map {
53517         get tagKeys() {
53518           return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
53519         }
53520         get tagValues() {
53521           return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
53522         }
53523       };
53524       E = /* @__PURE__ */ new Map();
53525       B = /* @__PURE__ */ new Map();
53526       N = /* @__PURE__ */ new Map();
53527       G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
53528       V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
53529       z = ["tiff", ...V];
53530       H = ["ifd0", "ifd1", "exif", "gps", "interop"];
53531       j = [...z, ...H];
53532       W = ["makerNote", "userComment"];
53533       K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
53534       X = [...K, "sanitize", "mergeOutput", "silentErrors"];
53535       _ = class {
53536         get translate() {
53537           return this.translateKeys || this.translateValues || this.reviveValues;
53538         }
53539       };
53540       Y = class extends _ {
53541         get needed() {
53542           return this.enabled || this.deps.size > 0;
53543         }
53544         constructor(e3, t2, i3, n3) {
53545           if (super(), c(this, "enabled", false), c(this, "skip", /* @__PURE__ */ new Set()), c(this, "pick", /* @__PURE__ */ new Set()), c(this, "deps", /* @__PURE__ */ new Set()), c(this, "translateKeys", false), c(this, "translateValues", false), c(this, "reviveValues", false), this.key = e3, this.enabled = t2, this.parse = this.enabled, this.applyInheritables(n3), this.canBeFiltered = H.includes(e3), this.canBeFiltered && (this.dict = E.get(e3)), void 0 !== i3) if (Array.isArray(i3)) this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
53546           else if ("object" == typeof i3) {
53547             if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
53548               let { pick: e4, skip: t3 } = i3;
53549               e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
53550             }
53551             this.applyInheritables(i3);
53552           } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2(`Invalid options argument: ${i3}`);
53553         }
53554         applyInheritables(e3) {
53555           let t2, i3;
53556           for (t2 of K) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
53557         }
53558         translateTagSet(e3, t2) {
53559           if (this.dict) {
53560             let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
53561             for (i3 of e3) "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
53562           } else for (let i3 of e3) t2.add(i3);
53563         }
53564         finalizeFilters() {
53565           !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);
53566         }
53567       };
53568       $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 };
53569       J = /* @__PURE__ */ new Map();
53570       q = class extends _ {
53571         static useCached(e3) {
53572           let t2 = J.get(e3);
53573           return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
53574         }
53575         constructor(e3) {
53576           super(), true === e3 ? this.setupFromTrue() : void 0 === e3 ? this.setupFromUndefined() : Array.isArray(e3) ? this.setupFromArray(e3) : "object" == typeof e3 ? this.setupFromObject(e3) : g2(`Invalid options argument ${e3}`), void 0 === this.firstChunkSize && (this.firstChunkSize = t ? this.firstChunkSizeBrowser : this.firstChunkSizeNode), this.mergeOutput && (this.ifd1.enabled = false), this.filterNestedSegmentTags(), this.traverseTiffDependencyTree(), this.checkLoadedPlugins();
53577         }
53578         setupFromUndefined() {
53579           let e3;
53580           for (e3 of G) this[e3] = $2[e3];
53581           for (e3 of X) this[e3] = $2[e3];
53582           for (e3 of W) this[e3] = $2[e3];
53583           for (e3 of j) this[e3] = new Y(e3, $2[e3], void 0, this);
53584         }
53585         setupFromTrue() {
53586           let e3;
53587           for (e3 of G) this[e3] = $2[e3];
53588           for (e3 of X) this[e3] = $2[e3];
53589           for (e3 of W) this[e3] = true;
53590           for (e3 of j) this[e3] = new Y(e3, true, void 0, this);
53591         }
53592         setupFromArray(e3) {
53593           let t2;
53594           for (t2 of G) this[t2] = $2[t2];
53595           for (t2 of X) this[t2] = $2[t2];
53596           for (t2 of W) this[t2] = $2[t2];
53597           for (t2 of j) this[t2] = new Y(t2, false, void 0, this);
53598           this.setupGlobalFilters(e3, void 0, H);
53599         }
53600         setupFromObject(e3) {
53601           let t2;
53602           for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $2[t2]);
53603           for (t2 of X) this[t2] = Z(e3[t2], $2[t2]);
53604           for (t2 of W) this[t2] = Z(e3[t2], $2[t2]);
53605           for (t2 of z) this[t2] = new Y(t2, $2[t2], e3[t2], this);
53606           for (t2 of H) this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
53607           this.setupGlobalFilters(e3.pick, e3.skip, H, j), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
53608         }
53609         batchEnableWithBool(e3, t2) {
53610           for (let i3 of e3) this[i3].enabled = t2;
53611         }
53612         batchEnableWithUserValue(e3, t2) {
53613           for (let i3 of e3) {
53614             let e4 = t2[i3];
53615             this[i3].enabled = false !== e4 && void 0 !== e4;
53616           }
53617         }
53618         setupGlobalFilters(e3, t2, i3, n3 = i3) {
53619           if (e3 && e3.length) {
53620             for (let e4 of n3) this[e4].enabled = false;
53621             let t3 = Q(e3, i3);
53622             for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
53623           } else if (t2 && t2.length) {
53624             let e4 = Q(t2, i3);
53625             for (let [t3, i4] of e4) ee(this[t3].skip, i4);
53626           }
53627         }
53628         filterNestedSegmentTags() {
53629           let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
53630           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);
53631         }
53632         traverseTiffDependencyTree() {
53633           let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
53634           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;
53635           for (let e4 of H) this[e4].finalizeFilters();
53636         }
53637         get onlyTiff() {
53638           return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
53639         }
53640         checkLoadedPlugins() {
53641           for (let e3 of z) this[e3].enabled && !T.has(e3) && P("segment parser", e3);
53642         }
53643       };
53644       c(q, "default", $2);
53645       te = class {
53646         constructor(e3) {
53647           c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
53648         }
53649         async read(e3) {
53650           this.file = await D(e3, this.options);
53651         }
53652         setup() {
53653           if (this.fileParser) return;
53654           let { file: e3 } = this, t2 = e3.getUint16(0);
53655           for (let [i3, n3] of w) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
53656           this.file.close && this.file.close(), g2("Unknown file format");
53657         }
53658         async parse() {
53659           let { output: e3, errors: t2 } = this;
53660           return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f(e3);
53661         }
53662         async executeParsers() {
53663           let { output: e3 } = this;
53664           await this.fileParser.parse();
53665           let t2 = Object.values(this.parsers).map(async (t3) => {
53666             let i3 = await t3.parse();
53667             t3.assignToOutput(e3, i3);
53668           });
53669           this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
53670         }
53671         async extractThumbnail() {
53672           this.setup();
53673           let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
53674           var n3;
53675           if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
53676           let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
53677           return t2.close && t2.close(), a2;
53678         }
53679       };
53680       ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
53681       se = class {
53682         constructor(e3, t2, i3) {
53683           c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
53684             let t3 = e4.start, i4 = e4.size || 65536;
53685             if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
53686             else try {
53687               e4.chunk = await this.file.readChunk(t3, i4);
53688             } catch (t4) {
53689               g2(`Couldn't read segment: ${JSON.stringify(e4)}. ${t4.message}`);
53690             }
53691             else this.file.byteLength > t3 + i4 ? e4.chunk = this.file.subarray(t3, i4) : void 0 === e4.size ? e4.chunk = this.file.subarray(t3) : g2("Segment unreachable: " + JSON.stringify(e4));
53692             return e4.chunk;
53693           }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
53694         }
53695         injectSegment(e3, t2) {
53696           this.options[e3].enabled && this.createParser(e3, t2);
53697         }
53698         createParser(e3, t2) {
53699           let i3 = new (T.get(e3))(t2, this.options, this.file);
53700           return this.parsers[e3] = i3;
53701         }
53702         createParsers(e3) {
53703           for (let t2 of e3) {
53704             let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
53705             if (n3 && n3.enabled) {
53706               let t3 = this.parsers[e4];
53707               t3 && t3.append || t3 || this.createParser(e4, i3);
53708             }
53709           }
53710         }
53711         async readSegments(e3) {
53712           let t2 = e3.map(this.ensureSegmentChunk);
53713           await Promise.all(t2);
53714         }
53715       };
53716       re2 = class {
53717         static findPosition(e3, t2) {
53718           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;
53719           return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
53720         }
53721         static parse(e3, t2 = {}) {
53722           return new this(e3, new q({ [this.type]: t2 }), e3).parse();
53723         }
53724         normalizeInput(e3) {
53725           return e3 instanceof I ? e3 : new I(e3);
53726         }
53727         constructor(e3, t2 = {}, i3) {
53728           c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
53729             if (!this.options.silentErrors) throw e4;
53730             this.errors.push(e4.message);
53731           }), 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;
53732         }
53733         translate() {
53734           this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
53735         }
53736         get output() {
53737           return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
53738         }
53739         translateBlock(e3, t2) {
53740           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 = {};
53741           for (let [t3, r3] of e3) a2 && i3.has(t3) ? r3 = i3.get(t3)(r3) : o2 && n3.has(t3) && (r3 = this.translateValue(r3, n3.get(t3))), l2 && s2.has(t3) && (t3 = s2.get(t3) || t3), h2[t3] = r3;
53742           return h2;
53743         }
53744         translateValue(e3, t2) {
53745           return t2[e3] || t2.DEFAULT || e3;
53746         }
53747         assignToOutput(e3, t2) {
53748           this.assignObjectToOutput(e3, this.constructor.type, t2);
53749         }
53750         assignObjectToOutput(e3, t2, i3) {
53751           if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
53752           e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
53753         }
53754       };
53755       c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
53756       he = class extends se {
53757         constructor(...e3) {
53758           super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
53759         }
53760         static canHandle(e3, t2) {
53761           return 65496 === t2;
53762         }
53763         async parse() {
53764           await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
53765         }
53766         setupSegmentFinderArgs(e3) {
53767           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;
53768         }
53769         async findAppSegments(e3 = 0, t2) {
53770           this.setupSegmentFinderArgs(t2);
53771           let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
53772           if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
53773             let t3 = T.get(e4), i4 = this.options[e4];
53774             return t3.multiSegment && i4.multiSegment;
53775           }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
53776             let t3 = false;
53777             for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
53778               let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
53779               if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
53780             }
53781           }
53782         }
53783         findAppSegmentsInRange(e3, t2) {
53784           t2 -= 2;
53785           let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f2 } = this;
53786           for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
53787             if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
53788               if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f2[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size))) break;
53789               f2.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
53790             } else if (ae(i3)) {
53791               if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
53792               f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
53793             }
53794           }
53795           return e3;
53796         }
53797         mergeMultiSegments() {
53798           if (!this.appSegments.some((e4) => e4.multiSegment)) return;
53799           let e3 = function(e4, t2) {
53800             let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
53801             for (let a2 = 0; a2 < e4.length; a2++) i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
53802             return Array.from(r2);
53803           }(this.appSegments, "type");
53804           this.mergedAppSegments = e3.map(([e4, t2]) => {
53805             let i3 = T.get(e4, this.options);
53806             if (i3.handleMultiSegments) {
53807               return { type: e4, chunk: i3.handleMultiSegments(t2) };
53808             }
53809             return t2[0];
53810           });
53811         }
53812         getSegment(e3) {
53813           return this.appSegments.find((t2) => t2.type === e3);
53814         }
53815         async getOrFindSegment(e3) {
53816           let t2 = this.getSegment(e3);
53817           return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
53818         }
53819       };
53820       c(he, "type", "jpeg"), w.set("jpeg", he);
53821       ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
53822       ce = class extends re2 {
53823         parseHeader() {
53824           var e3 = this.chunk.getUint16();
53825           18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
53826         }
53827         parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
53828           let { pick: n3, skip: s2 } = this.options[t2];
53829           n3 = new Set(n3);
53830           let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
53831           e3 += 2;
53832           for (let l2 = 0; l2 < o2; l2++) {
53833             let o3 = this.chunk.getUint16(e3);
53834             if (r2) {
53835               if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
53836             } else !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
53837             e3 += 12;
53838           }
53839           return i3;
53840         }
53841         parseTag(e3, t2, i3) {
53842           let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
53843           if (a2 * r2 <= 4 ? e3 += 8 : e3 = n3.getUint32(e3 + 8), (s2 < 1 || s2 > 13) && g2(`Invalid TIFF value type. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3}`), e3 > n3.byteLength && g2(`Invalid TIFF value offset. block: ${i3.toUpperCase()}, tag: ${t2.toString(16)}, type: ${s2}, offset ${e3} is outside of chunk size ${n3.byteLength}`), 1 === s2) return n3.getUint8Array(e3, r2);
53844           if (2 === s2) return m(n3.getString(e3, r2));
53845           if (7 === s2) return n3.getUint8Array(e3, r2);
53846           if (1 === r2) return this.parseTagValue(s2, e3);
53847           {
53848             let t3 = new (function(e4) {
53849               switch (e4) {
53850                 case 1:
53851                   return Uint8Array;
53852                 case 3:
53853                   return Uint16Array;
53854                 case 4:
53855                   return Uint32Array;
53856                 case 5:
53857                   return Array;
53858                 case 6:
53859                   return Int8Array;
53860                 case 8:
53861                   return Int16Array;
53862                 case 9:
53863                   return Int32Array;
53864                 case 10:
53865                   return Array;
53866                 case 11:
53867                   return Float32Array;
53868                 case 12:
53869                   return Float64Array;
53870                 default:
53871                   return Array;
53872               }
53873             }(s2))(r2), i4 = a2;
53874             for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
53875             return t3;
53876           }
53877         }
53878         parseTagValue(e3, t2) {
53879           let { chunk: i3 } = this;
53880           switch (e3) {
53881             case 1:
53882               return i3.getUint8(t2);
53883             case 3:
53884               return i3.getUint16(t2);
53885             case 4:
53886               return i3.getUint32(t2);
53887             case 5:
53888               return i3.getUint32(t2) / i3.getUint32(t2 + 4);
53889             case 6:
53890               return i3.getInt8(t2);
53891             case 8:
53892               return i3.getInt16(t2);
53893             case 9:
53894               return i3.getInt32(t2);
53895             case 10:
53896               return i3.getInt32(t2) / i3.getInt32(t2 + 4);
53897             case 11:
53898               return i3.getFloat(t2);
53899             case 12:
53900               return i3.getDouble(t2);
53901             case 13:
53902               return i3.getUint32(t2);
53903             default:
53904               g2(`Invalid tiff type ${e3}`);
53905           }
53906         }
53907       };
53908       fe = class extends ce {
53909         static canHandle(e3, t2) {
53910           return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
53911         }
53912         async parse() {
53913           this.parseHeader();
53914           let { options: e3 } = this;
53915           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();
53916         }
53917         safeParse(e3) {
53918           let t2 = this[e3]();
53919           return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
53920         }
53921         findIfd0Offset() {
53922           void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
53923         }
53924         findIfd1Offset() {
53925           if (void 0 === this.ifd1Offset) {
53926             this.findIfd0Offset();
53927             let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
53928             this.ifd1Offset = this.chunk.getUint32(t2);
53929           }
53930         }
53931         parseBlock(e3, t2) {
53932           let i3 = /* @__PURE__ */ new Map();
53933           return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
53934         }
53935         async parseIfd0Block() {
53936           if (this.ifd0) return;
53937           let { file: e3 } = this;
53938           this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2(`IFD0 offset points to outside of file.
53939 this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
53940           let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
53941           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;
53942         }
53943         async parseExifBlock() {
53944           if (this.exif) return;
53945           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
53946           this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
53947           let e3 = this.parseBlock(this.exifOffset, "exif");
53948           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;
53949         }
53950         unpack(e3, t2) {
53951           let i3 = e3.get(t2);
53952           i3 && 1 === i3.length && e3.set(t2, i3[0]);
53953         }
53954         async parseGpsBlock() {
53955           if (this.gps) return;
53956           if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
53957           let e3 = this.parseBlock(this.gpsOffset, "gps");
53958           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;
53959         }
53960         async parseInteropBlock() {
53961           if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset)) return this.parseBlock(this.interopOffset, "interop");
53962         }
53963         async parseThumbnailBlock(e3 = false) {
53964           if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3)) return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
53965         }
53966         async extractThumbnail() {
53967           if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
53968           let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
53969           return this.chunk.getUint8Array(e3, t2);
53970         }
53971         get image() {
53972           return this.ifd0;
53973         }
53974         get thumbnail() {
53975           return this.ifd1;
53976         }
53977         createOutput() {
53978           let e3, t2, i3, n3 = {};
53979           for (t2 of H) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
53980             if ("ifd1" === t2) continue;
53981             Object.assign(n3, i3);
53982           } else n3[t2] = i3;
53983           return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
53984         }
53985         assignToOutput(e3, t2) {
53986           if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
53987           else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
53988         }
53989       };
53990       c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
53991       pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
53992       ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
53993       me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
53994       Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
53995       Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
53996       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 } });
53997       we = true;
53998       Te = true;
53999       if ("object" == typeof navigator) {
54000         let e3 = navigator.userAgent;
54001         if (e3.includes("iPad") || e3.includes("iPhone")) {
54002           let t2 = e3.match(/OS (\d+)_(\d+)/);
54003           if (t2) {
54004             let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
54005             we = n3 < 13.4, Te = false;
54006           }
54007         } else if (e3.includes("OS X 10")) {
54008           let [, t2] = e3.match(/OS X 10[_.](\d+)/);
54009           we = Te = Number(t2) < 15;
54010         }
54011         if (e3.includes("Chrome/")) {
54012           let [, t2] = e3.match(/Chrome\/(\d+)/);
54013           we = Te = Number(t2) < 81;
54014         } else if (e3.includes("Firefox/")) {
54015           let [, t2] = e3.match(/Firefox\/(\d+)/);
54016           we = Te = Number(t2) < 77;
54017         }
54018       }
54019       De = class extends I {
54020         constructor(...e3) {
54021           super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
54022         }
54023         _tryExtend(e3, t2, i3) {
54024           if (0 === e3 && 0 === this.byteLength && i3) {
54025             let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
54026             this._swapDataView(e4);
54027           } else {
54028             let i4 = e3 + t2;
54029             if (i4 > this.byteLength) {
54030               let { dataView: e4 } = this._extend(i4);
54031               this._swapDataView(e4);
54032             }
54033           }
54034         }
54035         _extend(e3) {
54036           let t2;
54037           t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
54038           let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
54039           return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
54040         }
54041         subarray(e3, t2, i3 = false) {
54042           return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
54043         }
54044         set(e3, t2, i3 = false) {
54045           i3 && this._tryExtend(t2, e3.byteLength, e3);
54046           let n3 = super.set(e3, t2);
54047           return this.ranges.add(t2, n3.byteLength), n3;
54048         }
54049         async ensureChunk(e3, t2) {
54050           this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
54051         }
54052         available(e3, t2) {
54053           return this.ranges.available(e3, t2);
54054         }
54055       };
54056       Oe = class {
54057         constructor() {
54058           c(this, "list", []);
54059         }
54060         get length() {
54061           return this.list.length;
54062         }
54063         add(e3, t2, i3 = 0) {
54064           let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
54065           if (s2.length > 0) {
54066             e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
54067             let i4 = s2.shift();
54068             i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
54069           } else this.list.push({ offset: e3, length: t2, end: n3 });
54070         }
54071         available(e3, t2) {
54072           let i3 = e3 + t2;
54073           return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
54074         }
54075       };
54076       ve = class extends De {
54077         constructor(e3, t2) {
54078           super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
54079         }
54080         async readWhole() {
54081           this.chunked = false, await this.readChunk(this.nextChunkOffset);
54082         }
54083         async readChunked() {
54084           this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
54085         }
54086         async readNextChunk(e3 = this.nextChunkOffset) {
54087           if (this.fullyRead) return this.chunksRead++, false;
54088           let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
54089           return !!i3 && i3.byteLength === t2;
54090         }
54091         async readChunk(e3, t2) {
54092           if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
54093         }
54094         safeWrapAddress(e3, t2) {
54095           return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
54096         }
54097         get nextChunkOffset() {
54098           if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
54099         }
54100         get canReadNextChunk() {
54101           return this.chunksRead < this.options.chunkLimit;
54102         }
54103         get fullyRead() {
54104           return void 0 !== this.size && this.nextChunkOffset === this.size;
54105         }
54106         read() {
54107           return this.options.chunked ? this.readChunked() : this.readWhole();
54108         }
54109         close() {
54110         }
54111       };
54112       A.set("blob", class extends ve {
54113         async readWhole() {
54114           this.chunked = false;
54115           let e3 = await R(this.input);
54116           this._swapArrayBuffer(e3);
54117         }
54118         readChunked() {
54119           return this.chunked = true, this.size = this.input.size, super.readChunked();
54120         }
54121         async _readChunk(e3, t2) {
54122           let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
54123           return this.set(s2, e3, true);
54124         }
54125       });
54126       Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
54127         return we;
54128       }, get rotateCss() {
54129         return Te;
54130       }, rotation: Ae });
54131       A.set("url", class extends ve {
54132         async readWhole() {
54133           this.chunked = false;
54134           let e3 = await M(this.input);
54135           e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
54136         }
54137         async _readChunk(e3, t2) {
54138           let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
54139           (e3 || i3) && (n3.range = `bytes=${[e3, i3].join("-")}`);
54140           let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
54141           if (416 !== s2.status) return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
54142         }
54143       });
54144       I.prototype.getUint64 = function(e3) {
54145         let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
54146         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.");
54147       };
54148       Re = class extends se {
54149         parseBoxes(e3 = 0) {
54150           let t2 = [];
54151           for (; e3 < this.file.byteLength - 4; ) {
54152             let i3 = this.parseBoxHead(e3);
54153             if (t2.push(i3), 0 === i3.length) break;
54154             e3 += i3.length;
54155           }
54156           return t2;
54157         }
54158         parseSubBoxes(e3) {
54159           e3.boxes = this.parseBoxes(e3.start);
54160         }
54161         findBox(e3, t2) {
54162           return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
54163         }
54164         parseBoxHead(e3) {
54165           let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
54166           return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
54167         }
54168         parseBoxFullHead(e3) {
54169           if (void 0 !== e3.version) return;
54170           let t2 = this.file.getUint32(e3.start);
54171           e3.version = t2 >> 24, e3.start += 4;
54172         }
54173       };
54174       Le = class extends Re {
54175         static canHandle(e3, t2) {
54176           if (0 !== t2) return false;
54177           let i3 = e3.getUint16(2);
54178           if (i3 > 50) return false;
54179           let n3 = 16, s2 = [];
54180           for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
54181           return s2.includes(this.type);
54182         }
54183         async parse() {
54184           let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
54185           for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
54186           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);
54187         }
54188         async registerSegment(e3, t2, i3) {
54189           await this.file.ensureChunk(t2, i3);
54190           let n3 = this.file.subarray(t2, i3);
54191           this.createParser(e3, n3);
54192         }
54193         async findIcc(e3) {
54194           let t2 = this.findBox(e3, "iprp");
54195           if (void 0 === t2) return;
54196           let i3 = this.findBox(t2, "ipco");
54197           if (void 0 === i3) return;
54198           let n3 = this.findBox(i3, "colr");
54199           void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
54200         }
54201         async findExif(e3) {
54202           let t2 = this.findBox(e3, "iinf");
54203           if (void 0 === t2) return;
54204           let i3 = this.findBox(e3, "iloc");
54205           if (void 0 === i3) return;
54206           let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
54207           if (void 0 === s2) return;
54208           let [r2, a2] = s2;
54209           await this.file.ensureChunk(r2, a2);
54210           let o2 = 4 + this.file.getUint32(r2);
54211           r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
54212         }
54213         findExifLocIdInIinf(e3) {
54214           this.parseBoxFullHead(e3);
54215           let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
54216           for (r2 += 2; a2--; ) {
54217             if (t2 = this.parseBoxHead(r2), this.parseBoxFullHead(t2), i3 = t2.start, t2.version >= 2 && (n3 = 3 === t2.version ? 4 : 2, s2 = this.file.getString(i3 + n3 + 2, 4), "Exif" === s2)) return this.file.getUintBytes(i3, n3);
54218             r2 += t2.length;
54219           }
54220         }
54221         get8bits(e3) {
54222           let t2 = this.file.getUint8(e3);
54223           return [t2 >> 4, 15 & t2];
54224         }
54225         findExtentInIloc(e3, t2) {
54226           this.parseBoxFullHead(e3);
54227           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);
54228           for (i3 += u2; c2--; ) {
54229             let e4 = this.file.getUintBytes(i3, o2);
54230             i3 += o2 + l2 + 2 + r2;
54231             let u3 = this.file.getUint16(i3);
54232             if (i3 += 2, e4 === t2) return u3 > 1 && console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"), [this.file.getUintBytes(i3 + a2, n3), this.file.getUintBytes(i3 + a2 + n3, s2)];
54233             i3 += u3 * h2;
54234           }
54235         }
54236       };
54237       Ue = class extends Le {
54238       };
54239       c(Ue, "type", "heic");
54240       Fe = class extends Le {
54241       };
54242       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" }]]);
54243       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" }]]);
54244       Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
54245       Ee.set(37392, Be), Ee.set(41488, Be);
54246       Ne = { 0: "Normal", 1: "Low", 2: "High" };
54247       Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
54248         return "string" != typeof e3 ? b(e3) : e3;
54249       }], [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(":")]]);
54250       We = class extends re2 {
54251         static canHandle(e3, t2) {
54252           return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
54253         }
54254         static headerLength(e3, t2) {
54255           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;
54256         }
54257         static findPosition(e3, t2) {
54258           let i3 = super.findPosition(e3, t2);
54259           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;
54260         }
54261         static handleMultiSegments(e3) {
54262           return e3.map((e4) => e4.chunk.getString()).join("");
54263         }
54264         normalizeInput(e3) {
54265           return "string" == typeof e3 ? e3 : I.from(e3).getString();
54266         }
54267         parse(e3 = this.chunk) {
54268           if (!this.localOptions.parse) return e3;
54269           e3 = function(e4) {
54270             let t3 = {}, i4 = {};
54271             for (let e6 of Ze) t3[e6] = [], i4[e6] = 0;
54272             return e4.replace(et, (e6, n4, s2) => {
54273               if ("<" === n4) {
54274                 let n5 = ++i4[s2];
54275                 return t3[s2].push(n5), `${e6}#${n5}`;
54276               }
54277               return `${e6}#${t3[s2].pop()}`;
54278             });
54279           }(e3);
54280           let t2 = Xe.findAll(e3, "rdf", "Description");
54281           0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
54282           let i3, n3 = {};
54283           for (let e4 of t2) for (let t3 of e4.properties) i3 = Je(t3.ns, n3), _e(t3, i3);
54284           return function(e4) {
54285             let t3;
54286             for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
54287             return f(e4);
54288           }(n3);
54289         }
54290         assignToOutput(e3, t2) {
54291           if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
54292             case "tiff":
54293               this.assignObjectToOutput(e3, "ifd0", n3);
54294               break;
54295             case "exif":
54296               this.assignObjectToOutput(e3, "exif", n3);
54297               break;
54298             case "xmlns":
54299               break;
54300             default:
54301               this.assignObjectToOutput(e3, i3, n3);
54302           }
54303           else e3.xmp = t2;
54304         }
54305       };
54306       c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
54307       Ke = class _Ke {
54308         static findAll(e3) {
54309           return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
54310         }
54311         static unpackMatch(e3) {
54312           let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
54313           return n3 = Qe(n3), new _Ke(t2, i3, n3);
54314         }
54315         constructor(e3, t2, i3) {
54316           this.ns = e3, this.name = t2, this.value = i3;
54317         }
54318         serialize() {
54319           return this.value;
54320         }
54321       };
54322       Xe = class _Xe {
54323         static findAll(e3, t2, i3) {
54324           if (void 0 !== t2 || void 0 !== i3) {
54325             t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
54326             var n3 = new RegExp(`<(${t2}):(${i3})(#\\d+)?((\\s+?[\\w\\d-:]+=("[^"]*"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)`, "gm");
54327           } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
54328           return qe(e3, n3).map(_Xe.unpackMatch);
54329         }
54330         static unpackMatch(e3) {
54331           let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
54332           return new _Xe(t2, i3, n3, s2);
54333         }
54334         constructor(e3, t2, i3, n3) {
54335           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];
54336         }
54337         get isPrimitive() {
54338           return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
54339         }
54340         get isListContainer() {
54341           return 1 === this.children.length && this.children[0].isList;
54342         }
54343         get isList() {
54344           let { ns: e3, name: t2 } = this;
54345           return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
54346         }
54347         get isListItem() {
54348           return "rdf" === this.ns && "li" === this.name;
54349         }
54350         serialize() {
54351           if (0 === this.properties.length && void 0 === this.value) return;
54352           if (this.isPrimitive) return this.value;
54353           if (this.isListContainer) return this.children[0].serialize();
54354           if (this.isList) return $e(this.children.map(Ye));
54355           if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
54356           let e3 = {};
54357           for (let t2 of this.properties) _e(t2, e3);
54358           return void 0 !== this.value && (e3.value = this.value), f(e3);
54359         }
54360       };
54361       Ye = (e3) => e3.serialize();
54362       $e = (e3) => 1 === e3.length ? e3[0] : e3;
54363       Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
54364       Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
54365       et = new RegExp(`(<|\\/)(${Ze.join("|")})`, "g");
54366       tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
54367         return we;
54368       }, get rotateCss() {
54369         return Te;
54370       }, rotation: Ae });
54371       at = l("fs", (e3) => e3.promises);
54372       A.set("fs", class extends ve {
54373         async readWhole() {
54374           this.chunked = false, this.fs = await at;
54375           let e3 = await this.fs.readFile(this.input);
54376           this._swapBuffer(e3);
54377         }
54378         async readChunked() {
54379           this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
54380         }
54381         async open() {
54382           void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
54383         }
54384         async _readChunk(e3, t2) {
54385           void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
54386           var i3 = this.subarray(e3, t2, true);
54387           return await this.fh.read(i3.dataView, 0, t2, e3), i3;
54388         }
54389         async close() {
54390           if (this.fh) {
54391             let e3 = this.fh;
54392             this.fh = void 0, await e3.close();
54393           }
54394         }
54395       });
54396       A.set("base64", class extends ve {
54397         constructor(...e3) {
54398           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);
54399         }
54400         async _readChunk(e3, t2) {
54401           let i3, n3, r2 = this.input;
54402           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);
54403           let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
54404           r2 = r2.slice(i3, l2);
54405           let h2 = Math.min(t2, this.size - e3);
54406           if (a) {
54407             let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
54408             return this.set(t3, e3, true);
54409           }
54410           {
54411             let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
54412             for (let e4 = 0; e4 < h2; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
54413             return t3;
54414           }
54415         }
54416       });
54417       ot = class extends se {
54418         static canHandle(e3, t2) {
54419           return 18761 === t2 || 19789 === t2;
54420         }
54421         extendOptions(e3) {
54422           let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
54423           i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
54424         }
54425         async parse() {
54426           let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
54427           if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
54428             let e4 = Math.max(S(this.options), this.options.chunkSize);
54429             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");
54430           }
54431         }
54432         adaptTiffPropAsSegment(e3) {
54433           if (this.parsers.tiff[e3]) {
54434             let t2 = this.parsers.tiff[e3];
54435             this.injectSegment(e3, t2);
54436           }
54437         }
54438       };
54439       c(ot, "type", "tiff"), w.set("tiff", ot);
54440       lt = l("zlib");
54441       ht = ["ihdr", "iccp", "text", "itxt", "exif"];
54442       ut = class extends se {
54443         constructor(...e3) {
54444           super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
54445         }
54446         static canHandle(e3, t2) {
54447           return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
54448         }
54449         async parse() {
54450           let { file: e3 } = this;
54451           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);
54452         }
54453         async findPngChunksInRange(e3, t2) {
54454           let { file: i3 } = this;
54455           for (; e3 < t2; ) {
54456             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 };
54457             ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
54458           }
54459         }
54460         parseTextChunks() {
54461           let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
54462           for (let t2 of e3) {
54463             let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
54464             this.injectKeyValToIhdr(e4, i3);
54465           }
54466         }
54467         injectKeyValToIhdr(e3, t2) {
54468           let i3 = this.parsers.ihdr;
54469           i3 && i3.raw.set(e3, t2);
54470         }
54471         findIhdr() {
54472           let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
54473           e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
54474         }
54475         async findExif() {
54476           let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
54477           e3 && this.injectSegment("tiff", e3.chunk);
54478         }
54479         async findXmp() {
54480           let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
54481           for (let t2 of e3) {
54482             "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
54483           }
54484         }
54485         async findIcc() {
54486           let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
54487           if (!e3) return;
54488           let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
54489           for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
54490           let r2 = s2 + 2, a2 = t2.getString(0, s2);
54491           if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
54492             let e4 = await lt, i4 = t2.getUint8Array(r2);
54493             i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
54494           }
54495         }
54496       };
54497       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"]]);
54498       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"]];
54499       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" }]]);
54500       ft = class extends re2 {
54501         static canHandle(e3, t2) {
54502           return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
54503         }
54504         parse() {
54505           return this.parseTags(), this.translate(), this.output;
54506         }
54507         parseTags() {
54508           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)]]);
54509         }
54510       };
54511       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"]]);
54512       dt = class extends re2 {
54513         parse() {
54514           return this.parseTags(), this.translate(), this.output;
54515         }
54516         parseTags() {
54517           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)]);
54518         }
54519       };
54520       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" }]]);
54521       pt = class extends re2 {
54522         static canHandle(e3, t2) {
54523           return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
54524         }
54525         static findPosition(e3, t2) {
54526           let i3 = super.findPosition(e3, t2);
54527           return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
54528         }
54529         static handleMultiSegments(e3) {
54530           return function(e4) {
54531             let t2 = function(e6) {
54532               let t3 = e6[0].constructor, i3 = 0;
54533               for (let t4 of e6) i3 += t4.length;
54534               let n3 = new t3(i3), s2 = 0;
54535               for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
54536               return n3;
54537             }(e4.map((e6) => e6.chunk.toUint8()));
54538             return new I(t2);
54539           }(e3);
54540         }
54541         parse() {
54542           return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
54543         }
54544         parseHeader() {
54545           let { raw: e3 } = this;
54546           this.chunk.byteLength < 84 && g2("ICC header is too short");
54547           for (let [t2, i3] of Object.entries(gt)) {
54548             t2 = parseInt(t2, 10);
54549             let n3 = i3(this.chunk, t2);
54550             "\0\0\0\0" !== n3 && e3.set(t2, n3);
54551           }
54552         }
54553         parseTags() {
54554           let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
54555           for (; a2--; ) {
54556             if (e3 = this.chunk.getString(o2, 4), t2 = this.chunk.getUint32(o2 + 4), i3 = this.chunk.getUint32(o2 + 8), n3 = this.chunk.getString(t2, 4), t2 + i3 > l2) return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
54557             s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
54558           }
54559         }
54560         parseTag(e3, t2, i3) {
54561           switch (e3) {
54562             case "desc":
54563               return this.parseDesc(t2);
54564             case "mluc":
54565               return this.parseMluc(t2);
54566             case "text":
54567               return this.parseText(t2, i3);
54568             case "sig ":
54569               return this.parseSig(t2);
54570           }
54571           if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
54572         }
54573         parseDesc(e3) {
54574           let t2 = this.chunk.getUint32(e3 + 8) - 1;
54575           return m(this.chunk.getString(e3 + 12, t2));
54576         }
54577         parseText(e3, t2) {
54578           return m(this.chunk.getString(e3 + 8, t2 - 8));
54579         }
54580         parseSig(e3) {
54581           return m(this.chunk.getString(e3 + 8, 4));
54582         }
54583         parseMluc(e3) {
54584           let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
54585           for (let a2 = 0; a2 < i3; a2++) {
54586             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));
54587             r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
54588           }
54589           return 1 === i3 ? r2[0].text : r2;
54590         }
54591         translateValue(e3, t2) {
54592           return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
54593         }
54594       };
54595       c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
54596       gt = { 4: mt, 8: function(e3, t2) {
54597         return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
54598       }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
54599         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);
54600         return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
54601       }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
54602       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"]]);
54603       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" };
54604       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!)" };
54605       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" }]]);
54606       yt = class extends re2 {
54607         static canHandle(e3, t2, i3) {
54608           return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
54609         }
54610         static headerLength(e3, t2, i3) {
54611           let n3, s2 = this.containsIptc8bim(e3, t2, i3);
54612           if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
54613         }
54614         static containsIptc8bim(e3, t2, i3) {
54615           for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
54616         }
54617         static isIptcSegmentHead(e3, t2) {
54618           return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
54619         }
54620         parse() {
54621           let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
54622           for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
54623             i3 = true;
54624             let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
54625             e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
54626           } else if (i3) break;
54627           return this.translate(), this.output;
54628         }
54629         pluralizeValue(e3, t2) {
54630           return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
54631         }
54632       };
54633       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" }]]);
54634       full_esm_default = tt;
54635     }
54636   });
54637
54638   // modules/services/plane_photo.js
54639   var plane_photo_exports = {};
54640   __export(plane_photo_exports, {
54641     default: () => plane_photo_default
54642   });
54643   function zoomPan(d3_event) {
54644     let t2 = d3_event.transform;
54645     _imageWrapper.call(utilSetTransform, t2.x, t2.y, t2.k);
54646   }
54647   function loadImage(selection2, path) {
54648     return new Promise((resolve) => {
54649       selection2.attr("src", path);
54650       selection2.on("load", () => {
54651         resolve(selection2);
54652       });
54653     });
54654   }
54655   var dispatch5, _photo, _imageWrapper, _planeWrapper, _imgZoom, plane_photo_default;
54656   var init_plane_photo = __esm({
54657     "modules/services/plane_photo.js"() {
54658       "use strict";
54659       init_src4();
54660       init_src12();
54661       init_util();
54662       dispatch5 = dispatch_default("viewerChanged");
54663       _imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
54664       plane_photo_default = {
54665         init: async function(context, selection2) {
54666           this.event = utilRebind(this, dispatch5, "on");
54667           _planeWrapper = selection2;
54668           _planeWrapper.call(_imgZoom.on("zoom", zoomPan));
54669           _imageWrapper = _planeWrapper.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
54670           _photo = _imageWrapper.append("img").attr("class", "plane-photo");
54671           context.ui().photoviewer.on("resize.plane", function(dimensions) {
54672             _imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
54673           });
54674           await Promise.resolve();
54675           return this;
54676         },
54677         /**
54678          * Shows the photo frame if hidden
54679          * @param {*} context the HTML wrap of the frame
54680          */
54681         showPhotoFrame: function(context) {
54682           const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
54683           if (isHidden) {
54684             context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
54685             context.selectAll(".photo-frame.plane-frame").classed("hide", false);
54686           }
54687           return this;
54688         },
54689         /**
54690          * Hides the photo frame if shown
54691          * @param {*} context the HTML wrap of the frame
54692          */
54693         hidePhotoFrame: function(context) {
54694           context.select("photo-frame.plane-frame").classed("hide", false);
54695           return this;
54696         },
54697         /**
54698          * Renders an image inside the frame
54699          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
54700          */
54701         selectPhoto: function(data) {
54702           dispatch5.call("viewerChanged");
54703           loadImage(_photo, "");
54704           loadImage(_photo, data.image_path).then(() => {
54705             _planeWrapper.call(_imgZoom.transform, identity2);
54706           });
54707           return this;
54708         },
54709         getYaw: function() {
54710           return 0;
54711         }
54712       };
54713     }
54714   });
54715
54716   // modules/svg/local_photos.js
54717   var local_photos_exports = {};
54718   __export(local_photos_exports, {
54719     svgLocalPhotos: () => svgLocalPhotos
54720   });
54721   function svgLocalPhotos(projection2, context, dispatch14) {
54722     const detected = utilDetect();
54723     let layer = select_default2(null);
54724     let _fileList;
54725     let _photos = [];
54726     let _idAutoinc = 0;
54727     let _photoFrame;
54728     let _activePhotoIdx;
54729     function init2() {
54730       if (_initialized2) return;
54731       _enabled2 = true;
54732       function over(d3_event) {
54733         d3_event.stopPropagation();
54734         d3_event.preventDefault();
54735         d3_event.dataTransfer.dropEffect = "copy";
54736       }
54737       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
54738         d3_event.stopPropagation();
54739         d3_event.preventDefault();
54740         if (!detected.filedrop) return;
54741         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
54742           if (loaded.length > 0) {
54743             drawPhotos.fitZoom(false);
54744           }
54745         });
54746       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
54747       _initialized2 = true;
54748     }
54749     function ensureViewerLoaded(context2) {
54750       if (_photoFrame) {
54751         return Promise.resolve(_photoFrame);
54752       }
54753       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
54754       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
54755       viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
54756       const controlsEnter = viewerEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-local");
54757       controlsEnter.append("button").classed("back", true).on("click.back", () => stepPhotos(-1)).text("\u25C0");
54758       controlsEnter.append("button").classed("forward", true).on("click.forward", () => stepPhotos(1)).text("\u25B6");
54759       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
54760         _photoFrame = planePhotoFrame;
54761       });
54762     }
54763     function stepPhotos(stepBy) {
54764       if (!_photos || _photos.length === 0) return;
54765       if (_activePhotoIdx === void 0) _activePhotoIdx = 0;
54766       const newIndex = _activePhotoIdx + stepBy;
54767       _activePhotoIdx = Math.max(0, Math.min(_photos.length - 1, newIndex));
54768       click(null, _photos[_activePhotoIdx], false);
54769     }
54770     function click(d3_event, image, zoomTo) {
54771       _activePhotoIdx = _photos.indexOf(image);
54772       ensureViewerLoaded(context).then(() => {
54773         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
54774         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
54775         const controlsWrap = viewer.select(".photo-controls-wrap");
54776         controlsWrap.select(".back").attr("disabled", _activePhotoIdx <= 0 ? true : null);
54777         controlsWrap.select(".forward").attr("disabled", _activePhotoIdx >= _photos.length - 1 ? true : null);
54778         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
54779         if (image.date) {
54780           attribution.append("span").text(image.date.toLocaleString(_mainLocalizer.localeCode()));
54781         }
54782         if (image.name) {
54783           attribution.append("span").classed("filename", true).text(image.name);
54784         }
54785         _photoFrame.selectPhoto({ image_path: "" });
54786         image.getSrc().then((src) => {
54787           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
54788           setStyles();
54789         });
54790       });
54791       if (zoomTo) {
54792         context.map().centerEase(image.loc);
54793       }
54794     }
54795     function transform2(d2) {
54796       var svgpoint = projection2(d2.loc);
54797       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
54798     }
54799     function setStyles(hovered) {
54800       const viewer = context.container().select(".photoviewer");
54801       const selected = viewer.empty() ? void 0 : viewer.datum();
54802       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));
54803     }
54804     function display_markers(imageList) {
54805       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
54806       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
54807         return d2.id;
54808       });
54809       groups.exit().remove();
54810       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
54811       groupsEnter.append("g").attr("class", "viewfield-scale");
54812       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
54813       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54814       const showViewfields = context.map().zoom() >= minViewfieldZoom;
54815       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54816       viewfields.exit().remove();
54817       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
54818         var _a3;
54819         const d2 = this.parentNode.__data__;
54820         return `rotate(${Math.round((_a3 = d2.direction) != null ? _a3 : 0)},0,0),scale(1.5,1.5),translate(-8,-13)`;
54821       }).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() {
54822         const d2 = this.parentNode.__data__;
54823         return isNumber_default(d2.direction) ? "visible" : "hidden";
54824       });
54825     }
54826     function drawPhotos(selection2) {
54827       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
54828       layer.exit().remove();
54829       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
54830       layerEnter.append("g").attr("class", "markers");
54831       layer = layerEnter.merge(layer);
54832       if (_photos) {
54833         display_markers(_photos);
54834       }
54835     }
54836     function readFileAsDataURL(file) {
54837       return new Promise((resolve, reject) => {
54838         const reader = new FileReader();
54839         reader.onload = () => resolve(reader.result);
54840         reader.onerror = (error) => reject(error);
54841         reader.readAsDataURL(file);
54842       });
54843     }
54844     async function readmultifiles(files, callback) {
54845       const loaded = [];
54846       for (const file of files) {
54847         try {
54848           const exifData = await full_esm_default.parse(file);
54849           const photo = {
54850             service: "photo",
54851             id: _idAutoinc++,
54852             name: file.name,
54853             getSrc: () => readFileAsDataURL(file),
54854             file,
54855             loc: [exifData.longitude, exifData.latitude],
54856             direction: exifData.GPSImgDirection,
54857             date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
54858           };
54859           loaded.push(photo);
54860           const sameName = _photos.filter((i3) => i3.name === photo.name);
54861           if (sameName.length === 0) {
54862             _photos.push(photo);
54863           } else {
54864             const thisContent = await photo.getSrc();
54865             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
54866             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
54867               _photos.push(photo);
54868             }
54869           }
54870         } catch {
54871         }
54872       }
54873       if (typeof callback === "function") callback(loaded);
54874       dispatch14.call("change");
54875     }
54876     drawPhotos.setFiles = function(fileList, callback) {
54877       readmultifiles(Array.from(fileList), callback);
54878       return this;
54879     };
54880     drawPhotos.fileList = function(fileList, callback) {
54881       if (!arguments.length) return _fileList;
54882       _fileList = fileList;
54883       if (!fileList || !fileList.length) return this;
54884       drawPhotos.setFiles(_fileList, callback);
54885       return this;
54886     };
54887     drawPhotos.getPhotos = function() {
54888       return _photos;
54889     };
54890     drawPhotos.removePhoto = function(id2) {
54891       _photos = _photos.filter((i3) => i3.id !== id2);
54892       dispatch14.call("change");
54893       return _photos;
54894     };
54895     drawPhotos.openPhoto = click;
54896     drawPhotos.fitZoom = function(force) {
54897       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
54898       if (coords.length === 0) return;
54899       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
54900       const map2 = context.map();
54901       var viewport = map2.trimmedExtent().polygon();
54902       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
54903         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
54904       }
54905     };
54906     function showLayer() {
54907       layer.style("display", "block");
54908       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54909         dispatch14.call("change");
54910       });
54911     }
54912     function hideLayer() {
54913       layer.transition().duration(250).style("opacity", 0).on("end", () => {
54914         layer.selectAll(".viewfield-group").remove();
54915         layer.style("display", "none");
54916       });
54917     }
54918     drawPhotos.enabled = function(val) {
54919       if (!arguments.length) return _enabled2;
54920       _enabled2 = val;
54921       if (_enabled2) {
54922         showLayer();
54923       } else {
54924         hideLayer();
54925       }
54926       dispatch14.call("change");
54927       return this;
54928     };
54929     drawPhotos.hasData = function() {
54930       return isArray_default(_photos) && _photos.length > 0;
54931     };
54932     init2();
54933     return drawPhotos;
54934   }
54935   var _initialized2, _enabled2, minViewfieldZoom;
54936   var init_local_photos = __esm({
54937     "modules/svg/local_photos.js"() {
54938       "use strict";
54939       init_src5();
54940       init_full_esm();
54941       init_lodash();
54942       init_localizer();
54943       init_detect();
54944       init_geo2();
54945       init_plane_photo();
54946       _initialized2 = false;
54947       _enabled2 = false;
54948       minViewfieldZoom = 16;
54949     }
54950   });
54951
54952   // modules/svg/osmose.js
54953   var osmose_exports2 = {};
54954   __export(osmose_exports2, {
54955     svgOsmose: () => svgOsmose
54956   });
54957   function svgOsmose(projection2, context, dispatch14) {
54958     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
54959     const minZoom5 = 12;
54960     let touchLayer = select_default2(null);
54961     let drawLayer = select_default2(null);
54962     let layerVisible = false;
54963     function markerPath(selection2, klass) {
54964       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");
54965     }
54966     function getService() {
54967       if (services.osmose && !_qaService2) {
54968         _qaService2 = services.osmose;
54969         _qaService2.on("loaded", throttledRedraw);
54970       } else if (!services.osmose && _qaService2) {
54971         _qaService2 = null;
54972       }
54973       return _qaService2;
54974     }
54975     function editOn() {
54976       if (!layerVisible) {
54977         layerVisible = true;
54978         drawLayer.style("display", "block");
54979       }
54980     }
54981     function editOff() {
54982       if (layerVisible) {
54983         layerVisible = false;
54984         drawLayer.style("display", "none");
54985         drawLayer.selectAll(".qaItem.osmose").remove();
54986         touchLayer.selectAll(".qaItem.osmose").remove();
54987       }
54988     }
54989     function layerOn() {
54990       editOn();
54991       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
54992     }
54993     function layerOff() {
54994       throttledRedraw.cancel();
54995       drawLayer.interrupt();
54996       touchLayer.selectAll(".qaItem.osmose").remove();
54997       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
54998         editOff();
54999         dispatch14.call("change");
55000       });
55001     }
55002     function updateMarkers() {
55003       if (!layerVisible || !_layerEnabled2) return;
55004       const service = getService();
55005       const selectedID = context.selectedErrorID();
55006       const data = service ? service.getItems(projection2) : [];
55007       const getTransform = svgPointTransform(projection2);
55008       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
55009       markers.exit().remove();
55010       const markersEnter = markers.enter().append("g").attr("class", (d2) => `qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
55011       markersEnter.append("polygon").call(markerPath, "shadow");
55012       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
55013       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
55014       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 : "");
55015       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
55016       if (touchLayer.empty()) return;
55017       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
55018       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
55019       targets.exit().remove();
55020       targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => `qaItem ${d2.service} target ${fillClass} itemId-${d2.id}`).attr("transform", getTransform);
55021       function sortY(a2, b2) {
55022         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
55023       }
55024     }
55025     function drawOsmose(selection2) {
55026       const service = getService();
55027       const surface = context.surface();
55028       if (surface && !surface.empty()) {
55029         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
55030       }
55031       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
55032       drawLayer.exit().remove();
55033       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
55034       if (_layerEnabled2) {
55035         if (service && ~~context.map().zoom() >= minZoom5) {
55036           editOn();
55037           service.loadIssues(projection2);
55038           updateMarkers();
55039         } else {
55040           editOff();
55041         }
55042       }
55043     }
55044     drawOsmose.enabled = function(val) {
55045       if (!arguments.length) return _layerEnabled2;
55046       _layerEnabled2 = val;
55047       if (_layerEnabled2) {
55048         getService().loadStrings().then(layerOn).catch((err) => {
55049           console.log(err);
55050         });
55051       } else {
55052         layerOff();
55053         if (context.selectedErrorID()) {
55054           context.enter(modeBrowse(context));
55055         }
55056       }
55057       dispatch14.call("change");
55058       return this;
55059     };
55060     drawOsmose.supported = () => !!getService();
55061     return drawOsmose;
55062   }
55063   var _layerEnabled2, _qaService2;
55064   var init_osmose2 = __esm({
55065     "modules/svg/osmose.js"() {
55066       "use strict";
55067       init_throttle();
55068       init_src5();
55069       init_browse();
55070       init_helpers();
55071       init_services();
55072       _layerEnabled2 = false;
55073     }
55074   });
55075
55076   // modules/svg/streetside.js
55077   var streetside_exports = {};
55078   __export(streetside_exports, {
55079     svgStreetside: () => svgStreetside
55080   });
55081   function svgStreetside(projection2, context, dispatch14) {
55082     var throttledRedraw = throttle_default(function() {
55083       dispatch14.call("change");
55084     }, 1e3);
55085     var minZoom5 = 14;
55086     var minMarkerZoom = 16;
55087     var minViewfieldZoom2 = 18;
55088     var layer = select_default2(null);
55089     var _viewerYaw = 0;
55090     var _selectedSequence = null;
55091     var _streetside;
55092     function init2() {
55093       if (svgStreetside.initialized) return;
55094       svgStreetside.enabled = false;
55095       svgStreetside.initialized = true;
55096     }
55097     function getService() {
55098       if (services.streetside && !_streetside) {
55099         _streetside = services.streetside;
55100         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
55101       } else if (!services.streetside && _streetside) {
55102         _streetside = null;
55103       }
55104       return _streetside;
55105     }
55106     function showLayer() {
55107       var service = getService();
55108       if (!service) return;
55109       editOn();
55110       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55111         dispatch14.call("change");
55112       });
55113     }
55114     function hideLayer() {
55115       throttledRedraw.cancel();
55116       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55117     }
55118     function editOn() {
55119       layer.style("display", "block");
55120     }
55121     function editOff() {
55122       layer.selectAll(".viewfield-group").remove();
55123       layer.style("display", "none");
55124     }
55125     function click(d3_event, d2) {
55126       var service = getService();
55127       if (!service) return;
55128       if (d2.sequenceKey !== _selectedSequence) {
55129         _viewerYaw = 0;
55130       }
55131       _selectedSequence = d2.sequenceKey;
55132       service.ensureViewerLoaded(context).then(function() {
55133         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
55134       });
55135       context.map().centerEase(d2.loc);
55136     }
55137     function mouseover(d3_event, d2) {
55138       var service = getService();
55139       if (service) service.setStyles(context, d2);
55140     }
55141     function mouseout() {
55142       var service = getService();
55143       if (service) service.setStyles(context, null);
55144     }
55145     function transform2(d2) {
55146       var t2 = svgPointTransform(projection2)(d2);
55147       var rot = d2.ca + _viewerYaw;
55148       if (rot) {
55149         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
55150       }
55151       return t2;
55152     }
55153     function viewerChanged() {
55154       var service = getService();
55155       if (!service) return;
55156       var viewer = service.viewer();
55157       if (!viewer) return;
55158       _viewerYaw = viewer.getYaw();
55159       if (context.map().isTransformed()) return;
55160       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
55161     }
55162     function filterBubbles(bubbles) {
55163       var fromDate = context.photos().fromDate();
55164       var toDate = context.photos().toDate();
55165       var usernames = context.photos().usernames();
55166       if (fromDate) {
55167         var fromTimestamp = new Date(fromDate).getTime();
55168         bubbles = bubbles.filter(function(bubble) {
55169           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
55170         });
55171       }
55172       if (toDate) {
55173         var toTimestamp = new Date(toDate).getTime();
55174         bubbles = bubbles.filter(function(bubble) {
55175           return new Date(bubble.captured_at).getTime() <= toTimestamp;
55176         });
55177       }
55178       if (usernames) {
55179         bubbles = bubbles.filter(function(bubble) {
55180           return usernames.indexOf(bubble.captured_by) !== -1;
55181         });
55182       }
55183       return bubbles;
55184     }
55185     function filterSequences(sequences) {
55186       var fromDate = context.photos().fromDate();
55187       var toDate = context.photos().toDate();
55188       var usernames = context.photos().usernames();
55189       if (fromDate) {
55190         var fromTimestamp = new Date(fromDate).getTime();
55191         sequences = sequences.filter(function(sequences2) {
55192           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
55193         });
55194       }
55195       if (toDate) {
55196         var toTimestamp = new Date(toDate).getTime();
55197         sequences = sequences.filter(function(sequences2) {
55198           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
55199         });
55200       }
55201       if (usernames) {
55202         sequences = sequences.filter(function(sequences2) {
55203           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
55204         });
55205       }
55206       return sequences;
55207     }
55208     function update() {
55209       var viewer = context.container().select(".photoviewer");
55210       var selected = viewer.empty() ? void 0 : viewer.datum();
55211       var z2 = ~~context.map().zoom();
55212       var showMarkers = z2 >= minMarkerZoom;
55213       var showViewfields = z2 >= minViewfieldZoom2;
55214       var service = getService();
55215       var sequences = [];
55216       var bubbles = [];
55217       if (context.photos().showsPanoramic()) {
55218         sequences = service ? service.sequences(projection2) : [];
55219         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
55220         sequences = filterSequences(sequences);
55221         bubbles = filterBubbles(bubbles);
55222       }
55223       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55224         return d2.properties.key;
55225       });
55226       dispatch14.call("photoDatesChanged", this, "streetside", [...bubbles.map((p2) => p2.captured_at), ...sequences.map((t2) => t2.properties.vintageStart)]);
55227       traces.exit().remove();
55228       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55229       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
55230         return d2.key + (d2.sequenceKey ? "v1" : "v0");
55231       });
55232       groups.exit().remove();
55233       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55234       groupsEnter.append("g").attr("class", "viewfield-scale");
55235       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55236         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
55237       }).attr("transform", transform2).select(".viewfield-scale");
55238       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55239       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55240       viewfields.exit().remove();
55241       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55242       function viewfieldPath() {
55243         var d2 = this.parentNode.__data__;
55244         if (d2.pano) {
55245           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55246         } else {
55247           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55248         }
55249       }
55250     }
55251     function drawImages(selection2) {
55252       var enabled = svgStreetside.enabled;
55253       var service = getService();
55254       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
55255       layer.exit().remove();
55256       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
55257       layerEnter.append("g").attr("class", "sequences");
55258       layerEnter.append("g").attr("class", "markers");
55259       layer = layerEnter.merge(layer);
55260       if (enabled) {
55261         if (service && ~~context.map().zoom() >= minZoom5) {
55262           editOn();
55263           update();
55264           service.loadBubbles(projection2);
55265         } else {
55266           dispatch14.call("photoDatesChanged", this, "streetside", []);
55267           editOff();
55268         }
55269       } else {
55270         dispatch14.call("photoDatesChanged", this, "streetside", []);
55271       }
55272     }
55273     drawImages.enabled = function(_2) {
55274       if (!arguments.length) return svgStreetside.enabled;
55275       svgStreetside.enabled = _2;
55276       if (svgStreetside.enabled) {
55277         showLayer();
55278         context.photos().on("change.streetside", update);
55279       } else {
55280         hideLayer();
55281         context.photos().on("change.streetside", null);
55282       }
55283       dispatch14.call("change");
55284       return this;
55285     };
55286     drawImages.supported = function() {
55287       return !!getService();
55288     };
55289     drawImages.rendered = function(zoom) {
55290       return zoom >= minZoom5;
55291     };
55292     init2();
55293     return drawImages;
55294   }
55295   var init_streetside = __esm({
55296     "modules/svg/streetside.js"() {
55297       "use strict";
55298       init_throttle();
55299       init_src5();
55300       init_helpers();
55301       init_services();
55302     }
55303   });
55304
55305   // modules/svg/vegbilder.js
55306   var vegbilder_exports = {};
55307   __export(vegbilder_exports, {
55308     svgVegbilder: () => svgVegbilder
55309   });
55310   function svgVegbilder(projection2, context, dispatch14) {
55311     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
55312     const minZoom5 = 14;
55313     const minMarkerZoom = 16;
55314     const minViewfieldZoom2 = 18;
55315     let layer = select_default2(null);
55316     let _viewerYaw = 0;
55317     let _vegbilder;
55318     function init2() {
55319       if (svgVegbilder.initialized) return;
55320       svgVegbilder.enabled = false;
55321       svgVegbilder.initialized = true;
55322     }
55323     function getService() {
55324       if (services.vegbilder && !_vegbilder) {
55325         _vegbilder = services.vegbilder;
55326         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
55327       } else if (!services.vegbilder && _vegbilder) {
55328         _vegbilder = null;
55329       }
55330       return _vegbilder;
55331     }
55332     function showLayer() {
55333       const service = getService();
55334       if (!service) return;
55335       editOn();
55336       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
55337     }
55338     function hideLayer() {
55339       throttledRedraw.cancel();
55340       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55341     }
55342     function editOn() {
55343       layer.style("display", "block");
55344     }
55345     function editOff() {
55346       layer.selectAll(".viewfield-group").remove();
55347       layer.style("display", "none");
55348     }
55349     function click(d3_event, d2) {
55350       const service = getService();
55351       if (!service) return;
55352       service.ensureViewerLoaded(context).then(() => {
55353         service.selectImage(context, d2.key).showViewer(context);
55354       });
55355       context.map().centerEase(d2.loc);
55356     }
55357     function mouseover(d3_event, d2) {
55358       const service = getService();
55359       if (service) service.setStyles(context, d2);
55360     }
55361     function mouseout() {
55362       const service = getService();
55363       if (service) service.setStyles(context, null);
55364     }
55365     function transform2(d2, selected) {
55366       let t2 = svgPointTransform(projection2)(d2);
55367       let rot = d2.ca;
55368       if (d2 === selected) {
55369         rot += _viewerYaw;
55370       }
55371       if (rot) {
55372         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
55373       }
55374       return t2;
55375     }
55376     function viewerChanged() {
55377       const service = getService();
55378       if (!service) return;
55379       const frame2 = service.photoFrame();
55380       if (!frame2) return;
55381       _viewerYaw = frame2.getYaw();
55382       if (context.map().isTransformed()) return;
55383       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
55384     }
55385     function filterImages(images) {
55386       const photoContext = context.photos();
55387       const fromDateString = photoContext.fromDate();
55388       const toDateString = photoContext.toDate();
55389       const showsFlat = photoContext.showsFlat();
55390       const showsPano = photoContext.showsPanoramic();
55391       if (fromDateString) {
55392         const fromDate = new Date(fromDateString);
55393         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
55394       }
55395       if (toDateString) {
55396         const toDate = new Date(toDateString);
55397         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
55398       }
55399       if (!showsPano) {
55400         images = images.filter((image) => !image.is_sphere);
55401       }
55402       if (!showsFlat) {
55403         images = images.filter((image) => image.is_sphere);
55404       }
55405       return images;
55406     }
55407     function filterSequences(sequences) {
55408       const photoContext = context.photos();
55409       const fromDateString = photoContext.fromDate();
55410       const toDateString = photoContext.toDate();
55411       const showsFlat = photoContext.showsFlat();
55412       const showsPano = photoContext.showsPanoramic();
55413       if (fromDateString) {
55414         const fromDate = new Date(fromDateString);
55415         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
55416       }
55417       if (toDateString) {
55418         const toDate = new Date(toDateString);
55419         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
55420       }
55421       if (!showsPano) {
55422         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
55423       }
55424       if (!showsFlat) {
55425         sequences = sequences.filter(({ images }) => images[0].is_sphere);
55426       }
55427       return sequences;
55428     }
55429     function update() {
55430       const viewer = context.container().select(".photoviewer");
55431       const selected = viewer.empty() ? void 0 : viewer.datum();
55432       const z2 = ~~context.map().zoom();
55433       const showMarkers = z2 >= minMarkerZoom;
55434       const showViewfields = z2 >= minViewfieldZoom2;
55435       const service = getService();
55436       let sequences = [];
55437       let images = [];
55438       if (service) {
55439         service.loadImages(context);
55440         sequences = service.sequences(projection2);
55441         images = showMarkers ? service.images(projection2) : [];
55442         dispatch14.call("photoDatesChanged", this, "vegbilder", images.map((p2) => p2.captured_at));
55443         images = filterImages(images);
55444         sequences = filterSequences(sequences);
55445       }
55446       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
55447       traces.exit().remove();
55448       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55449       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
55450       groups.exit().remove();
55451       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55452       groupsEnter.append("g").attr("class", "viewfield-scale");
55453       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
55454         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
55455       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
55456       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55457       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55458       viewfields.exit().remove();
55459       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55460       function viewfieldPath() {
55461         const d2 = this.parentNode.__data__;
55462         if (d2.is_sphere) {
55463           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55464         } else {
55465           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55466         }
55467       }
55468     }
55469     function drawImages(selection2) {
55470       const enabled = svgVegbilder.enabled;
55471       const service = getService();
55472       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
55473       layer.exit().remove();
55474       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
55475       layerEnter.append("g").attr("class", "sequences");
55476       layerEnter.append("g").attr("class", "markers");
55477       layer = layerEnter.merge(layer);
55478       if (enabled) {
55479         if (service && ~~context.map().zoom() >= minZoom5) {
55480           editOn();
55481           update();
55482           service.loadImages(context);
55483         } else {
55484           editOff();
55485         }
55486       }
55487     }
55488     drawImages.enabled = function(_2) {
55489       if (!arguments.length) return svgVegbilder.enabled;
55490       svgVegbilder.enabled = _2;
55491       if (svgVegbilder.enabled) {
55492         showLayer();
55493         context.photos().on("change.vegbilder", update);
55494       } else {
55495         hideLayer();
55496         context.photos().on("change.vegbilder", null);
55497       }
55498       dispatch14.call("change");
55499       return this;
55500     };
55501     drawImages.supported = function() {
55502       return !!getService();
55503     };
55504     drawImages.rendered = function(zoom) {
55505       return zoom >= minZoom5;
55506     };
55507     drawImages.validHere = function(extent, zoom) {
55508       return zoom >= minZoom5 - 2 && getService().validHere(extent);
55509     };
55510     init2();
55511     return drawImages;
55512   }
55513   var init_vegbilder = __esm({
55514     "modules/svg/vegbilder.js"() {
55515       "use strict";
55516       init_throttle();
55517       init_src5();
55518       init_helpers();
55519       init_services();
55520     }
55521   });
55522
55523   // modules/svg/mapillary_images.js
55524   var mapillary_images_exports = {};
55525   __export(mapillary_images_exports, {
55526     svgMapillaryImages: () => svgMapillaryImages
55527   });
55528   function svgMapillaryImages(projection2, context, dispatch14) {
55529     const throttledRedraw = throttle_default(function() {
55530       dispatch14.call("change");
55531     }, 1e3);
55532     const minZoom5 = 12;
55533     const minMarkerZoom = 16;
55534     const minViewfieldZoom2 = 18;
55535     let layer = select_default2(null);
55536     let _mapillary;
55537     function init2() {
55538       if (svgMapillaryImages.initialized) return;
55539       svgMapillaryImages.enabled = false;
55540       svgMapillaryImages.initialized = true;
55541     }
55542     function getService() {
55543       if (services.mapillary && !_mapillary) {
55544         _mapillary = services.mapillary;
55545         _mapillary.event.on("loadedImages", throttledRedraw);
55546       } else if (!services.mapillary && _mapillary) {
55547         _mapillary = null;
55548       }
55549       return _mapillary;
55550     }
55551     function showLayer() {
55552       const service = getService();
55553       if (!service) return;
55554       editOn();
55555       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55556         dispatch14.call("change");
55557       });
55558     }
55559     function hideLayer() {
55560       throttledRedraw.cancel();
55561       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55562     }
55563     function editOn() {
55564       layer.style("display", "block");
55565     }
55566     function editOff() {
55567       layer.selectAll(".viewfield-group").remove();
55568       layer.style("display", "none");
55569     }
55570     function click(d3_event, image) {
55571       const service = getService();
55572       if (!service) return;
55573       service.ensureViewerLoaded(context).then(function() {
55574         service.selectImage(context, image.id).showViewer(context);
55575       });
55576       context.map().centerEase(image.loc);
55577     }
55578     function mouseover(d3_event, image) {
55579       const service = getService();
55580       if (service) service.setStyles(context, image);
55581     }
55582     function mouseout() {
55583       const service = getService();
55584       if (service) service.setStyles(context, null);
55585     }
55586     function transform2(d2) {
55587       let t2 = svgPointTransform(projection2)(d2);
55588       if (d2.ca) {
55589         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55590       }
55591       return t2;
55592     }
55593     function filterImages(images) {
55594       const showsPano = context.photos().showsPanoramic();
55595       const showsFlat = context.photos().showsFlat();
55596       const fromDate = context.photos().fromDate();
55597       const toDate = context.photos().toDate();
55598       if (!showsPano || !showsFlat) {
55599         images = images.filter(function(image) {
55600           if (image.is_pano) return showsPano;
55601           return showsFlat;
55602         });
55603       }
55604       if (fromDate) {
55605         images = images.filter(function(image) {
55606           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
55607         });
55608       }
55609       if (toDate) {
55610         images = images.filter(function(image) {
55611           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
55612         });
55613       }
55614       return images;
55615     }
55616     function filterSequences(sequences) {
55617       const showsPano = context.photos().showsPanoramic();
55618       const showsFlat = context.photos().showsFlat();
55619       const fromDate = context.photos().fromDate();
55620       const toDate = context.photos().toDate();
55621       if (!showsPano || !showsFlat) {
55622         sequences = sequences.filter(function(sequence) {
55623           if (sequence.properties.hasOwnProperty("is_pano")) {
55624             if (sequence.properties.is_pano) return showsPano;
55625             return showsFlat;
55626           }
55627           return false;
55628         });
55629       }
55630       if (fromDate) {
55631         sequences = sequences.filter(function(sequence) {
55632           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
55633         });
55634       }
55635       if (toDate) {
55636         sequences = sequences.filter(function(sequence) {
55637           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
55638         });
55639       }
55640       return sequences;
55641     }
55642     function update() {
55643       const z2 = ~~context.map().zoom();
55644       const showMarkers = z2 >= minMarkerZoom;
55645       const showViewfields = z2 >= minViewfieldZoom2;
55646       const service = getService();
55647       let sequences = service ? service.sequences(projection2) : [];
55648       let images = service && showMarkers ? service.images(projection2) : [];
55649       dispatch14.call("photoDatesChanged", this, "mapillary", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
55650       images = filterImages(images);
55651       sequences = filterSequences(sequences, service);
55652       service.filterViewer(context);
55653       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55654         return d2.properties.id;
55655       });
55656       traces.exit().remove();
55657       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55658       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
55659         return d2.id;
55660       });
55661       groups.exit().remove();
55662       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55663       groupsEnter.append("g").attr("class", "viewfield-scale");
55664       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55665         return b2.loc[1] - a2.loc[1];
55666       }).attr("transform", transform2).select(".viewfield-scale");
55667       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55668       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55669       viewfields.exit().remove();
55670       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
55671         return this.parentNode.__data__.is_pano;
55672       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55673       function viewfieldPath() {
55674         if (this.parentNode.__data__.is_pano) {
55675           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55676         } else {
55677           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55678         }
55679       }
55680     }
55681     function drawImages(selection2) {
55682       const enabled = svgMapillaryImages.enabled;
55683       const service = getService();
55684       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
55685       layer.exit().remove();
55686       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
55687       layerEnter.append("g").attr("class", "sequences");
55688       layerEnter.append("g").attr("class", "markers");
55689       layer = layerEnter.merge(layer);
55690       if (enabled) {
55691         if (service && ~~context.map().zoom() >= minZoom5) {
55692           editOn();
55693           update();
55694           service.loadImages(projection2);
55695         } else {
55696           dispatch14.call("photoDatesChanged", this, "mapillary", []);
55697           editOff();
55698         }
55699       } else {
55700         dispatch14.call("photoDatesChanged", this, "mapillary", []);
55701       }
55702     }
55703     drawImages.enabled = function(_2) {
55704       if (!arguments.length) return svgMapillaryImages.enabled;
55705       svgMapillaryImages.enabled = _2;
55706       if (svgMapillaryImages.enabled) {
55707         showLayer();
55708         context.photos().on("change.mapillary_images", update);
55709       } else {
55710         hideLayer();
55711         context.photos().on("change.mapillary_images", null);
55712       }
55713       dispatch14.call("change");
55714       return this;
55715     };
55716     drawImages.supported = function() {
55717       return !!getService();
55718     };
55719     drawImages.rendered = function(zoom) {
55720       return zoom >= minZoom5;
55721     };
55722     init2();
55723     return drawImages;
55724   }
55725   var init_mapillary_images = __esm({
55726     "modules/svg/mapillary_images.js"() {
55727       "use strict";
55728       init_throttle();
55729       init_src5();
55730       init_helpers();
55731       init_services();
55732     }
55733   });
55734
55735   // modules/svg/mapillary_position.js
55736   var mapillary_position_exports = {};
55737   __export(mapillary_position_exports, {
55738     svgMapillaryPosition: () => svgMapillaryPosition
55739   });
55740   function svgMapillaryPosition(projection2, context) {
55741     const throttledRedraw = throttle_default(function() {
55742       update();
55743     }, 1e3);
55744     const minZoom5 = 12;
55745     const minViewfieldZoom2 = 18;
55746     let layer = select_default2(null);
55747     let _mapillary;
55748     let viewerCompassAngle;
55749     function init2() {
55750       if (svgMapillaryPosition.initialized) return;
55751       svgMapillaryPosition.initialized = true;
55752     }
55753     function getService() {
55754       if (services.mapillary && !_mapillary) {
55755         _mapillary = services.mapillary;
55756         _mapillary.event.on("imageChanged", throttledRedraw);
55757         _mapillary.event.on("bearingChanged", function(e3) {
55758           viewerCompassAngle = e3.bearing;
55759           if (context.map().isTransformed()) return;
55760           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
55761             return d2.is_pano;
55762           }).attr("transform", transform2);
55763         });
55764       } else if (!services.mapillary && _mapillary) {
55765         _mapillary = null;
55766       }
55767       return _mapillary;
55768     }
55769     function editOn() {
55770       layer.style("display", "block");
55771     }
55772     function editOff() {
55773       layer.selectAll(".viewfield-group").remove();
55774       layer.style("display", "none");
55775     }
55776     function transform2(d2) {
55777       let t2 = svgPointTransform(projection2)(d2);
55778       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
55779         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
55780       } else if (d2.ca) {
55781         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55782       }
55783       return t2;
55784     }
55785     function update() {
55786       const z2 = ~~context.map().zoom();
55787       const showViewfields = z2 >= minViewfieldZoom2;
55788       const service = getService();
55789       const image = service && service.getActiveImage();
55790       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
55791         return d2.id;
55792       });
55793       groups.exit().remove();
55794       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
55795       groupsEnter.append("g").attr("class", "viewfield-scale");
55796       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
55797       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55798       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55799       viewfields.exit().remove();
55800       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");
55801     }
55802     function drawImages(selection2) {
55803       const service = getService();
55804       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
55805       layer.exit().remove();
55806       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
55807       layerEnter.append("g").attr("class", "markers");
55808       layer = layerEnter.merge(layer);
55809       if (service && ~~context.map().zoom() >= minZoom5) {
55810         editOn();
55811         update();
55812       } else {
55813         editOff();
55814       }
55815     }
55816     drawImages.enabled = function() {
55817       update();
55818       return this;
55819     };
55820     drawImages.supported = function() {
55821       return !!getService();
55822     };
55823     drawImages.rendered = function(zoom) {
55824       return zoom >= minZoom5;
55825     };
55826     init2();
55827     return drawImages;
55828   }
55829   var init_mapillary_position = __esm({
55830     "modules/svg/mapillary_position.js"() {
55831       "use strict";
55832       init_throttle();
55833       init_src5();
55834       init_helpers();
55835       init_services();
55836     }
55837   });
55838
55839   // modules/svg/mapillary_signs.js
55840   var mapillary_signs_exports = {};
55841   __export(mapillary_signs_exports, {
55842     svgMapillarySigns: () => svgMapillarySigns
55843   });
55844   function svgMapillarySigns(projection2, context, dispatch14) {
55845     const throttledRedraw = throttle_default(function() {
55846       dispatch14.call("change");
55847     }, 1e3);
55848     const minZoom5 = 12;
55849     let layer = select_default2(null);
55850     let _mapillary;
55851     function init2() {
55852       if (svgMapillarySigns.initialized) return;
55853       svgMapillarySigns.enabled = false;
55854       svgMapillarySigns.initialized = true;
55855     }
55856     function getService() {
55857       if (services.mapillary && !_mapillary) {
55858         _mapillary = services.mapillary;
55859         _mapillary.event.on("loadedSigns", throttledRedraw);
55860       } else if (!services.mapillary && _mapillary) {
55861         _mapillary = null;
55862       }
55863       return _mapillary;
55864     }
55865     function showLayer() {
55866       const service = getService();
55867       if (!service) return;
55868       service.loadSignResources(context);
55869       editOn();
55870     }
55871     function hideLayer() {
55872       throttledRedraw.cancel();
55873       editOff();
55874     }
55875     function editOn() {
55876       layer.style("display", "block");
55877     }
55878     function editOff() {
55879       layer.selectAll(".icon-sign").remove();
55880       layer.style("display", "none");
55881     }
55882     function click(d3_event, d2) {
55883       const service = getService();
55884       if (!service) return;
55885       context.map().centerEase(d2.loc);
55886       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
55887       service.getDetections(d2.id).then((detections) => {
55888         if (detections.length) {
55889           const imageId = detections[0].image.id;
55890           if (imageId === selectedImageId) {
55891             service.highlightDetection(detections[0]).selectImage(context, imageId);
55892           } else {
55893             service.ensureViewerLoaded(context).then(function() {
55894               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
55895             });
55896           }
55897         }
55898       });
55899     }
55900     function filterData(detectedFeatures) {
55901       var fromDate = context.photos().fromDate();
55902       var toDate = context.photos().toDate();
55903       if (fromDate) {
55904         var fromTimestamp = new Date(fromDate).getTime();
55905         detectedFeatures = detectedFeatures.filter(function(feature3) {
55906           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
55907         });
55908       }
55909       if (toDate) {
55910         var toTimestamp = new Date(toDate).getTime();
55911         detectedFeatures = detectedFeatures.filter(function(feature3) {
55912           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
55913         });
55914       }
55915       return detectedFeatures;
55916     }
55917     function update() {
55918       const service = getService();
55919       let data = service ? service.signs(projection2) : [];
55920       data = filterData(data);
55921       const transform2 = svgPointTransform(projection2);
55922       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
55923         return d2.id;
55924       });
55925       signs.exit().remove();
55926       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
55927       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
55928         return "#" + d2.value;
55929       });
55930       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
55931       signs.merge(enter).attr("transform", transform2);
55932     }
55933     function drawSigns(selection2) {
55934       const enabled = svgMapillarySigns.enabled;
55935       const service = getService();
55936       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
55937       layer.exit().remove();
55938       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
55939       if (enabled) {
55940         if (service && ~~context.map().zoom() >= minZoom5) {
55941           editOn();
55942           update();
55943           service.loadSigns(projection2);
55944           service.showSignDetections(true);
55945         } else {
55946           editOff();
55947         }
55948       } else if (service) {
55949         service.showSignDetections(false);
55950       }
55951     }
55952     drawSigns.enabled = function(_2) {
55953       if (!arguments.length) return svgMapillarySigns.enabled;
55954       svgMapillarySigns.enabled = _2;
55955       if (svgMapillarySigns.enabled) {
55956         showLayer();
55957         context.photos().on("change.mapillary_signs", update);
55958       } else {
55959         hideLayer();
55960         context.photos().on("change.mapillary_signs", null);
55961       }
55962       dispatch14.call("change");
55963       return this;
55964     };
55965     drawSigns.supported = function() {
55966       return !!getService();
55967     };
55968     drawSigns.rendered = function(zoom) {
55969       return zoom >= minZoom5;
55970     };
55971     init2();
55972     return drawSigns;
55973   }
55974   var init_mapillary_signs = __esm({
55975     "modules/svg/mapillary_signs.js"() {
55976       "use strict";
55977       init_throttle();
55978       init_src5();
55979       init_helpers();
55980       init_services();
55981     }
55982   });
55983
55984   // modules/svg/mapillary_map_features.js
55985   var mapillary_map_features_exports = {};
55986   __export(mapillary_map_features_exports, {
55987     svgMapillaryMapFeatures: () => svgMapillaryMapFeatures
55988   });
55989   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
55990     const throttledRedraw = throttle_default(function() {
55991       dispatch14.call("change");
55992     }, 1e3);
55993     const minZoom5 = 12;
55994     let layer = select_default2(null);
55995     let _mapillary;
55996     function init2() {
55997       if (svgMapillaryMapFeatures.initialized) return;
55998       svgMapillaryMapFeatures.enabled = false;
55999       svgMapillaryMapFeatures.initialized = true;
56000     }
56001     function getService() {
56002       if (services.mapillary && !_mapillary) {
56003         _mapillary = services.mapillary;
56004         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
56005       } else if (!services.mapillary && _mapillary) {
56006         _mapillary = null;
56007       }
56008       return _mapillary;
56009     }
56010     function showLayer() {
56011       const service = getService();
56012       if (!service) return;
56013       service.loadObjectResources(context);
56014       editOn();
56015     }
56016     function hideLayer() {
56017       throttledRedraw.cancel();
56018       editOff();
56019     }
56020     function editOn() {
56021       layer.style("display", "block");
56022     }
56023     function editOff() {
56024       layer.selectAll(".icon-map-feature").remove();
56025       layer.style("display", "none");
56026     }
56027     function click(d3_event, d2) {
56028       const service = getService();
56029       if (!service) return;
56030       context.map().centerEase(d2.loc);
56031       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
56032       service.getDetections(d2.id).then((detections) => {
56033         if (detections.length) {
56034           const imageId = detections[0].image.id;
56035           if (imageId === selectedImageId) {
56036             service.highlightDetection(detections[0]).selectImage(context, imageId);
56037           } else {
56038             service.ensureViewerLoaded(context).then(function() {
56039               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
56040             });
56041           }
56042         }
56043       });
56044     }
56045     function filterData(detectedFeatures) {
56046       const fromDate = context.photos().fromDate();
56047       const toDate = context.photos().toDate();
56048       if (fromDate) {
56049         detectedFeatures = detectedFeatures.filter(function(feature3) {
56050           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
56051         });
56052       }
56053       if (toDate) {
56054         detectedFeatures = detectedFeatures.filter(function(feature3) {
56055           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
56056         });
56057       }
56058       return detectedFeatures;
56059     }
56060     function update() {
56061       const service = getService();
56062       let data = service ? service.mapFeatures(projection2) : [];
56063       data = filterData(data);
56064       const transform2 = svgPointTransform(projection2);
56065       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
56066         return d2.id;
56067       });
56068       mapFeatures.exit().remove();
56069       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
56070       enter.append("title").text(function(d2) {
56071         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
56072         return _t("mapillary_map_features." + id2);
56073       });
56074       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
56075         if (d2.value === "object--billboard") {
56076           return "#object--sign--advertisement";
56077         }
56078         return "#" + d2.value;
56079       });
56080       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
56081       mapFeatures.merge(enter).attr("transform", transform2);
56082     }
56083     function drawMapFeatures(selection2) {
56084       const enabled = svgMapillaryMapFeatures.enabled;
56085       const service = getService();
56086       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
56087       layer.exit().remove();
56088       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
56089       if (enabled) {
56090         if (service && ~~context.map().zoom() >= minZoom5) {
56091           editOn();
56092           update();
56093           service.loadMapFeatures(projection2);
56094           service.showFeatureDetections(true);
56095         } else {
56096           editOff();
56097         }
56098       } else if (service) {
56099         service.showFeatureDetections(false);
56100       }
56101     }
56102     drawMapFeatures.enabled = function(_2) {
56103       if (!arguments.length) return svgMapillaryMapFeatures.enabled;
56104       svgMapillaryMapFeatures.enabled = _2;
56105       if (svgMapillaryMapFeatures.enabled) {
56106         showLayer();
56107         context.photos().on("change.mapillary_map_features", update);
56108       } else {
56109         hideLayer();
56110         context.photos().on("change.mapillary_map_features", null);
56111       }
56112       dispatch14.call("change");
56113       return this;
56114     };
56115     drawMapFeatures.supported = function() {
56116       return !!getService();
56117     };
56118     drawMapFeatures.rendered = function(zoom) {
56119       return zoom >= minZoom5;
56120     };
56121     init2();
56122     return drawMapFeatures;
56123   }
56124   var init_mapillary_map_features = __esm({
56125     "modules/svg/mapillary_map_features.js"() {
56126       "use strict";
56127       init_throttle();
56128       init_src5();
56129       init_helpers();
56130       init_services();
56131       init_localizer();
56132     }
56133   });
56134
56135   // modules/svg/kartaview_images.js
56136   var kartaview_images_exports = {};
56137   __export(kartaview_images_exports, {
56138     svgKartaviewImages: () => svgKartaviewImages
56139   });
56140   function svgKartaviewImages(projection2, context, dispatch14) {
56141     var throttledRedraw = throttle_default(function() {
56142       dispatch14.call("change");
56143     }, 1e3);
56144     var minZoom5 = 12;
56145     var minMarkerZoom = 16;
56146     var minViewfieldZoom2 = 18;
56147     var layer = select_default2(null);
56148     var _kartaview;
56149     function init2() {
56150       if (svgKartaviewImages.initialized) return;
56151       svgKartaviewImages.enabled = false;
56152       svgKartaviewImages.initialized = true;
56153     }
56154     function getService() {
56155       if (services.kartaview && !_kartaview) {
56156         _kartaview = services.kartaview;
56157         _kartaview.event.on("loadedImages", throttledRedraw);
56158       } else if (!services.kartaview && _kartaview) {
56159         _kartaview = null;
56160       }
56161       return _kartaview;
56162     }
56163     function showLayer() {
56164       var service = getService();
56165       if (!service) return;
56166       editOn();
56167       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
56168         dispatch14.call("change");
56169       });
56170     }
56171     function hideLayer() {
56172       throttledRedraw.cancel();
56173       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
56174     }
56175     function editOn() {
56176       layer.style("display", "block");
56177     }
56178     function editOff() {
56179       layer.selectAll(".viewfield-group").remove();
56180       layer.style("display", "none");
56181     }
56182     function click(d3_event, d2) {
56183       var service = getService();
56184       if (!service) return;
56185       service.ensureViewerLoaded(context).then(function() {
56186         service.selectImage(context, d2.key).showViewer(context);
56187       });
56188       context.map().centerEase(d2.loc);
56189     }
56190     function mouseover(d3_event, d2) {
56191       var service = getService();
56192       if (service) service.setStyles(context, d2);
56193     }
56194     function mouseout() {
56195       var service = getService();
56196       if (service) service.setStyles(context, null);
56197     }
56198     function transform2(d2) {
56199       var t2 = svgPointTransform(projection2)(d2);
56200       if (d2.ca) {
56201         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
56202       }
56203       return t2;
56204     }
56205     function filterImages(images) {
56206       var fromDate = context.photos().fromDate();
56207       var toDate = context.photos().toDate();
56208       var usernames = context.photos().usernames();
56209       if (fromDate) {
56210         var fromTimestamp = new Date(fromDate).getTime();
56211         images = images.filter(function(item) {
56212           return new Date(item.captured_at).getTime() >= fromTimestamp;
56213         });
56214       }
56215       if (toDate) {
56216         var toTimestamp = new Date(toDate).getTime();
56217         images = images.filter(function(item) {
56218           return new Date(item.captured_at).getTime() <= toTimestamp;
56219         });
56220       }
56221       if (usernames) {
56222         images = images.filter(function(item) {
56223           return usernames.indexOf(item.captured_by) !== -1;
56224         });
56225       }
56226       return images;
56227     }
56228     function filterSequences(sequences) {
56229       var fromDate = context.photos().fromDate();
56230       var toDate = context.photos().toDate();
56231       var usernames = context.photos().usernames();
56232       if (fromDate) {
56233         var fromTimestamp = new Date(fromDate).getTime();
56234         sequences = sequences.filter(function(sequence) {
56235           return new Date(sequence.properties.captured_at).getTime() >= fromTimestamp;
56236         });
56237       }
56238       if (toDate) {
56239         var toTimestamp = new Date(toDate).getTime();
56240         sequences = sequences.filter(function(sequence) {
56241           return new Date(sequence.properties.captured_at).getTime() <= toTimestamp;
56242         });
56243       }
56244       if (usernames) {
56245         sequences = sequences.filter(function(sequence) {
56246           return usernames.indexOf(sequence.properties.captured_by) !== -1;
56247         });
56248       }
56249       return sequences;
56250     }
56251     function update() {
56252       var viewer = context.container().select(".photoviewer");
56253       var selected = viewer.empty() ? void 0 : viewer.datum();
56254       var z2 = ~~context.map().zoom();
56255       var showMarkers = z2 >= minMarkerZoom;
56256       var showViewfields = z2 >= minViewfieldZoom2;
56257       var service = getService();
56258       var sequences = [];
56259       var images = [];
56260       sequences = service ? service.sequences(projection2) : [];
56261       images = service && showMarkers ? service.images(projection2) : [];
56262       dispatch14.call("photoDatesChanged", this, "kartaview", [...images.map((p2) => p2.captured_at), ...sequences.map((s2) => s2.properties.captured_at)]);
56263       sequences = filterSequences(sequences);
56264       images = filterImages(images);
56265       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56266         return d2.properties.key;
56267       });
56268       traces.exit().remove();
56269       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56270       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56271         return d2.key;
56272       });
56273       groups.exit().remove();
56274       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56275       groupsEnter.append("g").attr("class", "viewfield-scale");
56276       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56277         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
56278       }).attr("transform", transform2).select(".viewfield-scale");
56279       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56280       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56281       viewfields.exit().remove();
56282       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");
56283     }
56284     function drawImages(selection2) {
56285       var enabled = svgKartaviewImages.enabled, service = getService();
56286       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
56287       layer.exit().remove();
56288       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
56289       layerEnter.append("g").attr("class", "sequences");
56290       layerEnter.append("g").attr("class", "markers");
56291       layer = layerEnter.merge(layer);
56292       if (enabled) {
56293         if (service && ~~context.map().zoom() >= minZoom5) {
56294           editOn();
56295           update();
56296           service.loadImages(projection2);
56297         } else {
56298           dispatch14.call("photoDatesChanged", this, "kartaview", []);
56299           editOff();
56300         }
56301       } else {
56302         dispatch14.call("photoDatesChanged", this, "kartaview", []);
56303       }
56304     }
56305     drawImages.enabled = function(_2) {
56306       if (!arguments.length) return svgKartaviewImages.enabled;
56307       svgKartaviewImages.enabled = _2;
56308       if (svgKartaviewImages.enabled) {
56309         showLayer();
56310         context.photos().on("change.kartaview_images", update);
56311       } else {
56312         hideLayer();
56313         context.photos().on("change.kartaview_images", null);
56314       }
56315       dispatch14.call("change");
56316       return this;
56317     };
56318     drawImages.supported = function() {
56319       return !!getService();
56320     };
56321     drawImages.rendered = function(zoom) {
56322       return zoom >= minZoom5;
56323     };
56324     init2();
56325     return drawImages;
56326   }
56327   var init_kartaview_images = __esm({
56328     "modules/svg/kartaview_images.js"() {
56329       "use strict";
56330       init_throttle();
56331       init_src5();
56332       init_helpers();
56333       init_services();
56334     }
56335   });
56336
56337   // modules/svg/mapilio_images.js
56338   var mapilio_images_exports = {};
56339   __export(mapilio_images_exports, {
56340     svgMapilioImages: () => svgMapilioImages
56341   });
56342   function svgMapilioImages(projection2, context, dispatch14) {
56343     const throttledRedraw = throttle_default(function() {
56344       dispatch14.call("change");
56345     }, 1e3);
56346     const minZoom5 = 12;
56347     let layer = select_default2(null);
56348     let _mapilio;
56349     const viewFieldZoomLevel = 18;
56350     function init2() {
56351       if (svgMapilioImages.initialized) return;
56352       svgMapilioImages.enabled = false;
56353       svgMapilioImages.initialized = true;
56354     }
56355     function getService() {
56356       if (services.mapilio && !_mapilio) {
56357         _mapilio = services.mapilio;
56358         _mapilio.event.on("loadedImages", throttledRedraw);
56359       } else if (!services.mapilio && _mapilio) {
56360         _mapilio = null;
56361       }
56362       return _mapilio;
56363     }
56364     function showLayer() {
56365       const service = getService();
56366       if (!service) return;
56367       editOn();
56368       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
56369         dispatch14.call("change");
56370       });
56371     }
56372     function hideLayer() {
56373       throttledRedraw.cancel();
56374       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
56375     }
56376     function transform2(d2) {
56377       let t2 = svgPointTransform(projection2)(d2);
56378       if (d2.heading) {
56379         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
56380       }
56381       return t2;
56382     }
56383     function editOn() {
56384       layer.style("display", "block");
56385     }
56386     function editOff() {
56387       layer.selectAll(".viewfield-group").remove();
56388       layer.style("display", "none");
56389     }
56390     function click(d3_event, image) {
56391       const service = getService();
56392       if (!service) return;
56393       service.ensureViewerLoaded(context, image.id).then(function() {
56394         service.selectImage(context, image.id).showViewer(context);
56395       });
56396       context.map().centerEase(image.loc);
56397     }
56398     function mouseover(d3_event, image) {
56399       const service = getService();
56400       if (service) service.setStyles(context, image);
56401     }
56402     function mouseout() {
56403       const service = getService();
56404       if (service) service.setStyles(context, null);
56405     }
56406     function filterImages(images) {
56407       var fromDate = context.photos().fromDate();
56408       var toDate = context.photos().toDate();
56409       if (fromDate) {
56410         var fromTimestamp = new Date(fromDate).getTime();
56411         images = images.filter(function(photo) {
56412           return new Date(photo.capture_time).getTime() >= fromTimestamp;
56413         });
56414       }
56415       if (toDate) {
56416         var toTimestamp = new Date(toDate).getTime();
56417         images = images.filter(function(photo) {
56418           return new Date(photo.capture_time).getTime() <= toTimestamp;
56419         });
56420       }
56421       return images;
56422     }
56423     function filterSequences(sequences) {
56424       var fromDate = context.photos().fromDate();
56425       var toDate = context.photos().toDate();
56426       if (fromDate) {
56427         var fromTimestamp = new Date(fromDate).getTime();
56428         sequences = sequences.filter(function(sequence) {
56429           return new Date(sequence.properties.capture_time).getTime() >= fromTimestamp;
56430         });
56431       }
56432       if (toDate) {
56433         var toTimestamp = new Date(toDate).getTime();
56434         sequences = sequences.filter(function(sequence) {
56435           return new Date(sequence.properties.capture_time).getTime() <= toTimestamp;
56436         });
56437       }
56438       return sequences;
56439     }
56440     function update() {
56441       const z2 = ~~context.map().zoom();
56442       const showViewfields = z2 >= viewFieldZoomLevel;
56443       const service = getService();
56444       let sequences = service ? service.sequences(projection2) : [];
56445       let images = service ? service.images(projection2) : [];
56446       dispatch14.call("photoDatesChanged", this, "mapilio", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.capture_time)]);
56447       sequences = filterSequences(sequences);
56448       images = filterImages(images);
56449       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56450         return d2.properties.id;
56451       });
56452       traces.exit().remove();
56453       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56454       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56455         return d2.id;
56456       });
56457       groups.exit().remove();
56458       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56459       groupsEnter.append("g").attr("class", "viewfield-scale");
56460       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56461         return b2.loc[1] - a2.loc[1];
56462       }).attr("transform", transform2).select(".viewfield-scale");
56463       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56464       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56465       viewfields.exit().remove();
56466       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
56467       function viewfieldPath() {
56468         if (this.parentNode.__data__.isPano) {
56469           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
56470         } else {
56471           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
56472         }
56473       }
56474     }
56475     function drawImages(selection2) {
56476       const enabled = svgMapilioImages.enabled;
56477       const service = getService();
56478       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
56479       layer.exit().remove();
56480       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
56481       layerEnter.append("g").attr("class", "sequences");
56482       layerEnter.append("g").attr("class", "markers");
56483       layer = layerEnter.merge(layer);
56484       if (enabled) {
56485         if (service && ~~context.map().zoom() >= minZoom5) {
56486           editOn();
56487           update();
56488           service.loadImages(projection2);
56489           service.loadLines(projection2);
56490         } else {
56491           dispatch14.call("photoDatesChanged", this, "mapilio", []);
56492           editOff();
56493         }
56494       } else {
56495         dispatch14.call("photoDatesChanged", this, "mapilio", []);
56496       }
56497     }
56498     drawImages.enabled = function(_2) {
56499       if (!arguments.length) return svgMapilioImages.enabled;
56500       svgMapilioImages.enabled = _2;
56501       if (svgMapilioImages.enabled) {
56502         showLayer();
56503         context.photos().on("change.mapilio_images", update);
56504       } else {
56505         hideLayer();
56506         context.photos().on("change.mapilio_images", null);
56507       }
56508       dispatch14.call("change");
56509       return this;
56510     };
56511     drawImages.supported = function() {
56512       return !!getService();
56513     };
56514     drawImages.rendered = function(zoom) {
56515       return zoom >= minZoom5;
56516     };
56517     init2();
56518     return drawImages;
56519   }
56520   var init_mapilio_images = __esm({
56521     "modules/svg/mapilio_images.js"() {
56522       "use strict";
56523       init_throttle();
56524       init_src5();
56525       init_services();
56526       init_helpers();
56527     }
56528   });
56529
56530   // modules/svg/panoramax_images.js
56531   var panoramax_images_exports = {};
56532   __export(panoramax_images_exports, {
56533     svgPanoramaxImages: () => svgPanoramaxImages
56534   });
56535   function svgPanoramaxImages(projection2, context, dispatch14) {
56536     const throttledRedraw = throttle_default(function() {
56537       dispatch14.call("change");
56538     }, 1e3);
56539     const imageMinZoom2 = 15;
56540     const lineMinZoom2 = 10;
56541     const viewFieldZoomLevel = 18;
56542     let layer = select_default2(null);
56543     let _panoramax;
56544     let _viewerYaw = 0;
56545     let _activeUsernameFilter;
56546     let _activeIds;
56547     function init2() {
56548       if (svgPanoramaxImages.initialized) return;
56549       svgPanoramaxImages.enabled = false;
56550       svgPanoramaxImages.initialized = true;
56551     }
56552     function getService() {
56553       if (services.panoramax && !_panoramax) {
56554         _panoramax = services.panoramax;
56555         _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
56556       } else if (!services.panoramax && _panoramax) {
56557         _panoramax = null;
56558       }
56559       return _panoramax;
56560     }
56561     async function filterImages(images) {
56562       const showsPano = context.photos().showsPanoramic();
56563       const showsFlat = context.photos().showsFlat();
56564       const fromDate = context.photos().fromDate();
56565       const toDate = context.photos().toDate();
56566       const username = context.photos().usernames();
56567       const service = getService();
56568       if (!showsPano || !showsFlat) {
56569         images = images.filter(function(image) {
56570           if (image.isPano) return showsPano;
56571           return showsFlat;
56572         });
56573       }
56574       if (fromDate) {
56575         images = images.filter(function(image) {
56576           return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
56577         });
56578       }
56579       if (toDate) {
56580         images = images.filter(function(image) {
56581           return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
56582         });
56583       }
56584       if (username && service) {
56585         if (_activeUsernameFilter !== username) {
56586           _activeUsernameFilter = username;
56587           const tempIds = await service.getUserIds(username);
56588           _activeIds = {};
56589           tempIds.forEach((id2) => {
56590             _activeIds[id2] = true;
56591           });
56592         }
56593         images = images.filter(function(image) {
56594           return _activeIds[image.account_id];
56595         });
56596       }
56597       return images;
56598     }
56599     async function filterSequences(sequences) {
56600       const showsPano = context.photos().showsPanoramic();
56601       const showsFlat = context.photos().showsFlat();
56602       const fromDate = context.photos().fromDate();
56603       const toDate = context.photos().toDate();
56604       const username = context.photos().usernames();
56605       const service = getService();
56606       if (!showsPano || !showsFlat) {
56607         sequences = sequences.filter(function(sequence) {
56608           if (sequence.properties.type === "equirectangular") return showsPano;
56609           return showsFlat;
56610         });
56611       }
56612       if (fromDate) {
56613         sequences = sequences.filter(function(sequence) {
56614           return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
56615         });
56616       }
56617       if (toDate) {
56618         sequences = sequences.filter(function(sequence) {
56619           return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
56620         });
56621       }
56622       if (username && service) {
56623         if (_activeUsernameFilter !== username) {
56624           _activeUsernameFilter = username;
56625           const tempIds = await service.getUserIds(username);
56626           _activeIds = {};
56627           tempIds.forEach((id2) => {
56628             _activeIds[id2] = true;
56629           });
56630         }
56631         sequences = sequences.filter(function(sequence) {
56632           return _activeIds[sequence.properties.account_id];
56633         });
56634       }
56635       return sequences;
56636     }
56637     function showLayer() {
56638       const service = getService();
56639       if (!service) return;
56640       editOn();
56641       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
56642         dispatch14.call("change");
56643       });
56644     }
56645     function hideLayer() {
56646       throttledRedraw.cancel();
56647       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
56648     }
56649     function transform2(d2, selectedImageId) {
56650       let t2 = svgPointTransform(projection2)(d2);
56651       let rot = d2.heading;
56652       if (d2.id === selectedImageId) {
56653         rot += _viewerYaw;
56654       }
56655       if (rot) {
56656         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
56657       }
56658       return t2;
56659     }
56660     function editOn() {
56661       layer.style("display", "block");
56662     }
56663     function editOff() {
56664       layer.selectAll(".viewfield-group").remove();
56665       layer.style("display", "none");
56666     }
56667     function click(d3_event, image) {
56668       const service = getService();
56669       if (!service) return;
56670       service.ensureViewerLoaded(context).then(function() {
56671         service.selectImage(context, image.id).showViewer(context);
56672       });
56673       context.map().centerEase(image.loc);
56674     }
56675     function mouseover(d3_event, image) {
56676       const service = getService();
56677       if (service) service.setStyles(context, image);
56678     }
56679     function mouseout() {
56680       const service = getService();
56681       if (service) service.setStyles(context, null);
56682     }
56683     async function update() {
56684       var _a3;
56685       const zoom = ~~context.map().zoom();
56686       const showViewfields = zoom >= viewFieldZoomLevel;
56687       const service = getService();
56688       let sequences = service ? service.sequences(projection2, zoom) : [];
56689       let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
56690       dispatch14.call("photoDatesChanged", this, "panoramax", [...images.map((p2) => p2.capture_time), ...sequences.map((s2) => s2.properties.date)]);
56691       images = await filterImages(images);
56692       sequences = await filterSequences(sequences, service);
56693       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
56694         return d2.properties.id;
56695       });
56696       traces.exit().remove();
56697       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
56698       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
56699         return d2.id;
56700       });
56701       groups.exit().remove();
56702       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
56703       groupsEnter.append("g").attr("class", "viewfield-scale");
56704       const activeImageId = (_a3 = service.getActiveImage()) == null ? void 0 : _a3.id;
56705       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
56706         if (a2.id === activeImageId) return 1;
56707         if (b2.id === activeImageId) return -1;
56708         return a2.capture_time_parsed - b2.capture_time_parsed;
56709       }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
56710       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
56711       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
56712       viewfields.exit().remove();
56713       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
56714       service.setStyles(context, null);
56715       function viewfieldPath() {
56716         if (this.parentNode.__data__.isPano) {
56717           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
56718         } else {
56719           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
56720         }
56721       }
56722     }
56723     function viewerChanged() {
56724       const service = getService();
56725       if (!service) return;
56726       const frame2 = service.photoFrame();
56727       if (!frame2) return;
56728       _viewerYaw = frame2.getYaw();
56729       if (context.map().isTransformed()) return;
56730       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
56731     }
56732     function drawImages(selection2) {
56733       const enabled = svgPanoramaxImages.enabled;
56734       const service = getService();
56735       layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
56736       layer.exit().remove();
56737       const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
56738       layerEnter.append("g").attr("class", "sequences");
56739       layerEnter.append("g").attr("class", "markers");
56740       layer = layerEnter.merge(layer);
56741       if (enabled) {
56742         let zoom = ~~context.map().zoom();
56743         if (service) {
56744           if (zoom >= imageMinZoom2) {
56745             editOn();
56746             update();
56747             service.loadImages(projection2);
56748           } else if (zoom >= lineMinZoom2) {
56749             editOn();
56750             update();
56751             service.loadLines(projection2, zoom);
56752           } else {
56753             editOff();
56754             dispatch14.call("photoDatesChanged", this, "panoramax", []);
56755           }
56756         } else {
56757           editOff();
56758         }
56759       } else {
56760         dispatch14.call("photoDatesChanged", this, "panoramax", []);
56761       }
56762     }
56763     drawImages.enabled = function(_2) {
56764       if (!arguments.length) return svgPanoramaxImages.enabled;
56765       svgPanoramaxImages.enabled = _2;
56766       if (svgPanoramaxImages.enabled) {
56767         showLayer();
56768         context.photos().on("change.panoramax_images", update);
56769       } else {
56770         hideLayer();
56771         context.photos().on("change.panoramax_images", null);
56772       }
56773       dispatch14.call("change");
56774       return this;
56775     };
56776     drawImages.supported = function() {
56777       return !!getService();
56778     };
56779     drawImages.rendered = function(zoom) {
56780       return zoom >= lineMinZoom2;
56781     };
56782     init2();
56783     return drawImages;
56784   }
56785   var init_panoramax_images = __esm({
56786     "modules/svg/panoramax_images.js"() {
56787       "use strict";
56788       init_throttle();
56789       init_src5();
56790       init_services();
56791       init_helpers();
56792     }
56793   });
56794
56795   // modules/svg/osm.js
56796   var osm_exports2 = {};
56797   __export(osm_exports2, {
56798     svgOsm: () => svgOsm
56799   });
56800   function svgOsm(projection2, context, dispatch14) {
56801     var enabled = true;
56802     function drawOsm(selection2) {
56803       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
56804         return "layer-osm " + d2;
56805       });
56806       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["vertices", "midpoints", "points", "turns"]).enter().append("g").attr("class", function(d2) {
56807         return "points-group " + d2;
56808       });
56809     }
56810     function showLayer() {
56811       var layer = context.surface().selectAll(".data-layer.osm");
56812       layer.interrupt();
56813       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
56814         dispatch14.call("change");
56815       });
56816     }
56817     function hideLayer() {
56818       var layer = context.surface().selectAll(".data-layer.osm");
56819       layer.interrupt();
56820       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
56821         layer.classed("disabled", true);
56822         dispatch14.call("change");
56823       });
56824     }
56825     drawOsm.enabled = function(val) {
56826       if (!arguments.length) return enabled;
56827       enabled = val;
56828       if (enabled) {
56829         showLayer();
56830       } else {
56831         hideLayer();
56832       }
56833       dispatch14.call("change");
56834       return this;
56835     };
56836     return drawOsm;
56837   }
56838   var init_osm2 = __esm({
56839     "modules/svg/osm.js"() {
56840       "use strict";
56841     }
56842   });
56843
56844   // modules/svg/notes.js
56845   var notes_exports = {};
56846   __export(notes_exports, {
56847     svgNotes: () => svgNotes
56848   });
56849   function svgNotes(projection2, context, dispatch14) {
56850     if (!dispatch14) {
56851       dispatch14 = dispatch_default("change");
56852     }
56853     var throttledRedraw = throttle_default(function() {
56854       dispatch14.call("change");
56855     }, 1e3);
56856     var minZoom5 = 12;
56857     var touchLayer = select_default2(null);
56858     var drawLayer = select_default2(null);
56859     var _notesVisible = false;
56860     function markerPath(selection2, klass) {
56861       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");
56862     }
56863     function getService() {
56864       if (services.osm && !_osmService) {
56865         _osmService = services.osm;
56866         _osmService.on("loadedNotes", throttledRedraw);
56867       } else if (!services.osm && _osmService) {
56868         _osmService = null;
56869       }
56870       return _osmService;
56871     }
56872     function editOn() {
56873       if (!_notesVisible) {
56874         _notesVisible = true;
56875         drawLayer.style("display", "block");
56876       }
56877     }
56878     function editOff() {
56879       if (_notesVisible) {
56880         _notesVisible = false;
56881         drawLayer.style("display", "none");
56882         drawLayer.selectAll(".note").remove();
56883         touchLayer.selectAll(".note").remove();
56884       }
56885     }
56886     function layerOn() {
56887       editOn();
56888       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
56889         dispatch14.call("change");
56890       });
56891     }
56892     function layerOff() {
56893       throttledRedraw.cancel();
56894       drawLayer.interrupt();
56895       touchLayer.selectAll(".note").remove();
56896       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
56897         editOff();
56898         dispatch14.call("change");
56899       });
56900     }
56901     function updateMarkers() {
56902       if (!_notesVisible || !_notesEnabled) return;
56903       var service = getService();
56904       var selectedID = context.selectedNoteID();
56905       var data = service ? service.notes(projection2) : [];
56906       var getTransform = svgPointTransform(projection2);
56907       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
56908         return d2.status + d2.id;
56909       });
56910       notes.exit().remove();
56911       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
56912         return "note note-" + d2.id + " " + d2.status;
56913       }).classed("new", function(d2) {
56914         return d2.id < 0;
56915       });
56916       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
56917       notesEnter.append("path").call(markerPath, "shadow");
56918       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");
56919       notesEnter.selectAll(".icon-annotation").data(function(d2) {
56920         return [d2];
56921       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
56922         if (d2.id < 0) return "#iD-icon-plus";
56923         if (d2.status === "open") return "#iD-icon-close";
56924         return "#iD-icon-apply";
56925       });
56926       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
56927         var mode = context.mode();
56928         var isMoving = mode && mode.id === "drag-note";
56929         return !isMoving && d2.id === selectedID;
56930       }).attr("transform", getTransform);
56931       if (touchLayer.empty()) return;
56932       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
56933       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
56934         return d2.id;
56935       });
56936       targets.exit().remove();
56937       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
56938         var newClass = d2.id < 0 ? "new" : "";
56939         return "note target note-" + d2.id + " " + fillClass + newClass;
56940       }).attr("transform", getTransform);
56941       function sortY(a2, b2) {
56942         if (a2.id === selectedID) return 1;
56943         if (b2.id === selectedID) return -1;
56944         return b2.loc[1] - a2.loc[1];
56945       }
56946     }
56947     function drawNotes(selection2) {
56948       var service = getService();
56949       var surface = context.surface();
56950       if (surface && !surface.empty()) {
56951         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
56952       }
56953       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
56954       drawLayer.exit().remove();
56955       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
56956       if (_notesEnabled) {
56957         if (service && ~~context.map().zoom() >= minZoom5) {
56958           editOn();
56959           service.loadNotes(projection2);
56960           updateMarkers();
56961         } else {
56962           editOff();
56963         }
56964       }
56965     }
56966     drawNotes.enabled = function(val) {
56967       if (!arguments.length) return _notesEnabled;
56968       _notesEnabled = val;
56969       if (_notesEnabled) {
56970         layerOn();
56971       } else {
56972         layerOff();
56973         if (context.selectedNoteID()) {
56974           context.enter(modeBrowse(context));
56975         }
56976       }
56977       dispatch14.call("change");
56978       return this;
56979     };
56980     return drawNotes;
56981   }
56982   var hash, _notesEnabled, _osmService;
56983   var init_notes = __esm({
56984     "modules/svg/notes.js"() {
56985       "use strict";
56986       init_throttle();
56987       init_src5();
56988       init_src4();
56989       init_browse();
56990       init_helpers();
56991       init_services();
56992       init_util();
56993       hash = utilStringQs(window.location.hash);
56994       _notesEnabled = !!hash.notes;
56995     }
56996   });
56997
56998   // modules/svg/touch.js
56999   var touch_exports = {};
57000   __export(touch_exports, {
57001     svgTouch: () => svgTouch
57002   });
57003   function svgTouch() {
57004     function drawTouch(selection2) {
57005       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
57006         return "layer-touch " + d2;
57007       });
57008     }
57009     return drawTouch;
57010   }
57011   var init_touch = __esm({
57012     "modules/svg/touch.js"() {
57013       "use strict";
57014     }
57015   });
57016
57017   // modules/util/dimensions.js
57018   var dimensions_exports = {};
57019   __export(dimensions_exports, {
57020     utilGetDimensions: () => utilGetDimensions,
57021     utilSetDimensions: () => utilSetDimensions
57022   });
57023   function refresh(selection2, node) {
57024     var cr = node.getBoundingClientRect();
57025     var prop = [cr.width, cr.height];
57026     selection2.property("__dimensions__", prop);
57027     return prop;
57028   }
57029   function utilGetDimensions(selection2, force) {
57030     if (!selection2 || selection2.empty()) {
57031       return [0, 0];
57032     }
57033     var node = selection2.node(), cached = selection2.property("__dimensions__");
57034     return !cached || force ? refresh(selection2, node) : cached;
57035   }
57036   function utilSetDimensions(selection2, dimensions) {
57037     if (!selection2 || selection2.empty()) {
57038       return selection2;
57039     }
57040     var node = selection2.node();
57041     if (dimensions === null) {
57042       refresh(selection2, node);
57043       return selection2;
57044     }
57045     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
57046   }
57047   var init_dimensions = __esm({
57048     "modules/util/dimensions.js"() {
57049       "use strict";
57050     }
57051   });
57052
57053   // modules/svg/layers.js
57054   var layers_exports = {};
57055   __export(layers_exports, {
57056     svgLayers: () => svgLayers
57057   });
57058   function svgLayers(projection2, context) {
57059     var dispatch14 = dispatch_default("change", "photoDatesChanged");
57060     var svg2 = select_default2(null);
57061     var _layers = [
57062       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
57063       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
57064       { id: "data", layer: svgData(projection2, context, dispatch14) },
57065       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
57066       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
57067       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
57068       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
57069       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
57070       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
57071       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
57072       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
57073       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
57074       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
57075       { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
57076       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
57077       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
57078       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
57079       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
57080     ];
57081     function drawLayers(selection2) {
57082       svg2 = selection2.selectAll(".surface").data([0]);
57083       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
57084       var defs = svg2.selectAll(".surface-defs").data([0]);
57085       defs.enter().append("defs").attr("class", "surface-defs");
57086       var groups = svg2.selectAll(".data-layer").data(_layers);
57087       groups.exit().remove();
57088       groups.enter().append("g").attr("class", function(d2) {
57089         return "data-layer " + d2.id;
57090       }).merge(groups).each(function(d2) {
57091         select_default2(this).call(d2.layer);
57092       });
57093     }
57094     drawLayers.all = function() {
57095       return _layers;
57096     };
57097     drawLayers.layer = function(id2) {
57098       var obj = _layers.find(function(o2) {
57099         return o2.id === id2;
57100       });
57101       return obj && obj.layer;
57102     };
57103     drawLayers.only = function(what) {
57104       var arr = [].concat(what);
57105       var all = _layers.map(function(layer) {
57106         return layer.id;
57107       });
57108       return drawLayers.remove(utilArrayDifference(all, arr));
57109     };
57110     drawLayers.remove = function(what) {
57111       var arr = [].concat(what);
57112       arr.forEach(function(id2) {
57113         _layers = _layers.filter(function(o2) {
57114           return o2.id !== id2;
57115         });
57116       });
57117       dispatch14.call("change");
57118       return this;
57119     };
57120     drawLayers.add = function(what) {
57121       var arr = [].concat(what);
57122       arr.forEach(function(obj) {
57123         if ("id" in obj && "layer" in obj) {
57124           _layers.push(obj);
57125         }
57126       });
57127       dispatch14.call("change");
57128       return this;
57129     };
57130     drawLayers.dimensions = function(val) {
57131       if (!arguments.length) return utilGetDimensions(svg2);
57132       utilSetDimensions(svg2, val);
57133       return this;
57134     };
57135     return utilRebind(drawLayers, dispatch14, "on");
57136   }
57137   var init_layers = __esm({
57138     "modules/svg/layers.js"() {
57139       "use strict";
57140       init_src4();
57141       init_src5();
57142       init_data2();
57143       init_local_photos();
57144       init_debug();
57145       init_geolocate();
57146       init_keepRight2();
57147       init_osmose2();
57148       init_streetside();
57149       init_vegbilder();
57150       init_mapillary_images();
57151       init_mapillary_position();
57152       init_mapillary_signs();
57153       init_mapillary_map_features();
57154       init_kartaview_images();
57155       init_mapilio_images();
57156       init_panoramax_images();
57157       init_osm2();
57158       init_notes();
57159       init_touch();
57160       init_util();
57161       init_dimensions();
57162     }
57163   });
57164
57165   // modules/svg/lines.js
57166   var lines_exports = {};
57167   __export(lines_exports, {
57168     svgLines: () => svgLines
57169   });
57170   function onewayArrowColour(tags) {
57171     if (tags.highway === "construction" && tags.bridge) return "white";
57172     if (tags.highway === "pedestrian") return "gray";
57173     if (tags.railway) return "gray";
57174     if (tags.aeroway === "runway") return "white";
57175     return "black";
57176   }
57177   function svgLines(projection2, context) {
57178     var detected = utilDetect();
57179     var highway_stack = {
57180       motorway: 0,
57181       motorway_link: 1,
57182       trunk: 2,
57183       trunk_link: 3,
57184       primary: 4,
57185       primary_link: 5,
57186       secondary: 6,
57187       tertiary: 7,
57188       unclassified: 8,
57189       residential: 9,
57190       service: 10,
57191       busway: 11,
57192       footway: 12
57193     };
57194     function drawTargets(selection2, graph, entities, filter2) {
57195       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
57196       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
57197       var getPath = svgPath(projection2).geojson;
57198       var activeID = context.activeID();
57199       var base = context.history().base();
57200       var data = { targets: [], nopes: [] };
57201       entities.forEach(function(way) {
57202         var features = svgSegmentWay(way, graph, activeID);
57203         data.targets.push.apply(data.targets, features.passive);
57204         data.nopes.push.apply(data.nopes, features.active);
57205       });
57206       var targetData = data.targets.filter(getPath);
57207       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
57208         return filter2(d2.properties.entity);
57209       }).data(targetData, function key(d2) {
57210         return d2.id;
57211       });
57212       targets.exit().remove();
57213       var segmentWasEdited = function(d2) {
57214         var wayID = d2.properties.entity.id;
57215         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
57216           return false;
57217         }
57218         return d2.properties.nodes.some(function(n3) {
57219           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
57220         });
57221       };
57222       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
57223         return "way line target target-allowed " + targetClass + d2.id;
57224       }).classed("segment-edited", segmentWasEdited);
57225       var nopeData = data.nopes.filter(getPath);
57226       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
57227         return filter2(d2.properties.entity);
57228       }).data(nopeData, function key(d2) {
57229         return d2.id;
57230       });
57231       nopes.exit().remove();
57232       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
57233         return "way line target target-nope " + nopeClass + d2.id;
57234       }).classed("segment-edited", segmentWasEdited);
57235     }
57236     function drawLines(selection2, graph, entities, filter2) {
57237       var base = context.history().base();
57238       function waystack(a2, b2) {
57239         var selected = context.selectedIDs();
57240         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
57241         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
57242         if (a2.tags.highway) {
57243           scoreA -= highway_stack[a2.tags.highway];
57244         }
57245         if (b2.tags.highway) {
57246           scoreB -= highway_stack[b2.tags.highway];
57247         }
57248         return scoreA - scoreB;
57249       }
57250       function drawLineGroup(selection3, klass, isSelected) {
57251         var mode = context.mode();
57252         var isDrawing = mode && /^draw/.test(mode.id);
57253         var selectedClass = !isDrawing && isSelected ? "selected " : "";
57254         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
57255         lines.exit().remove();
57256         lines.enter().append("path").attr("class", function(d2) {
57257           var prefix = "way line";
57258           if (!d2.hasInterestingTags()) {
57259             var parentRelations = graph.parentRelations(d2);
57260             var parentMultipolygons = parentRelations.filter(function(relation) {
57261               return relation.isMultipolygon();
57262             });
57263             if (parentMultipolygons.length > 0 && // and only multipolygon relations
57264             parentRelations.length === parentMultipolygons.length) {
57265               prefix = "relation area";
57266             }
57267           }
57268           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
57269           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
57270         }).classed("added", function(d2) {
57271           return !base.entities[d2.id];
57272         }).classed("geometry-edited", function(d2) {
57273           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);
57274         }).classed("retagged", function(d2) {
57275           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);
57276         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
57277         return selection3;
57278       }
57279       function getPathData(isSelected) {
57280         return function() {
57281           var layer = this.parentNode.__data__;
57282           var data = pathdata[layer] || [];
57283           return data.filter(function(d2) {
57284             if (isSelected) {
57285               return context.selectedIDs().indexOf(d2.id) !== -1;
57286             } else {
57287               return context.selectedIDs().indexOf(d2.id) === -1;
57288             }
57289           });
57290         };
57291       }
57292       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
57293         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
57294         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
57295         var markers = markergroup.selectAll("path").filter(filter2).data(
57296           function data() {
57297             return groupdata[this.parentNode.__data__] || [];
57298           },
57299           function key(d2) {
57300             return [d2.id, d2.index];
57301           }
57302         );
57303         markers.exit().remove();
57304         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
57305           return d2.d;
57306         });
57307         if (detected.ie) {
57308           markers.each(function() {
57309             this.parentNode.insertBefore(this, this);
57310           });
57311         }
57312       }
57313       var getPath = svgPath(projection2, graph);
57314       var ways = [];
57315       var onewaydata = {};
57316       var sideddata = {};
57317       var oldMultiPolygonOuters = {};
57318       for (var i3 = 0; i3 < entities.length; i3++) {
57319         var entity = entities[i3];
57320         if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
57321           ways.push(entity);
57322         }
57323       }
57324       ways = ways.filter(getPath);
57325       const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
57326       Object.keys(pathdata).forEach(function(k2) {
57327         var v2 = pathdata[k2];
57328         var onewayArr = v2.filter(function(d2) {
57329           return d2.isOneWay();
57330         });
57331         var onewaySegments = svgMarkerSegments(
57332           projection2,
57333           graph,
57334           36,
57335           (entity2) => entity2.isOneWayBackwards(),
57336           (entity2) => entity2.isBiDirectional()
57337         );
57338         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
57339         var sidedArr = v2.filter(function(d2) {
57340           return d2.isSided();
57341         });
57342         var sidedSegments = svgMarkerSegments(
57343           projection2,
57344           graph,
57345           30
57346         );
57347         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
57348       });
57349       var covered = selection2.selectAll(".layer-osm.covered");
57350       var uncovered = selection2.selectAll(".layer-osm.lines");
57351       var touchLayer = selection2.selectAll(".layer-touch.lines");
57352       [covered, uncovered].forEach(function(selection3) {
57353         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
57354         var layergroup = selection3.selectAll("g.layergroup").data(range3);
57355         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
57356           return "layergroup layer" + String(d2);
57357         }).merge(layergroup);
57358         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
57359           return "linegroup line-" + d2;
57360         });
57361         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
57362         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
57363         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
57364         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
57365         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
57366         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
57367         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, (d2) => {
57368           const category = onewayArrowColour(graph.entity(d2.id).tags);
57369           return `url(#ideditor-oneway-marker-${category})`;
57370         });
57371         addMarkers(
57372           layergroup,
57373           "sided",
57374           "sidedgroup",
57375           sideddata,
57376           function marker(d2) {
57377             var category = graph.entity(d2.id).sidednessIdentifier();
57378             return "url(#ideditor-sided-marker-" + category + ")";
57379           }
57380         );
57381       });
57382       touchLayer.call(drawTargets, graph, ways, filter2);
57383     }
57384     return drawLines;
57385   }
57386   var import_fast_deep_equal6;
57387   var init_lines = __esm({
57388     "modules/svg/lines.js"() {
57389       "use strict";
57390       import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
57391       init_src();
57392       init_helpers();
57393       init_tag_classes();
57394       init_osm();
57395       init_util();
57396       init_detect();
57397     }
57398   });
57399
57400   // modules/svg/midpoints.js
57401   var midpoints_exports = {};
57402   __export(midpoints_exports, {
57403     svgMidpoints: () => svgMidpoints
57404   });
57405   function svgMidpoints(projection2, context) {
57406     var targetRadius = 8;
57407     function drawTargets(selection2, graph, entities, filter2) {
57408       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57409       var getTransform = svgPointTransform(projection2).geojson;
57410       var data = entities.map(function(midpoint) {
57411         return {
57412           type: "Feature",
57413           id: midpoint.id,
57414           properties: {
57415             target: true,
57416             entity: midpoint
57417           },
57418           geometry: {
57419             type: "Point",
57420             coordinates: midpoint.loc
57421           }
57422         };
57423       });
57424       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
57425         return filter2(d2.properties.entity);
57426       }).data(data, function key(d2) {
57427         return d2.id;
57428       });
57429       targets.exit().remove();
57430       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
57431         return "node midpoint target " + fillClass + d2.id;
57432       }).attr("transform", getTransform);
57433     }
57434     function drawMidpoints(selection2, graph, entities, filter2, extent) {
57435       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
57436       var touchLayer = selection2.selectAll(".layer-touch.points");
57437       var mode = context.mode();
57438       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
57439         drawLayer.selectAll(".midpoint").remove();
57440         touchLayer.selectAll(".midpoint.target").remove();
57441         return;
57442       }
57443       var poly = extent.polygon();
57444       var midpoints = {};
57445       for (var i3 = 0; i3 < entities.length; i3++) {
57446         var entity = entities[i3];
57447         if (entity.type !== "way") continue;
57448         if (!filter2(entity)) continue;
57449         if (context.selectedIDs().indexOf(entity.id) < 0) continue;
57450         var nodes = graph.childNodes(entity);
57451         for (var j2 = 0; j2 < nodes.length - 1; j2++) {
57452           var a2 = nodes[j2];
57453           var b2 = nodes[j2 + 1];
57454           var id2 = [a2.id, b2.id].sort().join("-");
57455           if (midpoints[id2]) {
57456             midpoints[id2].parents.push(entity);
57457           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
57458             var point = geoVecInterp(a2.loc, b2.loc, 0.5);
57459             var loc = null;
57460             if (extent.intersects(point)) {
57461               loc = point;
57462             } else {
57463               for (var k2 = 0; k2 < 4; k2++) {
57464                 point = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
57465                 if (point && geoVecLength(projection2(a2.loc), projection2(point)) > 20 && geoVecLength(projection2(b2.loc), projection2(point)) > 20) {
57466                   loc = point;
57467                   break;
57468                 }
57469               }
57470             }
57471             if (loc) {
57472               midpoints[id2] = {
57473                 type: "midpoint",
57474                 id: id2,
57475                 loc,
57476                 edge: [a2.id, b2.id],
57477                 parents: [entity]
57478               };
57479             }
57480           }
57481         }
57482       }
57483       function midpointFilter(d2) {
57484         if (midpoints[d2.id]) return true;
57485         for (var i4 = 0; i4 < d2.parents.length; i4++) {
57486           if (filter2(d2.parents[i4])) {
57487             return true;
57488           }
57489         }
57490         return false;
57491       }
57492       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
57493         return d2.id;
57494       });
57495       groups.exit().remove();
57496       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
57497       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
57498       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
57499       groups = groups.merge(enter).attr("transform", function(d2) {
57500         var translate = svgPointTransform(projection2);
57501         var a3 = graph.entity(d2.edge[0]);
57502         var b3 = graph.entity(d2.edge[1]);
57503         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
57504         return translate(d2) + " rotate(" + angle2 + ")";
57505       }).call(svgTagClasses().tags(
57506         function(d2) {
57507           return d2.parents[0].tags;
57508         }
57509       ));
57510       groups.select("polygon.shadow");
57511       groups.select("polygon.fill");
57512       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
57513     }
57514     return drawMidpoints;
57515   }
57516   var init_midpoints = __esm({
57517     "modules/svg/midpoints.js"() {
57518       "use strict";
57519       init_helpers();
57520       init_tag_classes();
57521       init_geo2();
57522     }
57523   });
57524
57525   // modules/svg/points.js
57526   var points_exports = {};
57527   __export(points_exports, {
57528     svgPoints: () => svgPoints
57529   });
57530   function svgPoints(projection2, context) {
57531     function markerPath(selection2, klass) {
57532       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");
57533     }
57534     function sortY(a2, b2) {
57535       return b2.loc[1] - a2.loc[1];
57536     }
57537     function fastEntityKey(d2) {
57538       var mode = context.mode();
57539       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57540       return isMoving ? d2.id : osmEntity.key(d2);
57541     }
57542     function drawTargets(selection2, graph, entities, filter2) {
57543       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57544       var getTransform = svgPointTransform(projection2).geojson;
57545       var activeID = context.activeID();
57546       var data = [];
57547       entities.forEach(function(node) {
57548         if (activeID === node.id) return;
57549         data.push({
57550           type: "Feature",
57551           id: node.id,
57552           properties: {
57553             target: true,
57554             entity: node
57555           },
57556           geometry: node.asGeoJSON()
57557         });
57558       });
57559       var targets = selection2.selectAll(".point.target").filter(function(d2) {
57560         return filter2(d2.properties.entity);
57561       }).data(data, function key(d2) {
57562         return d2.id;
57563       });
57564       targets.exit().remove();
57565       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
57566         return "node point target " + fillClass + d2.id;
57567       }).attr("transform", getTransform);
57568     }
57569     function drawPoints(selection2, graph, entities, filter2) {
57570       var wireframe = context.surface().classed("fill-wireframe");
57571       var zoom = geoScaleToZoom(projection2.scale());
57572       var base = context.history().base();
57573       function renderAsPoint(entity) {
57574         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
57575       }
57576       var points = wireframe ? [] : entities.filter(renderAsPoint);
57577       points.sort(sortY);
57578       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
57579       var touchLayer = selection2.selectAll(".layer-touch.points");
57580       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
57581       groups.exit().remove();
57582       var enter = groups.enter().append("g").attr("class", function(d2) {
57583         return "node point " + d2.id;
57584       }).order();
57585       enter.append("path").call(markerPath, "shadow");
57586       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
57587       enter.append("path").call(markerPath, "stroke");
57588       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
57589       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
57590         return !base.entities[d2.id];
57591       }).classed("moved", function(d2) {
57592         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
57593       }).classed("retagged", function(d2) {
57594         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
57595       }).call(svgTagClasses());
57596       groups.select(".shadow");
57597       groups.select(".stroke");
57598       groups.select(".icon").attr("xlink:href", function(entity) {
57599         var preset = _mainPresetIndex.match(entity, graph);
57600         var picon = preset && preset.icon;
57601         return picon ? "#" + picon : "";
57602       });
57603       touchLayer.call(drawTargets, graph, points, filter2);
57604     }
57605     return drawPoints;
57606   }
57607   var import_fast_deep_equal7;
57608   var init_points = __esm({
57609     "modules/svg/points.js"() {
57610       "use strict";
57611       import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
57612       init_geo2();
57613       init_osm();
57614       init_helpers();
57615       init_tag_classes();
57616       init_presets();
57617     }
57618   });
57619
57620   // modules/svg/turns.js
57621   var turns_exports = {};
57622   __export(turns_exports, {
57623     svgTurns: () => svgTurns
57624   });
57625   function svgTurns(projection2, context) {
57626     function icon2(turn) {
57627       var u2 = turn.u ? "-u" : "";
57628       if (turn.no) return "#iD-turn-no" + u2;
57629       if (turn.only) return "#iD-turn-only" + u2;
57630       return "#iD-turn-yes" + u2;
57631     }
57632     function drawTurns(selection2, graph, turns) {
57633       function turnTransform(d2) {
57634         var pxRadius = 50;
57635         var toWay = graph.entity(d2.to.way);
57636         var toPoints = graph.childNodes(toWay).map(function(n3) {
57637           return n3.loc;
57638         }).map(projection2);
57639         var toLength = geoPathLength(toPoints);
57640         var mid = toLength / 2;
57641         var toNode = graph.entity(d2.to.node);
57642         var toVertex = graph.entity(d2.to.vertex);
57643         var a2 = geoAngle(toVertex, toNode, projection2);
57644         var o2 = projection2(toVertex.loc);
57645         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
57646         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
57647       }
57648       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
57649       var touchLayer = selection2.selectAll(".layer-touch.turns");
57650       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
57651         return d2.key;
57652       });
57653       groups.exit().remove();
57654       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
57655         return "turn " + d2.key;
57656       });
57657       var turnsEnter = groupsEnter.filter(function(d2) {
57658         return !d2.u;
57659       });
57660       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57661       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57662       var uEnter = groupsEnter.filter(function(d2) {
57663         return d2.u;
57664       });
57665       uEnter.append("circle").attr("r", "16");
57666       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
57667       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
57668         return d2.direct === false ? "0.7" : null;
57669       }).attr("transform", turnTransform);
57670       groups.select("use").attr("xlink:href", icon2);
57671       groups.select("rect");
57672       groups.select("circle");
57673       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
57674       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
57675         return d2.key;
57676       });
57677       groups.exit().remove();
57678       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
57679         return "turn " + d2.key;
57680       });
57681       turnsEnter = groupsEnter.filter(function(d2) {
57682         return !d2.u;
57683       });
57684       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
57685       uEnter = groupsEnter.filter(function(d2) {
57686         return d2.u;
57687       });
57688       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
57689       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
57690       groups.select("rect");
57691       groups.select("circle");
57692       return this;
57693     }
57694     return drawTurns;
57695   }
57696   var init_turns = __esm({
57697     "modules/svg/turns.js"() {
57698       "use strict";
57699       init_geo2();
57700     }
57701   });
57702
57703   // modules/svg/vertices.js
57704   var vertices_exports = {};
57705   __export(vertices_exports, {
57706     svgVertices: () => svgVertices
57707   });
57708   function svgVertices(projection2, context) {
57709     var radiuses = {
57710       //       z16-, z17,   z18+,  w/icon
57711       shadow: [6, 7.5, 7.5, 12],
57712       stroke: [2.5, 3.5, 3.5, 8],
57713       fill: [1, 1.5, 1.5, 1.5]
57714     };
57715     var _currHoverTarget;
57716     var _currPersistent = {};
57717     var _currHover = {};
57718     var _prevHover = {};
57719     var _currSelected = {};
57720     var _prevSelected = {};
57721     var _radii = {};
57722     function sortY(a2, b2) {
57723       return b2.loc[1] - a2.loc[1];
57724     }
57725     function fastEntityKey(d2) {
57726       var mode = context.mode();
57727       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57728       return isMoving ? d2.id : osmEntity.key(d2);
57729     }
57730     function draw(selection2, graph, vertices, sets2, filter2) {
57731       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
57732       var icons = {};
57733       var directions = {};
57734       var wireframe = context.surface().classed("fill-wireframe");
57735       var zoom = geoScaleToZoom(projection2.scale());
57736       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
57737       var activeID = context.activeID();
57738       var base = context.history().base();
57739       function getIcon(d2) {
57740         var entity = graph.entity(d2.id);
57741         if (entity.id in icons) return icons[entity.id];
57742         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
57743         return icons[entity.id];
57744       }
57745       function getDirections(entity) {
57746         if (entity.id in directions) return directions[entity.id];
57747         var angles = entity.directions(graph, projection2);
57748         directions[entity.id] = angles.length ? angles : false;
57749         return angles;
57750       }
57751       function updateAttributes(selection3) {
57752         ["shadow", "stroke", "fill"].forEach(function(klass) {
57753           var rads = radiuses[klass];
57754           selection3.selectAll("." + klass).each(function(entity) {
57755             var i3 = z2 && getIcon(entity);
57756             var r2 = rads[i3 ? 3 : z2];
57757             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
57758               r2 += 1.5;
57759             }
57760             if (klass === "shadow") {
57761               _radii[entity.id] = r2;
57762             }
57763             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
57764           });
57765         });
57766       }
57767       vertices.sort(sortY);
57768       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
57769       groups.exit().remove();
57770       var enter = groups.enter().append("g").attr("class", function(d2) {
57771         return "node vertex " + d2.id;
57772       }).order();
57773       enter.append("circle").attr("class", "shadow");
57774       enter.append("circle").attr("class", "stroke");
57775       enter.filter(function(d2) {
57776         return d2.hasInterestingTags();
57777       }).append("circle").attr("class", "fill");
57778       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
57779         return d2.id in sets2.selected;
57780       }).classed("shared", function(d2) {
57781         return graph.isShared(d2);
57782       }).classed("endpoint", function(d2) {
57783         return d2.isEndpoint(graph);
57784       }).classed("added", function(d2) {
57785         return !base.entities[d2.id];
57786       }).classed("moved", function(d2) {
57787         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
57788       }).classed("retagged", function(d2) {
57789         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
57790       }).call(svgTagClasses()).call(updateAttributes);
57791       var iconUse = groups.selectAll(".icon").data(function data(d2) {
57792         return zoom >= 17 && getIcon(d2) ? [d2] : [];
57793       }, fastEntityKey);
57794       iconUse.exit().remove();
57795       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
57796         var picon = getIcon(d2);
57797         return picon ? "#" + picon : "";
57798       });
57799       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
57800         return zoom >= 18 && getDirections(d2) ? [d2] : [];
57801       }, fastEntityKey);
57802       dgroups.exit().remove();
57803       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
57804       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
57805         return osmEntity.key(d2);
57806       });
57807       viewfields.exit().remove();
57808       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) {
57809         return "rotate(" + d2 + ")";
57810       });
57811     }
57812     function drawTargets(selection2, graph, entities, filter2) {
57813       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
57814       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
57815       var getTransform = svgPointTransform(projection2).geojson;
57816       var activeID = context.activeID();
57817       var data = { targets: [], nopes: [] };
57818       entities.forEach(function(node) {
57819         if (activeID === node.id) return;
57820         var vertexType = svgPassiveVertex(node, graph, activeID);
57821         if (vertexType !== 0) {
57822           data.targets.push({
57823             type: "Feature",
57824             id: node.id,
57825             properties: {
57826               target: true,
57827               entity: node
57828             },
57829             geometry: node.asGeoJSON()
57830           });
57831         } else {
57832           data.nopes.push({
57833             type: "Feature",
57834             id: node.id + "-nope",
57835             properties: {
57836               nope: true,
57837               target: true,
57838               entity: node
57839             },
57840             geometry: node.asGeoJSON()
57841           });
57842         }
57843       });
57844       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
57845         return filter2(d2.properties.entity);
57846       }).data(data.targets, function key(d2) {
57847         return d2.id;
57848       });
57849       targets.exit().remove();
57850       targets.enter().append("circle").attr("r", function(d2) {
57851         return _radii[d2.id] || radiuses.shadow[3];
57852       }).merge(targets).attr("class", function(d2) {
57853         return "node vertex target target-allowed " + targetClass + d2.id;
57854       }).attr("transform", getTransform);
57855       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
57856         return filter2(d2.properties.entity);
57857       }).data(data.nopes, function key(d2) {
57858         return d2.id;
57859       });
57860       nopes.exit().remove();
57861       nopes.enter().append("circle").attr("r", function(d2) {
57862         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
57863       }).merge(nopes).attr("class", function(d2) {
57864         return "node vertex target target-nope " + nopeClass + d2.id;
57865       }).attr("transform", getTransform);
57866     }
57867     function renderAsVertex(entity, graph, wireframe, zoom) {
57868       var geometry = entity.geometry(graph);
57869       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
57870     }
57871     function isEditedNode(node, base, head) {
57872       var baseNode = base.entities[node.id];
57873       var headNode = head.entities[node.id];
57874       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
57875     }
57876     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
57877       var results = {};
57878       var seenIds = {};
57879       function addChildVertices(entity) {
57880         if (seenIds[entity.id]) return;
57881         seenIds[entity.id] = true;
57882         var geometry = entity.geometry(graph);
57883         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
57884           var i3;
57885           if (entity.type === "way") {
57886             for (i3 = 0; i3 < entity.nodes.length; i3++) {
57887               var child = graph.hasEntity(entity.nodes[i3]);
57888               if (child) {
57889                 addChildVertices(child);
57890               }
57891             }
57892           } else if (entity.type === "relation") {
57893             for (i3 = 0; i3 < entity.members.length; i3++) {
57894               var member = graph.hasEntity(entity.members[i3].id);
57895               if (member) {
57896                 addChildVertices(member);
57897               }
57898             }
57899           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
57900             results[entity.id] = entity;
57901           }
57902         }
57903       }
57904       ids.forEach(function(id2) {
57905         var entity = graph.hasEntity(id2);
57906         if (!entity) return;
57907         if (entity.type === "node") {
57908           if (renderAsVertex(entity, graph, wireframe, zoom)) {
57909             results[entity.id] = entity;
57910             graph.parentWays(entity).forEach(function(entity2) {
57911               addChildVertices(entity2);
57912             });
57913           }
57914         } else {
57915           addChildVertices(entity);
57916         }
57917       });
57918       return results;
57919     }
57920     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
57921       var wireframe = context.surface().classed("fill-wireframe");
57922       var visualDiff = context.surface().classed("highlight-edited");
57923       var zoom = geoScaleToZoom(projection2.scale());
57924       var mode = context.mode();
57925       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
57926       var base = context.history().base();
57927       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
57928       var touchLayer = selection2.selectAll(".layer-touch.points");
57929       if (fullRedraw) {
57930         _currPersistent = {};
57931         _radii = {};
57932       }
57933       for (var i3 = 0; i3 < entities.length; i3++) {
57934         var entity = entities[i3];
57935         var geometry = entity.geometry(graph);
57936         var keep = false;
57937         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
57938           _currPersistent[entity.id] = entity;
57939           keep = true;
57940         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
57941           _currPersistent[entity.id] = entity;
57942           keep = true;
57943         }
57944         if (!keep && !fullRedraw) {
57945           delete _currPersistent[entity.id];
57946         }
57947       }
57948       var sets2 = {
57949         persistent: _currPersistent,
57950         // persistent = important vertices (render always)
57951         selected: _currSelected,
57952         // selected + siblings of selected (render always)
57953         hovered: _currHover
57954         // hovered + siblings of hovered (render only in draw modes)
57955       };
57956       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
57957       var filterRendered = function(d2) {
57958         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
57959       };
57960       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
57961       var filterTouch = function(d2) {
57962         return isMoving ? true : filterRendered(d2);
57963       };
57964       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
57965       function currentVisible(which) {
57966         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
57967           return entity2 && entity2.intersects(extent, graph);
57968         });
57969       }
57970     }
57971     drawVertices.drawSelected = function(selection2, graph, extent) {
57972       var wireframe = context.surface().classed("fill-wireframe");
57973       var zoom = geoScaleToZoom(projection2.scale());
57974       _prevSelected = _currSelected || {};
57975       if (context.map().isInWideSelection()) {
57976         _currSelected = {};
57977         context.selectedIDs().forEach(function(id2) {
57978           var entity = graph.hasEntity(id2);
57979           if (!entity) return;
57980           if (entity.type === "node") {
57981             if (renderAsVertex(entity, graph, wireframe, zoom)) {
57982               _currSelected[entity.id] = entity;
57983             }
57984           }
57985         });
57986       } else {
57987         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
57988       }
57989       var filter2 = function(d2) {
57990         return d2.id in _prevSelected;
57991       };
57992       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
57993     };
57994     drawVertices.drawHover = function(selection2, graph, target, extent) {
57995       if (target === _currHoverTarget) return;
57996       var wireframe = context.surface().classed("fill-wireframe");
57997       var zoom = geoScaleToZoom(projection2.scale());
57998       _prevHover = _currHover || {};
57999       _currHoverTarget = target;
58000       var entity = target && target.properties && target.properties.entity;
58001       if (entity) {
58002         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
58003       } else {
58004         _currHover = {};
58005       }
58006       var filter2 = function(d2) {
58007         return d2.id in _prevHover;
58008       };
58009       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
58010     };
58011     return drawVertices;
58012   }
58013   var import_fast_deep_equal8;
58014   var init_vertices = __esm({
58015     "modules/svg/vertices.js"() {
58016       "use strict";
58017       import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
58018       init_src5();
58019       init_presets();
58020       init_geo2();
58021       init_osm();
58022       init_helpers();
58023       init_tag_classes();
58024     }
58025   });
58026
58027   // modules/svg/index.js
58028   var svg_exports = {};
58029   __export(svg_exports, {
58030     svgAreas: () => svgAreas,
58031     svgData: () => svgData,
58032     svgDebug: () => svgDebug,
58033     svgDefs: () => svgDefs,
58034     svgGeolocate: () => svgGeolocate,
58035     svgIcon: () => svgIcon,
58036     svgKartaviewImages: () => svgKartaviewImages,
58037     svgKeepRight: () => svgKeepRight,
58038     svgLabels: () => svgLabels,
58039     svgLayers: () => svgLayers,
58040     svgLines: () => svgLines,
58041     svgMapilioImages: () => svgMapilioImages,
58042     svgMapillaryImages: () => svgMapillaryImages,
58043     svgMapillarySigns: () => svgMapillarySigns,
58044     svgMarkerSegments: () => svgMarkerSegments,
58045     svgMidpoints: () => svgMidpoints,
58046     svgNotes: () => svgNotes,
58047     svgOsm: () => svgOsm,
58048     svgPanoramaxImages: () => svgPanoramaxImages,
58049     svgPassiveVertex: () => svgPassiveVertex,
58050     svgPath: () => svgPath,
58051     svgPointTransform: () => svgPointTransform,
58052     svgPoints: () => svgPoints,
58053     svgRelationMemberTags: () => svgRelationMemberTags,
58054     svgSegmentWay: () => svgSegmentWay,
58055     svgStreetside: () => svgStreetside,
58056     svgTagClasses: () => svgTagClasses,
58057     svgTagPattern: () => svgTagPattern,
58058     svgTouch: () => svgTouch,
58059     svgTurns: () => svgTurns,
58060     svgVegbilder: () => svgVegbilder,
58061     svgVertices: () => svgVertices
58062   });
58063   var init_svg = __esm({
58064     "modules/svg/index.js"() {
58065       "use strict";
58066       init_areas();
58067       init_data2();
58068       init_debug();
58069       init_defs();
58070       init_keepRight2();
58071       init_icon();
58072       init_geolocate();
58073       init_labels();
58074       init_layers();
58075       init_lines();
58076       init_mapillary_images();
58077       init_mapillary_signs();
58078       init_midpoints();
58079       init_notes();
58080       init_helpers();
58081       init_kartaview_images();
58082       init_osm2();
58083       init_helpers();
58084       init_helpers();
58085       init_helpers();
58086       init_points();
58087       init_helpers();
58088       init_helpers();
58089       init_streetside();
58090       init_vegbilder();
58091       init_tag_classes();
58092       init_tag_pattern();
58093       init_touch();
58094       init_turns();
58095       init_vertices();
58096       init_mapilio_images();
58097       init_panoramax_images();
58098     }
58099   });
58100
58101   // modules/ui/length_indicator.js
58102   var length_indicator_exports = {};
58103   __export(length_indicator_exports, {
58104     uiLengthIndicator: () => uiLengthIndicator
58105   });
58106   function uiLengthIndicator(maxChars) {
58107     var _wrap = select_default2(null);
58108     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
58109       selection2.text("");
58110       selection2.call(svgIcon("#iD-icon-alert", "inline"));
58111       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
58112     });
58113     var _silent = false;
58114     var lengthIndicator = function(selection2) {
58115       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
58116       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
58117       selection2.call(_tooltip);
58118     };
58119     lengthIndicator.update = function(val) {
58120       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
58121       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
58122       indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d2) => d2 > maxChars).style("border-right-width", (d2) => `${Math.abs(maxChars - d2) * 2}px`).style("margin-right", (d2) => d2 > maxChars ? `${(maxChars - d2) * 2}px` : 0).style("opacity", (d2) => d2 > maxChars * 0.8 ? Math.min(1, (d2 / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d2) => d2 > maxChars * 0.8 ? null : "none");
58123       if (_silent) return;
58124       if (strLen > maxChars) {
58125         _tooltip.show();
58126       } else {
58127         _tooltip.hide();
58128       }
58129     };
58130     lengthIndicator.silent = function(val) {
58131       if (!arguments.length) return _silent;
58132       _silent = val;
58133       return lengthIndicator;
58134     };
58135     return lengthIndicator;
58136   }
58137   var init_length_indicator = __esm({
58138     "modules/ui/length_indicator.js"() {
58139       "use strict";
58140       init_src5();
58141       init_localizer();
58142       init_svg();
58143       init_util();
58144       init_popover();
58145     }
58146   });
58147
58148   // modules/ui/fields/combo.js
58149   var combo_exports = {};
58150   __export(combo_exports, {
58151     uiFieldCombo: () => uiFieldCombo,
58152     uiFieldManyCombo: () => uiFieldCombo,
58153     uiFieldMultiCombo: () => uiFieldCombo,
58154     uiFieldNetworkCombo: () => uiFieldCombo,
58155     uiFieldSemiCombo: () => uiFieldCombo,
58156     uiFieldTypeCombo: () => uiFieldCombo
58157   });
58158   function uiFieldCombo(field, context) {
58159     var dispatch14 = dispatch_default("change");
58160     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
58161     var _isNetwork = field.type === "networkCombo";
58162     var _isSemi = field.type === "semiCombo";
58163     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
58164     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
58165     var _snake_case = field.snake_case || field.snake_case === void 0;
58166     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
58167     var _container = select_default2(null);
58168     var _inputWrap = select_default2(null);
58169     var _input = select_default2(null);
58170     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
58171     var _comboData = [];
58172     var _multiData = [];
58173     var _entityIDs = [];
58174     var _tags;
58175     var _countryCode;
58176     var _staticPlaceholder;
58177     var _customOptions = [];
58178     var _dataDeprecated = [];
58179     _mainFileFetcher.get("deprecated").then(function(d2) {
58180       _dataDeprecated = d2;
58181     }).catch(function() {
58182     });
58183     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
58184       field.key += ":";
58185     }
58186     function snake(s2) {
58187       return s2.replace(/\s+/g, "_");
58188     }
58189     function clean2(s2) {
58190       return s2.split(";").map(function(s3) {
58191         return s3.trim();
58192       }).join(";");
58193     }
58194     function tagValue(dval) {
58195       dval = clean2(dval || "");
58196       var found = getOptions(true).find(function(o2) {
58197         return o2.key && clean2(o2.value) === dval;
58198       });
58199       if (found) return found.key;
58200       if (field.type === "typeCombo" && !dval) {
58201         return "yes";
58202       }
58203       return restrictTagValueSpelling(dval) || void 0;
58204     }
58205     function restrictTagValueSpelling(dval) {
58206       if (_snake_case) {
58207         dval = snake(dval);
58208       }
58209       if (!field.caseSensitive) {
58210         dval = dval.toLowerCase();
58211       }
58212       return dval;
58213     }
58214     function getLabelId(field2, v2) {
58215       return field2.hasTextForStringId(`options.${v2}.title`) ? `options.${v2}.title` : `options.${v2}`;
58216     }
58217     function displayValue(tval) {
58218       tval = tval || "";
58219       var stringsField = field.resolveReference("stringsCrossReference");
58220       const labelId = getLabelId(stringsField, tval);
58221       if (stringsField.hasTextForStringId(labelId)) {
58222         return stringsField.t(labelId, { default: tval });
58223       }
58224       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58225         return "";
58226       }
58227       return tval;
58228     }
58229     function renderValue(tval) {
58230       tval = tval || "";
58231       var stringsField = field.resolveReference("stringsCrossReference");
58232       const labelId = getLabelId(stringsField, tval);
58233       if (stringsField.hasTextForStringId(labelId)) {
58234         return stringsField.t.append(labelId, { default: tval });
58235       }
58236       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
58237         tval = "";
58238       }
58239       return (selection2) => selection2.text(tval);
58240     }
58241     function objectDifference(a2, b2) {
58242       return a2.filter(function(d1) {
58243         return !b2.some(function(d2) {
58244           return d1.value === d2.value;
58245         });
58246       });
58247     }
58248     function initCombo(selection2, attachTo) {
58249       if (!_allowCustomValues) {
58250         selection2.attr("readonly", "readonly");
58251       }
58252       if (_showTagInfoSuggestions && services.taginfo) {
58253         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
58254         setTaginfoValues("", setPlaceholder);
58255       } else {
58256         selection2.call(_combobox, attachTo);
58257         setTimeout(() => setStaticValues(setPlaceholder), 0);
58258       }
58259     }
58260     function getOptions(allOptions) {
58261       var stringsField = field.resolveReference("stringsCrossReference");
58262       if (!(field.options || stringsField.options)) return [];
58263       let options2;
58264       if (allOptions !== true) {
58265         options2 = field.options || stringsField.options;
58266       } else {
58267         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
58268       }
58269       const result = options2.map(function(v2) {
58270         const labelId = getLabelId(stringsField, v2);
58271         return {
58272           key: v2,
58273           value: stringsField.t(labelId, { default: v2 }),
58274           title: stringsField.t(`options.${v2}.description`, { default: v2 }),
58275           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
58276           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
58277         };
58278       });
58279       return [...result, ..._customOptions];
58280     }
58281     function hasStaticValues() {
58282       return getOptions().length > 0;
58283     }
58284     function setStaticValues(callback, filter2) {
58285       _comboData = getOptions();
58286       if (filter2 !== void 0) {
58287         _comboData = _comboData.filter(filter2);
58288       }
58289       _comboData = objectDifference(_comboData, _multiData);
58290       _combobox.data(_comboData);
58291       _container.classed("empty-combobox", _comboData.length === 0);
58292       if (callback) callback(_comboData);
58293     }
58294     function setTaginfoValues(q2, callback) {
58295       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
58296       if (hasStaticValues()) {
58297         setStaticValues(callback, queryFilter);
58298       }
58299       var stringsField = field.resolveReference("stringsCrossReference");
58300       var fn = _isMulti ? "multikeys" : "values";
58301       var query = (_isMulti ? field.key : "") + q2;
58302       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
58303       if (hasCountryPrefix) {
58304         query = _countryCode + ":";
58305       }
58306       var params = {
58307         debounce: q2 !== "",
58308         key: field.key,
58309         query
58310       };
58311       if (_entityIDs.length) {
58312         params.geometry = context.graph().geometry(_entityIDs[0]);
58313       }
58314       services.taginfo[fn](params, function(err, data) {
58315         if (err) return;
58316         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
58317         data = data.filter((d2) => {
58318           var value = d2.value;
58319           if (_isMulti) {
58320             value = value.slice(field.key.length);
58321           }
58322           return value === restrictTagValueSpelling(value);
58323         });
58324         var deprecatedValues = deprecatedTagValuesByKey(_dataDeprecated)[field.key];
58325         if (deprecatedValues) {
58326           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
58327         }
58328         if (hasCountryPrefix) {
58329           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
58330         }
58331         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
58332         _container.classed("empty-combobox", data.length === 0);
58333         _comboData = data.concat(additionalOptions).map(function(d2) {
58334           var v2 = d2.value;
58335           if (_isMulti) v2 = v2.replace(field.key, "");
58336           const labelId = getLabelId(stringsField, v2);
58337           var isLocalizable = stringsField.hasTextForStringId(labelId);
58338           var label = stringsField.t(labelId, { default: v2 });
58339           return {
58340             key: v2,
58341             value: label,
58342             title: stringsField.t(`options.${v2}.description`, { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
58343             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
58344             klass: isLocalizable ? "" : "raw-option"
58345           };
58346         });
58347         _comboData = _comboData.filter(queryFilter);
58348         _comboData = objectDifference(_comboData, _multiData);
58349         if (callback) callback(_comboData, hasStaticValues());
58350       });
58351     }
58352     function addComboboxIcons(disp, value) {
58353       const iconsField = field.resolveReference("iconsCrossReference");
58354       if (iconsField.icons) {
58355         return function(selection2) {
58356           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
58357           if (iconsField.icons[value]) {
58358             span.call(svgIcon(`#${iconsField.icons[value]}`));
58359           }
58360           disp.call(this, selection2);
58361         };
58362       }
58363       return disp;
58364     }
58365     function setPlaceholder(values) {
58366       if (_isMulti || _isSemi) {
58367         _staticPlaceholder = field.placeholder() || _t("inspector.add");
58368       } else {
58369         var vals = values.map(function(d2) {
58370           return d2.value;
58371         }).filter(function(s2) {
58372           return s2.length < 20;
58373         });
58374         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
58375           return d2.key;
58376         });
58377         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
58378       }
58379       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
58380         _staticPlaceholder += "\u2026";
58381       }
58382       var ph;
58383       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
58384         ph = _t("inspector.multiple_values");
58385       } else {
58386         ph = _staticPlaceholder;
58387       }
58388       _container.selectAll("input").attr("placeholder", ph);
58389       var hideAdd = !_allowCustomValues && !values.length;
58390       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
58391     }
58392     function change() {
58393       var t2 = {};
58394       var val;
58395       if (_isMulti || _isSemi) {
58396         var vals;
58397         if (_isMulti) {
58398           vals = [tagValue(utilGetSetValue(_input))];
58399         } else if (_isSemi) {
58400           val = tagValue(utilGetSetValue(_input)) || "";
58401           val = val.replace(/,/g, ";");
58402           vals = val.split(";");
58403         }
58404         vals = vals.filter(Boolean);
58405         if (!vals.length) return;
58406         _container.classed("active", false);
58407         utilGetSetValue(_input, "");
58408         if (_isMulti) {
58409           utilArrayUniq(vals).forEach(function(v2) {
58410             var key = (field.key || "") + v2;
58411             if (_tags) {
58412               var old = _tags[key];
58413               if (typeof old === "string" && old.toLowerCase() !== "no") return;
58414             }
58415             key = context.cleanTagKey(key);
58416             field.keys.push(key);
58417             t2[key] = "yes";
58418           });
58419         } else if (_isSemi) {
58420           var arr = _multiData.map(function(d2) {
58421             return d2.key;
58422           });
58423           arr = arr.concat(vals);
58424           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
58425         }
58426         window.setTimeout(function() {
58427           _input.node().focus();
58428         }, 10);
58429       } else {
58430         var rawValue = utilGetSetValue(_input);
58431         if (!rawValue && Array.isArray(_tags[field.key])) return;
58432         val = context.cleanTagValue(tagValue(rawValue));
58433         t2[field.key] = val || void 0;
58434       }
58435       dispatch14.call("change", this, t2);
58436     }
58437     function removeMultikey(d3_event, d2) {
58438       d3_event.preventDefault();
58439       d3_event.stopPropagation();
58440       var t2 = {};
58441       if (_isMulti) {
58442         t2[d2.key] = void 0;
58443       } else if (_isSemi) {
58444         var arr = _multiData.map(function(md) {
58445           return md.key === d2.key ? null : md.key;
58446         }).filter(Boolean);
58447         arr = utilArrayUniq(arr);
58448         t2[field.key] = arr.length ? arr.join(";") : void 0;
58449         _lengthIndicator.update(t2[field.key]);
58450       }
58451       dispatch14.call("change", this, t2);
58452     }
58453     function invertMultikey(d3_event, d2) {
58454       d3_event.preventDefault();
58455       d3_event.stopPropagation();
58456       var t2 = {};
58457       if (_isMulti) {
58458         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
58459       }
58460       dispatch14.call("change", this, t2);
58461     }
58462     function combo(selection2) {
58463       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
58464       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
58465       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
58466       if (_isMulti || _isSemi) {
58467         _container = _container.selectAll(".chiplist").data([0]);
58468         var listClass = "chiplist";
58469         if (field.key === "destination" || field.key === "via") {
58470           listClass += " full-line-chips";
58471         }
58472         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
58473           window.setTimeout(function() {
58474             _input.node().focus();
58475           }, 10);
58476         }).merge(_container);
58477         _inputWrap = _container.selectAll(".input-wrap").data([0]);
58478         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
58479         var hideAdd = !_allowCustomValues && !_comboData.length;
58480         _inputWrap.style("display", hideAdd ? "none" : null);
58481         _input = _inputWrap.selectAll("input").data([0]);
58482       } else {
58483         _input = _container.selectAll("input").data([0]);
58484       }
58485       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
58486       if (_isSemi) {
58487         _inputWrap.call(_lengthIndicator);
58488       } else if (!_isMulti) {
58489         _container.call(_lengthIndicator);
58490       }
58491       if (_isNetwork) {
58492         var extent = combinedEntityExtent();
58493         var countryCode = extent && iso1A2Code(extent.center());
58494         _countryCode = countryCode && countryCode.toLowerCase();
58495       }
58496       _input.on("change", change).on("blur", change).on("input", function() {
58497         let val = utilGetSetValue(_input);
58498         updateIcon(val);
58499         if (_isSemi && _tags[field.key]) {
58500           val += ";" + _tags[field.key];
58501         }
58502         _lengthIndicator.update(val);
58503       });
58504       _input.on("keydown.field", function(d3_event) {
58505         switch (d3_event.keyCode) {
58506           case 13:
58507             _input.node().blur();
58508             d3_event.stopPropagation();
58509             break;
58510         }
58511       });
58512       if (_isMulti || _isSemi) {
58513         _combobox.on("accept", function() {
58514           _input.node().blur();
58515           _input.node().focus();
58516         });
58517         _input.on("focus", function() {
58518           _container.classed("active", true);
58519         });
58520       }
58521       _combobox.on("cancel", function() {
58522         _input.node().blur();
58523       }).on("update", function() {
58524         updateIcon(utilGetSetValue(_input));
58525       });
58526     }
58527     function updateIcon(value) {
58528       value = tagValue(value);
58529       let container = _container;
58530       if (field.type === "multiCombo" || field.type === "semiCombo") {
58531         container = _container.select(".input-wrap");
58532       }
58533       const iconsField = field.resolveReference("iconsCrossReference");
58534       if (iconsField.icons) {
58535         container.selectAll(".tag-value-icon").remove();
58536         if (iconsField.icons[value]) {
58537           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon(`#${iconsField.icons[value]}`));
58538         }
58539       }
58540     }
58541     combo.tags = function(tags) {
58542       _tags = tags;
58543       var stringsField = field.resolveReference("stringsCrossReference");
58544       var isMixed = Array.isArray(tags[field.key]);
58545       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
58546       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId(`options.${value}`) && !stringsField.hasTextForStringId(`options.${value}.title`);
58547       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
58548       var isReadOnly = !_allowCustomValues;
58549       if (_isMulti || _isSemi) {
58550         _multiData = [];
58551         var maxLength;
58552         if (_isMulti) {
58553           for (var k2 in tags) {
58554             if (field.key && k2.indexOf(field.key) !== 0) continue;
58555             if (!field.key && field.keys.indexOf(k2) === -1) continue;
58556             var v2 = tags[k2];
58557             var suffix = field.key ? k2.slice(field.key.length) : k2;
58558             _multiData.push({
58559               key: k2,
58560               value: displayValue(suffix),
58561               display: addComboboxIcons(renderValue(suffix), suffix),
58562               state: typeof v2 === "string" ? v2.toLowerCase() : "",
58563               isMixed: Array.isArray(v2)
58564             });
58565           }
58566           if (field.key) {
58567             field.keys = _multiData.map(function(d2) {
58568               return d2.key;
58569             });
58570             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
58571           } else {
58572             maxLength = context.maxCharsForTagKey();
58573           }
58574         } else if (_isSemi) {
58575           var allValues = [];
58576           var commonValues;
58577           if (Array.isArray(tags[field.key])) {
58578             tags[field.key].forEach(function(tagVal) {
58579               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
58580               allValues = allValues.concat(thisVals);
58581               if (!commonValues) {
58582                 commonValues = thisVals;
58583               } else {
58584                 commonValues = commonValues.filter((value) => thisVals.includes(value));
58585               }
58586             });
58587             allValues = utilArrayUniq(allValues).filter(Boolean);
58588           } else {
58589             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
58590             commonValues = allValues;
58591           }
58592           _multiData = allValues.map(function(v3) {
58593             return {
58594               key: v3,
58595               value: displayValue(v3),
58596               display: addComboboxIcons(renderValue(v3), v3),
58597               isMixed: !commonValues.includes(v3)
58598             };
58599           });
58600           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
58601           maxLength = context.maxCharsForTagValue() - currLength;
58602           if (currLength > 0) {
58603             maxLength -= 1;
58604           }
58605         }
58606         maxLength = Math.max(0, maxLength);
58607         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
58608         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
58609         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
58610         var chips = _container.selectAll(".chip").data(_multiData);
58611         chips.exit().remove();
58612         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
58613         enter.append("span");
58614         const field_buttons = enter.append("div").attr("class", "field_buttons");
58615         field_buttons.append("a").attr("class", "remove");
58616         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
58617           var k3 = d2.key;
58618           if (_isMulti) k3 = k3.replace(field.key, "");
58619           return !stringsField.hasTextForStringId("options." + k3);
58620         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
58621           return d2.isMixed;
58622         }).attr("title", function(d2) {
58623           if (d2.isMixed) {
58624             return _t("inspector.unshared_value_tooltip");
58625           }
58626           if (!["yes", "no"].includes(d2.state)) {
58627             return d2.state;
58628           }
58629           return null;
58630         }).classed("negated", (d2) => d2.state === "no");
58631         if (!_isSemi) {
58632           chips.selectAll("input[type=checkbox]").remove();
58633           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);
58634         }
58635         if (allowDragAndDrop) {
58636           registerDragAndDrop(chips);
58637         }
58638         chips.each(function(d2) {
58639           const selection2 = select_default2(this);
58640           const text_span = selection2.select("span");
58641           const field_buttons2 = selection2.select(".field_buttons");
58642           const clean_value = d2.value.trim();
58643           text_span.text("");
58644           if (!field_buttons2.select("button").empty()) {
58645             field_buttons2.select("button").remove();
58646           }
58647           if (clean_value.startsWith("https://")) {
58648             text_span.text(clean_value);
58649             field_buttons2.append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).attr("aria-label", () => _t("icons.visit_website")).on("click", function(d3_event) {
58650               d3_event.preventDefault();
58651               window.open(clean_value, "_blank");
58652             });
58653             return;
58654           }
58655           if (d2.display) {
58656             d2.display(text_span);
58657             return;
58658           }
58659           text_span.text(d2.value);
58660         });
58661         chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
58662         updateIcon("");
58663       } else {
58664         var mixedValues = isMixed && tags[field.key].map(function(val) {
58665           return displayValue(val);
58666         }).filter(Boolean);
58667         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) {
58668           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
58669             d3_event.preventDefault();
58670             d3_event.stopPropagation();
58671             var t2 = {};
58672             t2[field.key] = void 0;
58673             dispatch14.call("change", this, t2);
58674           }
58675         });
58676         if (!Array.isArray(tags[field.key])) {
58677           updateIcon(tags[field.key]);
58678         }
58679         if (!isMixed) {
58680           _lengthIndicator.update(tags[field.key]);
58681         }
58682       }
58683       const refreshStyles = () => {
58684         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
58685       };
58686       _input.on("input.refreshStyles", refreshStyles);
58687       _combobox.on("update.refreshStyles", refreshStyles);
58688       refreshStyles();
58689     };
58690     function registerDragAndDrop(selection2) {
58691       var dragOrigin, targetIndex;
58692       selection2.call(
58693         drag_default().on("start", function(d3_event) {
58694           dragOrigin = {
58695             x: d3_event.x,
58696             y: d3_event.y
58697           };
58698           targetIndex = null;
58699         }).on("drag", function(d3_event) {
58700           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
58701           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
58702           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
58703           var index = selection2.nodes().indexOf(this);
58704           select_default2(this).classed("dragging", true);
58705           targetIndex = null;
58706           var targetIndexOffsetTop = null;
58707           var draggedTagWidth = select_default2(this).node().offsetWidth;
58708           if (field.key === "destination" || field.key === "via") {
58709             _container.selectAll(".chip").style("transform", function(d2, index2) {
58710               var node = select_default2(this).node();
58711               if (index === index2) {
58712                 return "translate(" + x2 + "px, " + y2 + "px)";
58713               } else if (index2 > index && d3_event.y > node.offsetTop) {
58714                 if (targetIndex === null || index2 > targetIndex) {
58715                   targetIndex = index2;
58716                 }
58717                 return "translateY(-100%)";
58718               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
58719                 if (targetIndex === null || index2 < targetIndex) {
58720                   targetIndex = index2;
58721                 }
58722                 return "translateY(100%)";
58723               }
58724               return null;
58725             });
58726           } else {
58727             _container.selectAll(".chip").each(function(d2, index2) {
58728               var node = select_default2(this).node();
58729               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) {
58730                 targetIndex = index2;
58731                 targetIndexOffsetTop = node.offsetTop;
58732               }
58733             }).style("transform", function(d2, index2) {
58734               var node = select_default2(this).node();
58735               if (index === index2) {
58736                 return "translate(" + x2 + "px, " + y2 + "px)";
58737               }
58738               if (node.offsetTop === targetIndexOffsetTop) {
58739                 if (index2 < index && index2 >= targetIndex) {
58740                   return "translateX(" + draggedTagWidth + "px)";
58741                 } else if (index2 > index && index2 <= targetIndex) {
58742                   return "translateX(-" + draggedTagWidth + "px)";
58743                 }
58744               }
58745               return null;
58746             });
58747           }
58748         }).on("end", function() {
58749           if (!select_default2(this).classed("dragging")) {
58750             return;
58751           }
58752           var index = selection2.nodes().indexOf(this);
58753           select_default2(this).classed("dragging", false);
58754           _container.selectAll(".chip").style("transform", null);
58755           if (typeof targetIndex === "number") {
58756             var element = _multiData[index];
58757             _multiData.splice(index, 1);
58758             _multiData.splice(targetIndex, 0, element);
58759             var t2 = {};
58760             if (_multiData.length) {
58761               t2[field.key] = _multiData.map(function(element2) {
58762                 return element2.key;
58763               }).join(";");
58764             } else {
58765               t2[field.key] = void 0;
58766             }
58767             dispatch14.call("change", this, t2);
58768           }
58769           dragOrigin = void 0;
58770           targetIndex = void 0;
58771         })
58772       );
58773     }
58774     combo.setCustomOptions = (newValue) => {
58775       _customOptions = newValue;
58776     };
58777     combo.focus = function() {
58778       _input.node().focus();
58779     };
58780     combo.entityIDs = function(val) {
58781       if (!arguments.length) return _entityIDs;
58782       _entityIDs = val;
58783       return combo;
58784     };
58785     function combinedEntityExtent() {
58786       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
58787     }
58788     return utilRebind(combo, dispatch14, "on");
58789   }
58790   var init_combo = __esm({
58791     "modules/ui/fields/combo.js"() {
58792       "use strict";
58793       init_src4();
58794       init_src5();
58795       init_src6();
58796       init_country_coder();
58797       init_file_fetcher();
58798       init_localizer();
58799       init_services();
58800       init_combobox();
58801       init_icon();
58802       init_keybinding();
58803       init_util();
58804       init_length_indicator();
58805       init_deprecated();
58806     }
58807   });
58808
58809   // modules/behavior/hash.js
58810   var hash_exports = {};
58811   __export(hash_exports, {
58812     behaviorHash: () => behaviorHash
58813   });
58814   function behaviorHash(context) {
58815     var _cachedHash = null;
58816     var _latitudeLimit = 90 - 1e-8;
58817     function computedHashParameters() {
58818       var map2 = context.map();
58819       var center = map2.center();
58820       var zoom = map2.zoom();
58821       var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
58822       var oldParams = utilObjectOmit(
58823         utilStringQs(window.location.hash),
58824         ["comment", "source", "hashtags", "walkthrough"]
58825       );
58826       var newParams = {};
58827       delete oldParams.id;
58828       var selected = context.selectedIDs().filter(function(id2) {
58829         return context.hasEntity(id2);
58830       });
58831       if (selected.length) {
58832         newParams.id = selected.join(",");
58833       } else if (context.selectedNoteID()) {
58834         newParams.id = `note/${context.selectedNoteID()}`;
58835       }
58836       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
58837       return Object.assign(oldParams, newParams);
58838     }
58839     function computedHash() {
58840       return "#" + utilQsString(computedHashParameters(), true);
58841     }
58842     function computedTitle(includeChangeCount) {
58843       var baseTitle = context.documentTitleBase() || "iD";
58844       var contextual;
58845       var changeCount;
58846       var titleID;
58847       var selected = context.selectedIDs().filter(function(id2) {
58848         return context.hasEntity(id2);
58849       });
58850       if (selected.length) {
58851         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
58852         if (selected.length > 1) {
58853           contextual = _t("title.labeled_and_more", {
58854             labeled: firstLabel,
58855             count: selected.length - 1
58856           });
58857         } else {
58858           contextual = firstLabel;
58859         }
58860         titleID = "context";
58861       }
58862       if (includeChangeCount) {
58863         changeCount = context.history().difference().summary().length;
58864         if (changeCount > 0) {
58865           titleID = contextual ? "changes_context" : "changes";
58866         }
58867       }
58868       if (titleID) {
58869         return _t("title.format." + titleID, {
58870           changes: changeCount,
58871           base: baseTitle,
58872           context: contextual
58873         });
58874       }
58875       return baseTitle;
58876     }
58877     function updateTitle(includeChangeCount) {
58878       if (!context.setsDocumentTitle()) return;
58879       var newTitle = computedTitle(includeChangeCount);
58880       if (document.title !== newTitle) {
58881         document.title = newTitle;
58882       }
58883     }
58884     function updateHashIfNeeded() {
58885       if (context.inIntro()) return;
58886       var latestHash = computedHash();
58887       if (_cachedHash !== latestHash) {
58888         _cachedHash = latestHash;
58889         window.history.replaceState(null, "", latestHash);
58890         updateTitle(
58891           true
58892           /* includeChangeCount */
58893         );
58894         const q2 = utilStringQs(latestHash);
58895         if (q2.map) {
58896           corePreferences("map-location", q2.map);
58897         }
58898       }
58899     }
58900     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
58901     var _throttledUpdateTitle = throttle_default(function() {
58902       updateTitle(
58903         true
58904         /* includeChangeCount */
58905       );
58906     }, 500);
58907     function hashchange() {
58908       if (window.location.hash === _cachedHash) return;
58909       _cachedHash = window.location.hash;
58910       var q2 = utilStringQs(_cachedHash);
58911       var mapArgs = (q2.map || "").split("/").map(Number);
58912       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
58913         updateHashIfNeeded();
58914       } else {
58915         if (_cachedHash === computedHash()) return;
58916         var mode = context.mode();
58917         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
58918         if (q2.id && mode) {
58919           var ids = q2.id.split(",").filter(function(id2) {
58920             return context.hasEntity(id2) || id2.startsWith("note/");
58921           });
58922           if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
58923             if (ids.length === 1 && ids[0].startsWith("note/")) {
58924               context.enter(modeSelectNote(context, ids[0]));
58925             } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
58926               context.enter(modeSelect(context, ids));
58927             }
58928             return;
58929           }
58930         }
58931         var center = context.map().center();
58932         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
58933         var maxdist = 500;
58934         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
58935           context.enter(modeBrowse(context));
58936           return;
58937         }
58938       }
58939     }
58940     function behavior() {
58941       context.map().on("move.behaviorHash", _throttledUpdate);
58942       context.history().on("change.behaviorHash", _throttledUpdateTitle);
58943       context.on("enter.behaviorHash", _throttledUpdate);
58944       select_default2(window).on("hashchange.behaviorHash", hashchange);
58945       var q2 = utilStringQs(window.location.hash);
58946       if (q2.id) {
58947         const selectIds = q2.id.split(",");
58948         if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
58949           const noteId = selectIds[0].split("/")[1];
58950           context.moveToNote(noteId, !q2.map);
58951         } else {
58952           context.zoomToEntities(
58953             // convert ids to short form id: node/123 -> n123
58954             selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
58955             !q2.map
58956           );
58957         }
58958       }
58959       if (q2.walkthrough === "true") {
58960         behavior.startWalkthrough = true;
58961       }
58962       if (q2.map) {
58963         behavior.hadLocation = true;
58964       } else if (!q2.id && corePreferences("map-location")) {
58965         const mapArgs = corePreferences("map-location").split("/").map(Number);
58966         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
58967         updateHashIfNeeded();
58968         behavior.hadLocation = true;
58969       }
58970       hashchange();
58971       updateTitle(false);
58972     }
58973     behavior.off = function() {
58974       _throttledUpdate.cancel();
58975       _throttledUpdateTitle.cancel();
58976       context.map().on("move.behaviorHash", null);
58977       context.on("enter.behaviorHash", null);
58978       select_default2(window).on("hashchange.behaviorHash", null);
58979       window.location.hash = "";
58980     };
58981     return behavior;
58982   }
58983   var init_hash = __esm({
58984     "modules/behavior/hash.js"() {
58985       "use strict";
58986       init_throttle();
58987       init_src5();
58988       init_geo2();
58989       init_browse();
58990       init_modes2();
58991       init_util();
58992       init_array3();
58993       init_utilDisplayLabel();
58994       init_localizer();
58995       init_preferences();
58996     }
58997   });
58998
58999   // modules/behavior/index.js
59000   var behavior_exports = {};
59001   __export(behavior_exports, {
59002     behaviorAddWay: () => behaviorAddWay,
59003     behaviorBreathe: () => behaviorBreathe,
59004     behaviorDrag: () => behaviorDrag,
59005     behaviorDraw: () => behaviorDraw,
59006     behaviorDrawWay: () => behaviorDrawWay,
59007     behaviorEdit: () => behaviorEdit,
59008     behaviorHash: () => behaviorHash,
59009     behaviorHover: () => behaviorHover,
59010     behaviorLasso: () => behaviorLasso,
59011     behaviorOperation: () => behaviorOperation,
59012     behaviorPaste: () => behaviorPaste,
59013     behaviorSelect: () => behaviorSelect
59014   });
59015   var init_behavior = __esm({
59016     "modules/behavior/index.js"() {
59017       "use strict";
59018       init_add_way();
59019       init_breathe();
59020       init_drag2();
59021       init_draw_way();
59022       init_draw();
59023       init_edit();
59024       init_hash();
59025       init_hover();
59026       init_lasso2();
59027       init_operation();
59028       init_paste();
59029       init_select4();
59030     }
59031   });
59032
59033   // modules/ui/account.js
59034   var account_exports = {};
59035   __export(account_exports, {
59036     uiAccount: () => uiAccount
59037   });
59038   function uiAccount(context) {
59039     const osm = context.connection();
59040     function updateUserDetails(selection2) {
59041       if (!osm) return;
59042       if (!osm.authenticated()) {
59043         render(selection2, null);
59044       } else {
59045         osm.userDetails((err, user) => {
59046           if (err && err.status === 401) {
59047             osm.logout();
59048           }
59049           render(selection2, user);
59050         });
59051       }
59052     }
59053     function render(selection2, user) {
59054       let userInfo = selection2.select(".userInfo");
59055       let loginLogout = selection2.select(".loginLogout");
59056       if (user) {
59057         userInfo.html("").classed("hide", false);
59058         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
59059         if (user.image_url) {
59060           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
59061         } else {
59062           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
59063         }
59064         userLink.append("span").attr("class", "label").text(user.display_name);
59065         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
59066           e3.preventDefault();
59067           osm.logout();
59068           osm.authenticate(void 0, { switchUser: true });
59069         });
59070       } else {
59071         userInfo.html("").classed("hide", true);
59072         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
59073           e3.preventDefault();
59074           osm.authenticate();
59075         });
59076       }
59077     }
59078     return function(selection2) {
59079       if (!osm) return;
59080       selection2.append("li").attr("class", "userInfo").classed("hide", true);
59081       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
59082       osm.on("change.account", () => updateUserDetails(selection2));
59083       updateUserDetails(selection2);
59084     };
59085   }
59086   var init_account = __esm({
59087     "modules/ui/account.js"() {
59088       "use strict";
59089       init_localizer();
59090       init_icon();
59091     }
59092   });
59093
59094   // modules/ui/attribution.js
59095   var attribution_exports = {};
59096   __export(attribution_exports, {
59097     uiAttribution: () => uiAttribution
59098   });
59099   function uiAttribution(context) {
59100     let _selection = select_default2(null);
59101     function render(selection2, data, klass) {
59102       let div = selection2.selectAll(`.${klass}`).data([0]);
59103       div = div.enter().append("div").attr("class", klass).merge(div);
59104       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
59105       attributions.exit().remove();
59106       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
59107         let attribution = select_default2(nodes[i3]);
59108         if (d2.terms_html) {
59109           attribution.html(d2.terms_html);
59110           return;
59111         }
59112         if (d2.terms_url) {
59113           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
59114         }
59115         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
59116         const terms_text = _t(
59117           `imagery.${sourceID}.attribution.text`,
59118           { default: d2.terms_text || d2.id || d2.name() }
59119         );
59120         if (d2.icon && !d2.overlay) {
59121           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
59122         }
59123         attribution.append("span").attr("class", "attribution-text").text(terms_text);
59124       }).merge(attributions);
59125       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
59126         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
59127         return notice ? [notice] : [];
59128       });
59129       copyright.exit().remove();
59130       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
59131       copyright.text(String);
59132     }
59133     function update() {
59134       let baselayer = context.background().baseLayerSource();
59135       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
59136       const z2 = context.map().zoom();
59137       let overlays = context.background().overlayLayerSources() || [];
59138       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
59139     }
59140     return function(selection2) {
59141       _selection = selection2;
59142       context.background().on("change.attribution", update);
59143       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
59144       update();
59145     };
59146   }
59147   var init_attribution = __esm({
59148     "modules/ui/attribution.js"() {
59149       "use strict";
59150       init_throttle();
59151       init_src5();
59152       init_localizer();
59153     }
59154   });
59155
59156   // modules/ui/contributors.js
59157   var contributors_exports = {};
59158   __export(contributors_exports, {
59159     uiContributors: () => uiContributors
59160   });
59161   function uiContributors(context) {
59162     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
59163       update();
59164     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
59165     function update() {
59166       if (!osm) return;
59167       var users = {}, entities = context.history().intersects(context.map().extent());
59168       entities.forEach(function(entity) {
59169         if (entity && entity.user) users[entity.user] = true;
59170       });
59171       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
59172       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
59173       var userList = select_default2(document.createElement("span"));
59174       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
59175         return osm.userURL(d2);
59176       }).attr("target", "_blank").text(String);
59177       if (u2.length > limit) {
59178         var count = select_default2(document.createElement("span"));
59179         var othersNum = u2.length - limit + 1;
59180         count.append("a").attr("target", "_blank").attr("href", function() {
59181           return osm.changesetsURL(context.map().center(), context.map().zoom());
59182         }).text(othersNum);
59183         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
59184       } else {
59185         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
59186       }
59187       if (!u2.length) {
59188         hidden = true;
59189         wrap2.transition().style("opacity", 0);
59190       } else if (hidden) {
59191         wrap2.transition().style("opacity", 1);
59192       }
59193     }
59194     return function(selection2) {
59195       if (!osm) return;
59196       wrap2 = selection2;
59197       update();
59198       osm.on("loaded.contributors", debouncedUpdate);
59199       context.map().on("move.contributors", debouncedUpdate);
59200     };
59201   }
59202   var init_contributors = __esm({
59203     "modules/ui/contributors.js"() {
59204       "use strict";
59205       init_debounce();
59206       init_src5();
59207       init_localizer();
59208       init_svg();
59209     }
59210   });
59211
59212   // modules/ui/edit_menu.js
59213   var edit_menu_exports = {};
59214   __export(edit_menu_exports, {
59215     uiEditMenu: () => uiEditMenu
59216   });
59217   function uiEditMenu(context) {
59218     var dispatch14 = dispatch_default("toggled");
59219     var _menu = select_default2(null);
59220     var _operations = [];
59221     var _anchorLoc = [0, 0];
59222     var _anchorLocLonLat = [0, 0];
59223     var _triggerType = "";
59224     var _vpTopMargin = 85;
59225     var _vpBottomMargin = 45;
59226     var _vpSideMargin = 35;
59227     var _menuTop = false;
59228     var _menuHeight;
59229     var _menuWidth;
59230     var _verticalPadding = 4;
59231     var _tooltipWidth = 210;
59232     var _menuSideMargin = 10;
59233     var _tooltips = [];
59234     var editMenu = function(selection2) {
59235       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
59236       var ops = _operations.filter(function(op) {
59237         return !isTouchMenu || !op.mouseOnly;
59238       });
59239       if (!ops.length) return;
59240       _tooltips = [];
59241       _menuTop = isTouchMenu;
59242       var showLabels = isTouchMenu;
59243       var buttonHeight = showLabels ? 32 : 34;
59244       if (showLabels) {
59245         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
59246           return op.title.length;
59247         })));
59248       } else {
59249         _menuWidth = 44;
59250       }
59251       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
59252       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
59253       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
59254       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
59255         return "edit-menu-item edit-menu-item-" + d2.id;
59256       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
59257         d3_event.stopPropagation();
59258       }).on("mouseenter.highlight", function(d3_event, d2) {
59259         if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
59260         utilHighlightEntities(d2.relatedEntityIds(), true, context);
59261       }).on("mouseleave.highlight", function(d3_event, d2) {
59262         if (!d2.relatedEntityIds) return;
59263         utilHighlightEntities(d2.relatedEntityIds(), false, context);
59264       });
59265       buttonsEnter.each(function(d2) {
59266         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
59267         _tooltips.push(tooltip);
59268         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
59269       });
59270       if (showLabels) {
59271         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
59272           select_default2(this).call(d2.title);
59273         });
59274       }
59275       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
59276         return d2.disabled();
59277       });
59278       updatePosition();
59279       var initialScale = context.projection.scale();
59280       context.map().on("move.edit-menu", function() {
59281         if (initialScale !== context.projection.scale()) {
59282           editMenu.close();
59283         }
59284       }).on("drawn.edit-menu", function(info) {
59285         if (info.full) updatePosition();
59286       });
59287       var lastPointerUpType;
59288       function pointerup(d3_event) {
59289         lastPointerUpType = d3_event.pointerType;
59290       }
59291       function click(d3_event, operation2) {
59292         d3_event.stopPropagation();
59293         if (operation2.relatedEntityIds) {
59294           utilHighlightEntities(operation2.relatedEntityIds(), false, context);
59295         }
59296         if (operation2.disabled()) {
59297           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
59298             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
59299           }
59300         } else {
59301           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
59302             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
59303           }
59304           operation2();
59305           editMenu.close();
59306         }
59307         lastPointerUpType = null;
59308       }
59309       dispatch14.call("toggled", this, true);
59310     };
59311     function updatePosition() {
59312       if (!_menu || _menu.empty()) return;
59313       var anchorLoc = context.projection(_anchorLocLonLat);
59314       var viewport = context.surfaceRect();
59315       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
59316         editMenu.close();
59317         return;
59318       }
59319       var menuLeft = displayOnLeft(viewport);
59320       var offset = [0, 0];
59321       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
59322       if (_menuTop) {
59323         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
59324           offset[1] = -anchorLoc[1] + _vpTopMargin;
59325         } else {
59326           offset[1] = -_menuHeight;
59327         }
59328       } else {
59329         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
59330           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
59331         } else {
59332           offset[1] = 0;
59333         }
59334       }
59335       var origin = geoVecAdd(anchorLoc, offset);
59336       var _verticalOffset = parseFloat(utilGetDimensions(select_default2(".top-toolbar-wrap"))[1]);
59337       origin[1] -= _verticalOffset;
59338       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
59339       var tooltipSide = tooltipPosition(viewport, menuLeft);
59340       _tooltips.forEach(function(tooltip) {
59341         tooltip.placement(tooltipSide);
59342       });
59343       function displayOnLeft(viewport2) {
59344         if (_mainLocalizer.textDirection() === "ltr") {
59345           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
59346             return true;
59347           }
59348           return false;
59349         } else {
59350           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
59351             return false;
59352           }
59353           return true;
59354         }
59355       }
59356       function tooltipPosition(viewport2, menuLeft2) {
59357         if (_mainLocalizer.textDirection() === "ltr") {
59358           if (menuLeft2) {
59359             return "left";
59360           }
59361           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
59362             return "left";
59363           }
59364           return "right";
59365         } else {
59366           if (!menuLeft2) {
59367             return "right";
59368           }
59369           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
59370             return "right";
59371           }
59372           return "left";
59373         }
59374       }
59375     }
59376     editMenu.close = function() {
59377       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
59378       _menu.remove();
59379       _tooltips = [];
59380       dispatch14.call("toggled", this, false);
59381     };
59382     editMenu.anchorLoc = function(val) {
59383       if (!arguments.length) return _anchorLoc;
59384       _anchorLoc = val;
59385       _anchorLocLonLat = context.projection.invert(_anchorLoc);
59386       return editMenu;
59387     };
59388     editMenu.triggerType = function(val) {
59389       if (!arguments.length) return _triggerType;
59390       _triggerType = val;
59391       return editMenu;
59392     };
59393     editMenu.operations = function(val) {
59394       if (!arguments.length) return _operations;
59395       _operations = val;
59396       return editMenu;
59397     };
59398     return utilRebind(editMenu, dispatch14, "on");
59399   }
59400   var init_edit_menu = __esm({
59401     "modules/ui/edit_menu.js"() {
59402       "use strict";
59403       init_src5();
59404       init_src4();
59405       init_geo2();
59406       init_localizer();
59407       init_tooltip();
59408       init_rebind();
59409       init_util2();
59410       init_dimensions();
59411       init_icon();
59412     }
59413   });
59414
59415   // modules/ui/feature_info.js
59416   var feature_info_exports = {};
59417   __export(feature_info_exports, {
59418     uiFeatureInfo: () => uiFeatureInfo
59419   });
59420   function uiFeatureInfo(context) {
59421     function update(selection2) {
59422       var features = context.features();
59423       var stats = features.stats();
59424       var count = 0;
59425       var hiddenList = features.hidden().map(function(k2) {
59426         if (stats[k2]) {
59427           count += stats[k2];
59428           return _t.append("inspector.title_count", {
59429             title: _t("feature." + k2 + ".description"),
59430             count: stats[k2]
59431           });
59432         }
59433         return null;
59434       }).filter(Boolean);
59435       selection2.text("");
59436       if (hiddenList.length) {
59437         var tooltipBehavior = uiTooltip().placement("top").title(function() {
59438           return (selection3) => {
59439             hiddenList.forEach((hiddenFeature) => {
59440               selection3.append("div").call(hiddenFeature);
59441             });
59442           };
59443         });
59444         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
59445           tooltipBehavior.hide();
59446           d3_event.preventDefault();
59447           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
59448         });
59449       }
59450       selection2.classed("hide", !hiddenList.length);
59451     }
59452     return function(selection2) {
59453       update(selection2);
59454       context.features().on("change.feature_info", function() {
59455         update(selection2);
59456       });
59457     };
59458   }
59459   var init_feature_info = __esm({
59460     "modules/ui/feature_info.js"() {
59461       "use strict";
59462       init_localizer();
59463       init_tooltip();
59464     }
59465   });
59466
59467   // modules/ui/flash.js
59468   var flash_exports = {};
59469   __export(flash_exports, {
59470     uiFlash: () => uiFlash
59471   });
59472   function uiFlash(context) {
59473     var _flashTimer;
59474     var _duration = 2e3;
59475     var _iconName = "#iD-icon-no";
59476     var _iconClass = "disabled";
59477     var _label = (s2) => s2.text("");
59478     function flash() {
59479       if (_flashTimer) {
59480         _flashTimer.stop();
59481       }
59482       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
59483       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
59484       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
59485       var contentEnter = content.enter().append("div").attr("class", "flash-content");
59486       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
59487       iconEnter.append("circle").attr("r", 9);
59488       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
59489       contentEnter.append("div").attr("class", "flash-text");
59490       content = content.merge(contentEnter);
59491       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
59492       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
59493       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
59494       _flashTimer = timeout_default(function() {
59495         _flashTimer = null;
59496         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
59497         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
59498       }, _duration);
59499       return content;
59500     }
59501     flash.duration = function(_2) {
59502       if (!arguments.length) return _duration;
59503       _duration = _2;
59504       return flash;
59505     };
59506     flash.label = function(_2) {
59507       if (!arguments.length) return _label;
59508       if (typeof _2 !== "function") {
59509         _label = (selection2) => selection2.text(_2);
59510       } else {
59511         _label = (selection2) => selection2.text("").call(_2);
59512       }
59513       return flash;
59514     };
59515     flash.iconName = function(_2) {
59516       if (!arguments.length) return _iconName;
59517       _iconName = _2;
59518       return flash;
59519     };
59520     flash.iconClass = function(_2) {
59521       if (!arguments.length) return _iconClass;
59522       _iconClass = _2;
59523       return flash;
59524     };
59525     return flash;
59526   }
59527   var init_flash = __esm({
59528     "modules/ui/flash.js"() {
59529       "use strict";
59530       init_src9();
59531     }
59532   });
59533
59534   // modules/ui/full_screen.js
59535   var full_screen_exports = {};
59536   __export(full_screen_exports, {
59537     uiFullScreen: () => uiFullScreen
59538   });
59539   function uiFullScreen(context) {
59540     var element = context.container().node();
59541     function getFullScreenFn() {
59542       if (element.requestFullscreen) {
59543         return element.requestFullscreen;
59544       } else if (element.msRequestFullscreen) {
59545         return element.msRequestFullscreen;
59546       } else if (element.mozRequestFullScreen) {
59547         return element.mozRequestFullScreen;
59548       } else if (element.webkitRequestFullscreen) {
59549         return element.webkitRequestFullscreen;
59550       }
59551     }
59552     function getExitFullScreenFn() {
59553       if (document.exitFullscreen) {
59554         return document.exitFullscreen;
59555       } else if (document.msExitFullscreen) {
59556         return document.msExitFullscreen;
59557       } else if (document.mozCancelFullScreen) {
59558         return document.mozCancelFullScreen;
59559       } else if (document.webkitExitFullscreen) {
59560         return document.webkitExitFullscreen;
59561       }
59562     }
59563     function isFullScreen() {
59564       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
59565     }
59566     function isSupported() {
59567       return !!getFullScreenFn();
59568     }
59569     function fullScreen(d3_event) {
59570       d3_event.preventDefault();
59571       if (!isFullScreen()) {
59572         getFullScreenFn().apply(element);
59573       } else {
59574         getExitFullScreenFn().apply(document);
59575       }
59576     }
59577     return function() {
59578       if (!isSupported()) return;
59579       var detected = utilDetect();
59580       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
59581       context.keybinding().on(keys2, fullScreen);
59582     };
59583   }
59584   var init_full_screen = __esm({
59585     "modules/ui/full_screen.js"() {
59586       "use strict";
59587       init_cmd();
59588       init_detect();
59589     }
59590   });
59591
59592   // modules/ui/geolocate.js
59593   var geolocate_exports2 = {};
59594   __export(geolocate_exports2, {
59595     uiGeolocate: () => uiGeolocate
59596   });
59597   function uiGeolocate(context) {
59598     var _geolocationOptions = {
59599       // prioritize speed and power usage over precision
59600       enableHighAccuracy: false,
59601       // don't hang indefinitely getting the location
59602       timeout: 6e3
59603       // 6sec
59604     };
59605     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
59606     var _layer = context.layers().layer("geolocate");
59607     var _position;
59608     var _extent;
59609     var _timeoutID;
59610     var _button = select_default2(null);
59611     function click() {
59612       if (context.inIntro()) return;
59613       if (!_layer.enabled() && !_locating.isShown()) {
59614         _timeoutID = setTimeout(
59615           error,
59616           1e4
59617           /* 10sec */
59618         );
59619         context.container().call(_locating);
59620         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
59621       } else {
59622         _locating.close();
59623         _layer.enabled(null, false);
59624         updateButtonState();
59625       }
59626     }
59627     function zoomTo() {
59628       context.enter(modeBrowse(context));
59629       var map2 = context.map();
59630       _layer.enabled(_position, true);
59631       updateButtonState();
59632       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
59633     }
59634     function success(geolocation) {
59635       _position = geolocation;
59636       var coords = _position.coords;
59637       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
59638       zoomTo();
59639       finish();
59640     }
59641     function error() {
59642       if (_position) {
59643         zoomTo();
59644       } else {
59645         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
59646       }
59647       finish();
59648     }
59649     function finish() {
59650       _locating.close();
59651       if (_timeoutID) {
59652         clearTimeout(_timeoutID);
59653       }
59654       _timeoutID = void 0;
59655     }
59656     function updateButtonState() {
59657       _button.classed("active", _layer.enabled());
59658       _button.attr("aria-pressed", _layer.enabled());
59659     }
59660     return function(selection2) {
59661       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
59662       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
59663         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title"))
59664       );
59665     };
59666   }
59667   var init_geolocate2 = __esm({
59668     "modules/ui/geolocate.js"() {
59669       "use strict";
59670       init_src5();
59671       init_localizer();
59672       init_tooltip();
59673       init_geo2();
59674       init_browse();
59675       init_icon();
59676       init_loading();
59677     }
59678   });
59679
59680   // modules/ui/panels/background.js
59681   var background_exports = {};
59682   __export(background_exports, {
59683     uiPanelBackground: () => uiPanelBackground
59684   });
59685   function uiPanelBackground(context) {
59686     var background = context.background();
59687     var _currSourceName = null;
59688     var _metadata = {};
59689     var _metadataKeys = [
59690       "zoom",
59691       "vintage",
59692       "source",
59693       "description",
59694       "resolution",
59695       "accuracy"
59696     ];
59697     var debouncedRedraw = debounce_default(redraw, 250);
59698     function redraw(selection2) {
59699       var source = background.baseLayerSource();
59700       if (!source) return;
59701       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
59702       var sourceLabel = source.label();
59703       if (_currSourceName !== sourceLabel) {
59704         _currSourceName = sourceLabel;
59705         _metadata = {};
59706       }
59707       selection2.text("");
59708       var list2 = selection2.append("ul").attr("class", "background-info");
59709       list2.append("li").call(_currSourceName);
59710       _metadataKeys.forEach(function(k2) {
59711         if (isDG && k2 === "vintage") return;
59712         list2.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
59713       });
59714       debouncedGetMetadata(selection2);
59715       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
59716       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
59717         d3_event.preventDefault();
59718         context.setDebug("tile", !context.getDebug("tile"));
59719         selection2.call(redraw);
59720       });
59721       if (isDG) {
59722         var key = source.id + "-vintage";
59723         var sourceVintage = context.background().findSource(key);
59724         var showsVintage = context.background().showsLayer(sourceVintage);
59725         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
59726         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
59727           d3_event.preventDefault();
59728           context.background().toggleOverlayLayer(sourceVintage);
59729           selection2.call(redraw);
59730         });
59731       }
59732       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
59733         if (source.id !== layerId) {
59734           var key2 = layerId + "-vintage";
59735           var sourceVintage2 = context.background().findSource(key2);
59736           if (context.background().showsLayer(sourceVintage2)) {
59737             context.background().toggleOverlayLayer(sourceVintage2);
59738           }
59739         }
59740       });
59741     }
59742     var debouncedGetMetadata = debounce_default(getMetadata, 250);
59743     function getMetadata(selection2) {
59744       var tile = context.container().select(".layer-background img.tile-center");
59745       if (tile.empty()) return;
59746       var sourceName = _currSourceName;
59747       var d2 = tile.datum();
59748       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
59749       var center = context.map().center();
59750       _metadata.zoom = String(zoom);
59751       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
59752       if (!d2 || !d2.length >= 3) return;
59753       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
59754         if (err || _currSourceName !== sourceName) return;
59755         var vintage = result.vintage;
59756         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
59757         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
59758         _metadataKeys.forEach(function(k2) {
59759           if (k2 === "zoom" || k2 === "vintage") return;
59760           var val = result[k2];
59761           _metadata[k2] = val;
59762           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
59763         });
59764       });
59765     }
59766     var panel = function(selection2) {
59767       selection2.call(redraw);
59768       context.map().on("drawn.info-background", function() {
59769         selection2.call(debouncedRedraw);
59770       }).on("move.info-background", function() {
59771         selection2.call(debouncedGetMetadata);
59772       });
59773     };
59774     panel.off = function() {
59775       context.map().on("drawn.info-background", null).on("move.info-background", null);
59776     };
59777     panel.id = "background";
59778     panel.label = _t.append("info_panels.background.title");
59779     panel.key = _t("info_panels.background.key");
59780     return panel;
59781   }
59782   var init_background = __esm({
59783     "modules/ui/panels/background.js"() {
59784       "use strict";
59785       init_debounce();
59786       init_localizer();
59787     }
59788   });
59789
59790   // modules/ui/panels/history.js
59791   var history_exports2 = {};
59792   __export(history_exports2, {
59793     uiPanelHistory: () => uiPanelHistory
59794   });
59795   function uiPanelHistory(context) {
59796     var osm;
59797     function displayTimestamp(timestamp) {
59798       if (!timestamp) return _t("info_panels.history.unknown");
59799       var options2 = {
59800         day: "numeric",
59801         month: "short",
59802         year: "numeric",
59803         hour: "numeric",
59804         minute: "numeric",
59805         second: "numeric"
59806       };
59807       var d2 = new Date(timestamp);
59808       if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
59809       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
59810     }
59811     function displayUser(selection2, userName) {
59812       if (!userName) {
59813         selection2.append("span").call(_t.append("info_panels.history.unknown"));
59814         return;
59815       }
59816       selection2.append("span").attr("class", "user-name").text(userName);
59817       var links = selection2.append("div").attr("class", "links");
59818       if (osm) {
59819         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
59820       }
59821       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
59822     }
59823     function displayChangeset(selection2, changeset) {
59824       if (!changeset) {
59825         selection2.append("span").call(_t.append("info_panels.history.unknown"));
59826         return;
59827       }
59828       selection2.append("span").attr("class", "changeset-id").text(changeset);
59829       var links = selection2.append("div").attr("class", "links");
59830       if (osm) {
59831         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
59832       }
59833       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
59834       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
59835     }
59836     function redraw(selection2) {
59837       var selectedNoteID = context.selectedNoteID();
59838       osm = context.connection();
59839       var selected, note, entity;
59840       if (selectedNoteID && osm) {
59841         selected = [_t.html("note.note") + " " + selectedNoteID];
59842         note = osm.getNote(selectedNoteID);
59843       } else {
59844         selected = context.selectedIDs().filter(function(e3) {
59845           return context.hasEntity(e3);
59846         });
59847         if (selected.length) {
59848           entity = context.entity(selected[0]);
59849         }
59850       }
59851       var singular = selected.length === 1 ? selected[0] : null;
59852       selection2.html("");
59853       if (singular) {
59854         selection2.append("h4").attr("class", "history-heading").html(singular);
59855       } else {
59856         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
59857       }
59858       if (!singular) return;
59859       if (entity) {
59860         selection2.call(redrawEntity, entity);
59861       } else if (note) {
59862         selection2.call(redrawNote, note);
59863       }
59864     }
59865     function redrawNote(selection2, note) {
59866       if (!note || note.isNew()) {
59867         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
59868         return;
59869       }
59870       var list2 = selection2.append("ul");
59871       list2.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
59872       if (note.comments.length) {
59873         list2.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
59874         list2.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
59875       }
59876       if (osm) {
59877         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"));
59878       }
59879     }
59880     function redrawEntity(selection2, entity) {
59881       if (!entity || entity.isNew()) {
59882         selection2.append("div").call(_t.append("info_panels.history.no_history"));
59883         return;
59884       }
59885       var links = selection2.append("div").attr("class", "links");
59886       if (osm) {
59887         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"));
59888       }
59889       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");
59890       var list2 = selection2.append("ul");
59891       list2.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
59892       list2.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
59893       list2.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
59894       list2.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
59895     }
59896     var panel = function(selection2) {
59897       selection2.call(redraw);
59898       context.map().on("drawn.info-history", function() {
59899         selection2.call(redraw);
59900       });
59901       context.on("enter.info-history", function() {
59902         selection2.call(redraw);
59903       });
59904     };
59905     panel.off = function() {
59906       context.map().on("drawn.info-history", null);
59907       context.on("enter.info-history", null);
59908     };
59909     panel.id = "history";
59910     panel.label = _t.append("info_panels.history.title");
59911     panel.key = _t("info_panels.history.key");
59912     return panel;
59913   }
59914   var init_history2 = __esm({
59915     "modules/ui/panels/history.js"() {
59916       "use strict";
59917       init_localizer();
59918       init_svg();
59919     }
59920   });
59921
59922   // modules/ui/panels/location.js
59923   var location_exports = {};
59924   __export(location_exports, {
59925     uiPanelLocation: () => uiPanelLocation
59926   });
59927   function uiPanelLocation(context) {
59928     var currLocation = "";
59929     function redraw(selection2) {
59930       selection2.html("");
59931       var list2 = selection2.append("ul");
59932       var coord2 = context.map().mouseCoordinates();
59933       if (coord2.some(isNaN)) {
59934         coord2 = context.map().center();
59935       }
59936       list2.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
59937       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
59938       debouncedGetLocation(selection2, coord2);
59939     }
59940     var debouncedGetLocation = debounce_default(getLocation, 250);
59941     function getLocation(selection2, coord2) {
59942       if (!services.geocoder) {
59943         currLocation = _t("info_panels.location.unknown_location");
59944         selection2.selectAll(".location-info").text(currLocation);
59945       } else {
59946         services.geocoder.reverse(coord2, function(err, result) {
59947           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
59948           selection2.selectAll(".location-info").text(currLocation);
59949         });
59950       }
59951     }
59952     var panel = function(selection2) {
59953       selection2.call(redraw);
59954       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
59955         selection2.call(redraw);
59956       });
59957     };
59958     panel.off = function() {
59959       context.surface().on(".info-location", null);
59960     };
59961     panel.id = "location";
59962     panel.label = _t.append("info_panels.location.title");
59963     panel.key = _t("info_panels.location.key");
59964     return panel;
59965   }
59966   var init_location = __esm({
59967     "modules/ui/panels/location.js"() {
59968       "use strict";
59969       init_debounce();
59970       init_units();
59971       init_localizer();
59972       init_services();
59973     }
59974   });
59975
59976   // modules/ui/panels/measurement.js
59977   var measurement_exports = {};
59978   __export(measurement_exports, {
59979     uiPanelMeasurement: () => uiPanelMeasurement
59980   });
59981   function uiPanelMeasurement(context) {
59982     function radiansToMeters(r2) {
59983       return r2 * 63710071809e-4;
59984     }
59985     function steradiansToSqmeters(r2) {
59986       return r2 / (4 * Math.PI) * 510065621724e3;
59987     }
59988     function toLineString(feature3) {
59989       if (feature3.type === "LineString") return feature3;
59990       var result = { type: "LineString", coordinates: [] };
59991       if (feature3.type === "Polygon") {
59992         result.coordinates = feature3.coordinates[0];
59993       } else if (feature3.type === "MultiPolygon") {
59994         result.coordinates = feature3.coordinates[0][0];
59995       }
59996       return result;
59997     }
59998     var _isImperial = !_mainLocalizer.usesMetric();
59999     function redraw(selection2) {
60000       var graph = context.graph();
60001       var selectedNoteID = context.selectedNoteID();
60002       var osm = services.osm;
60003       var localeCode = _mainLocalizer.localeCode();
60004       var heading2;
60005       var center, location, centroid;
60006       var closed, geometry;
60007       var totalNodeCount, length2 = 0, area = 0, distance;
60008       if (selectedNoteID && osm) {
60009         var note = osm.getNote(selectedNoteID);
60010         heading2 = _t.html("note.note") + " " + selectedNoteID;
60011         location = note.loc;
60012         geometry = "note";
60013       } else {
60014         var selectedIDs = context.selectedIDs().filter(function(id2) {
60015           return context.hasEntity(id2);
60016         });
60017         var selected = selectedIDs.map(function(id2) {
60018           return context.entity(id2);
60019         });
60020         heading2 = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
60021         if (selected.length) {
60022           var extent = geoExtent();
60023           for (var i3 in selected) {
60024             var entity = selected[i3];
60025             extent._extend(entity.extent(graph));
60026             geometry = entity.geometry(graph);
60027             if (geometry === "line" || geometry === "area") {
60028               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
60029               var feature3 = entity.asGeoJSON(graph);
60030               length2 += radiansToMeters(length_default(toLineString(feature3)));
60031               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
60032               centroid = centroid && context.projection.invert(centroid);
60033               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
60034                 centroid = entity.extent(graph).center();
60035               }
60036               if (closed) {
60037                 area += steradiansToSqmeters(entity.area(graph));
60038               }
60039             }
60040           }
60041           if (selected.length > 1) {
60042             geometry = null;
60043             closed = null;
60044             centroid = null;
60045           }
60046           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
60047             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
60048           }
60049           if (selected.length === 1 && selected[0].type === "node") {
60050             location = selected[0].loc;
60051           } else {
60052             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
60053           }
60054           if (!location && !centroid) {
60055             center = extent.center();
60056           }
60057         }
60058       }
60059       selection2.html("");
60060       if (heading2) {
60061         selection2.append("h4").attr("class", "measurement-heading").html(heading2);
60062       }
60063       var list2 = selection2.append("ul");
60064       var coordItem;
60065       if (geometry) {
60066         list2.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
60067           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
60068         );
60069       }
60070       if (totalNodeCount) {
60071         list2.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
60072       }
60073       if (area) {
60074         list2.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
60075       }
60076       if (length2) {
60077         list2.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
60078       }
60079       if (typeof distance === "number") {
60080         list2.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
60081       }
60082       if (location) {
60083         coordItem = list2.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
60084         coordItem.append("span").text(dmsCoordinatePair(location));
60085         coordItem.append("span").text(decimalCoordinatePair(location));
60086       }
60087       if (centroid) {
60088         coordItem = list2.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
60089         coordItem.append("span").text(dmsCoordinatePair(centroid));
60090         coordItem.append("span").text(decimalCoordinatePair(centroid));
60091       }
60092       if (center) {
60093         coordItem = list2.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
60094         coordItem.append("span").text(dmsCoordinatePair(center));
60095         coordItem.append("span").text(decimalCoordinatePair(center));
60096       }
60097       if (length2 || area || typeof distance === "number") {
60098         var toggle = _isImperial ? "imperial" : "metric";
60099         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
60100           d3_event.preventDefault();
60101           _isImperial = !_isImperial;
60102           selection2.call(redraw);
60103         });
60104       }
60105     }
60106     var panel = function(selection2) {
60107       selection2.call(redraw);
60108       context.map().on("drawn.info-measurement", function() {
60109         selection2.call(redraw);
60110       });
60111       context.on("enter.info-measurement", function() {
60112         selection2.call(redraw);
60113       });
60114     };
60115     panel.off = function() {
60116       context.map().on("drawn.info-measurement", null);
60117       context.on("enter.info-measurement", null);
60118     };
60119     panel.id = "measurement";
60120     panel.label = _t.append("info_panels.measurement.title");
60121     panel.key = _t("info_panels.measurement.key");
60122     return panel;
60123   }
60124   var init_measurement = __esm({
60125     "modules/ui/panels/measurement.js"() {
60126       "use strict";
60127       init_src2();
60128       init_localizer();
60129       init_units();
60130       init_geo2();
60131       init_services();
60132       init_util();
60133     }
60134   });
60135
60136   // modules/ui/panels/index.js
60137   var panels_exports = {};
60138   __export(panels_exports, {
60139     uiInfoPanels: () => uiInfoPanels,
60140     uiPanelBackground: () => uiPanelBackground,
60141     uiPanelHistory: () => uiPanelHistory,
60142     uiPanelLocation: () => uiPanelLocation,
60143     uiPanelMeasurement: () => uiPanelMeasurement
60144   });
60145   var uiInfoPanels;
60146   var init_panels = __esm({
60147     "modules/ui/panels/index.js"() {
60148       "use strict";
60149       init_background();
60150       init_history2();
60151       init_location();
60152       init_measurement();
60153       init_background();
60154       init_history2();
60155       init_location();
60156       init_measurement();
60157       uiInfoPanels = {
60158         background: uiPanelBackground,
60159         history: uiPanelHistory,
60160         location: uiPanelLocation,
60161         measurement: uiPanelMeasurement
60162       };
60163     }
60164   });
60165
60166   // modules/ui/info.js
60167   var info_exports = {};
60168   __export(info_exports, {
60169     uiInfo: () => uiInfo
60170   });
60171   function uiInfo(context) {
60172     var ids = Object.keys(uiInfoPanels);
60173     var wasActive = ["measurement"];
60174     var panels = {};
60175     var active = {};
60176     ids.forEach(function(k2) {
60177       if (!panels[k2]) {
60178         panels[k2] = uiInfoPanels[k2](context);
60179         active[k2] = false;
60180       }
60181     });
60182     function info(selection2) {
60183       function redraw() {
60184         var activeids = ids.filter(function(k2) {
60185           return active[k2];
60186         }).sort();
60187         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
60188           return k2;
60189         });
60190         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
60191           select_default2(this).call(panels[d2].off).remove();
60192         });
60193         var enter = containers.enter().append("div").attr("class", function(d2) {
60194           return "fillD2 panel-container panel-container-" + d2;
60195         });
60196         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
60197         var title = enter.append("div").attr("class", "panel-title fillD2");
60198         title.append("h3").each(function(d2) {
60199           return panels[d2].label(select_default2(this));
60200         });
60201         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
60202           d3_event.stopImmediatePropagation();
60203           d3_event.preventDefault();
60204           info.toggle(d2);
60205         }).call(svgIcon("#iD-icon-close"));
60206         enter.append("div").attr("class", function(d2) {
60207           return "panel-content panel-content-" + d2;
60208         });
60209         infoPanels.selectAll(".panel-content").each(function(d2) {
60210           select_default2(this).call(panels[d2]);
60211         });
60212       }
60213       info.toggle = function(which) {
60214         var activeids = ids.filter(function(k2) {
60215           return active[k2];
60216         });
60217         if (which) {
60218           active[which] = !active[which];
60219           if (activeids.length === 1 && activeids[0] === which) {
60220             wasActive = [which];
60221           }
60222           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
60223         } else {
60224           if (activeids.length) {
60225             wasActive = activeids;
60226             activeids.forEach(function(k2) {
60227               active[k2] = false;
60228             });
60229           } else {
60230             wasActive.forEach(function(k2) {
60231               active[k2] = true;
60232             });
60233           }
60234         }
60235         redraw();
60236       };
60237       var infoPanels = selection2.selectAll(".info-panels").data([0]);
60238       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
60239       redraw();
60240       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
60241         if (d3_event.shiftKey) return;
60242         d3_event.stopImmediatePropagation();
60243         d3_event.preventDefault();
60244         info.toggle();
60245       });
60246       ids.forEach(function(k2) {
60247         var key = _t("info_panels." + k2 + ".key", { default: null });
60248         if (!key) return;
60249         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
60250           d3_event.stopImmediatePropagation();
60251           d3_event.preventDefault();
60252           info.toggle(k2);
60253         });
60254       });
60255     }
60256     return info;
60257   }
60258   var init_info = __esm({
60259     "modules/ui/info.js"() {
60260       "use strict";
60261       init_src5();
60262       init_localizer();
60263       init_icon();
60264       init_cmd();
60265       init_panels();
60266     }
60267   });
60268
60269   // modules/ui/toggle.js
60270   var toggle_exports = {};
60271   __export(toggle_exports, {
60272     uiToggle: () => uiToggle
60273   });
60274   function uiToggle(show, callback) {
60275     return function(selection2) {
60276       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
60277         select_default2(this).classed("hide", !show).style("opacity", null);
60278         if (callback) callback.apply(this);
60279       });
60280     };
60281   }
60282   var init_toggle = __esm({
60283     "modules/ui/toggle.js"() {
60284       "use strict";
60285       init_src5();
60286     }
60287   });
60288
60289   // modules/ui/curtain.js
60290   var curtain_exports = {};
60291   __export(curtain_exports, {
60292     uiCurtain: () => uiCurtain
60293   });
60294   function uiCurtain(containerNode) {
60295     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
60296     function curtain(selection2) {
60297       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
60298       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
60299       select_default2(window).on("resize.curtain", resize);
60300       tooltip = selection2.append("div").attr("class", "tooltip");
60301       tooltip.append("div").attr("class", "popover-arrow");
60302       tooltip.append("div").attr("class", "popover-inner");
60303       resize();
60304       function resize() {
60305         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
60306         curtain.cut(darkness.datum());
60307       }
60308     }
60309     curtain.reveal = function(box, html3, options2) {
60310       options2 = options2 || {};
60311       if (typeof box === "string") {
60312         box = select_default2(box).node();
60313       }
60314       if (box && box.getBoundingClientRect) {
60315         box = copyBox(box.getBoundingClientRect());
60316       }
60317       if (box) {
60318         var containerRect = containerNode.getBoundingClientRect();
60319         box.top -= containerRect.top;
60320         box.left -= containerRect.left;
60321       }
60322       if (box && options2.padding) {
60323         box.top -= options2.padding;
60324         box.left -= options2.padding;
60325         box.bottom += options2.padding;
60326         box.right += options2.padding;
60327         box.height += options2.padding * 2;
60328         box.width += options2.padding * 2;
60329       }
60330       var tooltipBox;
60331       if (options2.tooltipBox) {
60332         tooltipBox = options2.tooltipBox;
60333         if (typeof tooltipBox === "string") {
60334           tooltipBox = select_default2(tooltipBox).node();
60335         }
60336         if (tooltipBox && tooltipBox.getBoundingClientRect) {
60337           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
60338         }
60339       } else {
60340         tooltipBox = box;
60341       }
60342       if (tooltipBox && html3) {
60343         if (html3.indexOf("**") !== -1) {
60344           if (html3.indexOf("<span") === 0) {
60345             html3 = html3.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
60346           } else {
60347             html3 = html3.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
60348           }
60349           html3 = html3.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
60350         }
60351         html3 = html3.replace(/\*(.*?)\*/g, "<em>$1</em>");
60352         html3 = html3.replace(/\{br\}/g, "<br/><br/>");
60353         if (options2.buttonText && options2.buttonCallback) {
60354           html3 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
60355         }
60356         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
60357         tooltip.classed(classes, true).selectAll(".popover-inner").html(html3);
60358         if (options2.buttonText && options2.buttonCallback) {
60359           var button = tooltip.selectAll(".button-section .button.action");
60360           button.on("click", function(d3_event) {
60361             d3_event.preventDefault();
60362             options2.buttonCallback();
60363           });
60364         }
60365         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
60366         if (options2.tooltipClass === "intro-mouse") {
60367           tip.height += 80;
60368         }
60369         if (tooltipBox.top + tooltipBox.height > h2) {
60370           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
60371         }
60372         if (tooltipBox.left + tooltipBox.width > w2) {
60373           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
60374         }
60375         const onLeftOrRightEdge = tooltipBox.left + tooltipBox.width / 2 > w2 - 100 || tooltipBox.left + tooltipBox.width / 2 < 100;
60376         if (tooltipBox.top + tooltipBox.height < 100 && !onLeftOrRightEdge) {
60377           side = "bottom";
60378           pos = [
60379             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
60380             tooltipBox.top + tooltipBox.height
60381           ];
60382         } else if (tooltipBox.top > h2 - 140 && !onLeftOrRightEdge) {
60383           side = "top";
60384           pos = [
60385             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
60386             tooltipBox.top - tip.height
60387           ];
60388         } else {
60389           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
60390           if (_mainLocalizer.textDirection() === "rtl") {
60391             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
60392               side = "right";
60393               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
60394             } else {
60395               side = "left";
60396               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
60397             }
60398           } else {
60399             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
60400               side = "left";
60401               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
60402             } else {
60403               side = "right";
60404               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
60405             }
60406           }
60407         }
60408         if (options2.duration !== 0 || !tooltip.classed(side)) {
60409           tooltip.call(uiToggle(true));
60410         }
60411         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
60412         var shiftY = 0;
60413         if (side === "left" || side === "right") {
60414           if (pos[1] < 60) {
60415             shiftY = 60 - pos[1];
60416           } else if (pos[1] + tip.height > h2 - 100) {
60417             shiftY = h2 - pos[1] - tip.height - 100;
60418           }
60419         }
60420         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
60421       } else {
60422         tooltip.classed("in", false).call(uiToggle(false));
60423       }
60424       curtain.cut(box, options2.duration);
60425       return tooltip;
60426     };
60427     curtain.cut = function(datum2, duration) {
60428       darkness.datum(datum2).interrupt();
60429       var selection2;
60430       if (duration === 0) {
60431         selection2 = darkness;
60432       } else {
60433         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
60434       }
60435       selection2.attr("d", function(d2) {
60436         var containerWidth = containerNode.clientWidth;
60437         var containerHeight = containerNode.clientHeight;
60438         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
60439         if (!d2) return string;
60440         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";
60441       });
60442     };
60443     curtain.remove = function() {
60444       surface.remove();
60445       tooltip.remove();
60446       select_default2(window).on("resize.curtain", null);
60447     };
60448     function copyBox(src) {
60449       return {
60450         top: src.top,
60451         right: src.right,
60452         bottom: src.bottom,
60453         left: src.left,
60454         width: src.width,
60455         height: src.height
60456       };
60457     }
60458     return curtain;
60459   }
60460   var init_curtain = __esm({
60461     "modules/ui/curtain.js"() {
60462       "use strict";
60463       init_src10();
60464       init_src5();
60465       init_localizer();
60466       init_toggle();
60467     }
60468   });
60469
60470   // modules/ui/intro/welcome.js
60471   var welcome_exports = {};
60472   __export(welcome_exports, {
60473     uiIntroWelcome: () => uiIntroWelcome
60474   });
60475   function uiIntroWelcome(context, reveal) {
60476     var dispatch14 = dispatch_default("done");
60477     var chapter = {
60478       title: "intro.welcome.title"
60479     };
60480     function welcome() {
60481       context.map().centerZoom([-85.63591, 41.94285], 19);
60482       reveal(
60483         ".intro-nav-wrap .chapter-welcome",
60484         helpHtml("intro.welcome.welcome"),
60485         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
60486       );
60487     }
60488     function practice() {
60489       reveal(
60490         ".intro-nav-wrap .chapter-welcome",
60491         helpHtml("intro.welcome.practice"),
60492         { buttonText: _t.html("intro.ok"), buttonCallback: words }
60493       );
60494     }
60495     function words() {
60496       reveal(
60497         ".intro-nav-wrap .chapter-welcome",
60498         helpHtml("intro.welcome.words"),
60499         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
60500       );
60501     }
60502     function chapters() {
60503       dispatch14.call("done");
60504       reveal(
60505         ".intro-nav-wrap .chapter-navigation",
60506         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
60507       );
60508     }
60509     chapter.enter = function() {
60510       welcome();
60511     };
60512     chapter.exit = function() {
60513       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
60514     };
60515     chapter.restart = function() {
60516       chapter.exit();
60517       chapter.enter();
60518     };
60519     return utilRebind(chapter, dispatch14, "on");
60520   }
60521   var init_welcome = __esm({
60522     "modules/ui/intro/welcome.js"() {
60523       "use strict";
60524       init_src4();
60525       init_helper();
60526       init_localizer();
60527       init_rebind();
60528     }
60529   });
60530
60531   // modules/ui/intro/navigation.js
60532   var navigation_exports = {};
60533   __export(navigation_exports, {
60534     uiIntroNavigation: () => uiIntroNavigation
60535   });
60536   function uiIntroNavigation(context, reveal) {
60537     var dispatch14 = dispatch_default("done");
60538     var timeouts = [];
60539     var hallId = "n2061";
60540     var townHall = [-85.63591, 41.94285];
60541     var springStreetId = "w397";
60542     var springStreetEndId = "n1834";
60543     var springStreet = [-85.63582, 41.94255];
60544     var onewayField = _mainPresetIndex.field("oneway");
60545     var maxspeedField = _mainPresetIndex.field("maxspeed");
60546     var chapter = {
60547       title: "intro.navigation.title"
60548     };
60549     function timeout2(f2, t2) {
60550       timeouts.push(window.setTimeout(f2, t2));
60551     }
60552     function eventCancel(d3_event) {
60553       d3_event.stopPropagation();
60554       d3_event.preventDefault();
60555     }
60556     function isTownHallSelected() {
60557       var ids = context.selectedIDs();
60558       return ids.length === 1 && ids[0] === hallId;
60559     }
60560     function dragMap() {
60561       context.enter(modeBrowse(context));
60562       context.history().reset("initial");
60563       var msec = transitionTime(townHall, context.map().center());
60564       if (msec) {
60565         reveal(null, null, { duration: 0 });
60566       }
60567       context.map().centerZoomEase(townHall, 19, msec);
60568       timeout2(function() {
60569         var centerStart = context.map().center();
60570         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
60571         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
60572         reveal(".main-map .surface", dragString);
60573         context.map().on("drawn.intro", function() {
60574           reveal(".main-map .surface", dragString, { duration: 0 });
60575         });
60576         context.map().on("move.intro", function() {
60577           var centerNow = context.map().center();
60578           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
60579             context.map().on("move.intro", null);
60580             timeout2(function() {
60581               continueTo(zoomMap);
60582             }, 3e3);
60583           }
60584         });
60585       }, msec + 100);
60586       function continueTo(nextStep) {
60587         context.map().on("move.intro drawn.intro", null);
60588         nextStep();
60589       }
60590     }
60591     function zoomMap() {
60592       var zoomStart = context.map().zoom();
60593       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
60594       var zoomString = helpHtml("intro.navigation." + textId);
60595       reveal(".main-map .surface", zoomString);
60596       context.map().on("drawn.intro", function() {
60597         reveal(".main-map .surface", zoomString, { duration: 0 });
60598       });
60599       context.map().on("move.intro", function() {
60600         if (context.map().zoom() !== zoomStart) {
60601           context.map().on("move.intro", null);
60602           timeout2(function() {
60603             continueTo(features);
60604           }, 3e3);
60605         }
60606       });
60607       function continueTo(nextStep) {
60608         context.map().on("move.intro drawn.intro", null);
60609         nextStep();
60610       }
60611     }
60612     function features() {
60613       var onClick = function() {
60614         continueTo(pointsLinesAreas);
60615       };
60616       reveal(
60617         ".main-map .surface",
60618         helpHtml("intro.navigation.features"),
60619         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60620       );
60621       context.map().on("drawn.intro", function() {
60622         reveal(
60623           ".main-map .surface",
60624           helpHtml("intro.navigation.features"),
60625           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60626         );
60627       });
60628       function continueTo(nextStep) {
60629         context.map().on("drawn.intro", null);
60630         nextStep();
60631       }
60632     }
60633     function pointsLinesAreas() {
60634       var onClick = function() {
60635         continueTo(nodesWays);
60636       };
60637       reveal(
60638         ".main-map .surface",
60639         helpHtml("intro.navigation.points_lines_areas"),
60640         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60641       );
60642       context.map().on("drawn.intro", function() {
60643         reveal(
60644           ".main-map .surface",
60645           helpHtml("intro.navigation.points_lines_areas"),
60646           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60647         );
60648       });
60649       function continueTo(nextStep) {
60650         context.map().on("drawn.intro", null);
60651         nextStep();
60652       }
60653     }
60654     function nodesWays() {
60655       var onClick = function() {
60656         continueTo(clickTownHall);
60657       };
60658       reveal(
60659         ".main-map .surface",
60660         helpHtml("intro.navigation.nodes_ways"),
60661         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60662       );
60663       context.map().on("drawn.intro", function() {
60664         reveal(
60665           ".main-map .surface",
60666           helpHtml("intro.navigation.nodes_ways"),
60667           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60668         );
60669       });
60670       function continueTo(nextStep) {
60671         context.map().on("drawn.intro", null);
60672         nextStep();
60673       }
60674     }
60675     function clickTownHall() {
60676       context.enter(modeBrowse(context));
60677       context.history().reset("initial");
60678       var entity = context.hasEntity(hallId);
60679       if (!entity) return;
60680       reveal(null, null, { duration: 0 });
60681       context.map().centerZoomEase(entity.loc, 19, 500);
60682       timeout2(function() {
60683         var entity2 = context.hasEntity(hallId);
60684         if (!entity2) return;
60685         var box = pointBox(entity2.loc, context);
60686         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
60687         reveal(box, helpHtml("intro.navigation." + textId));
60688         context.map().on("move.intro drawn.intro", function() {
60689           var entity3 = context.hasEntity(hallId);
60690           if (!entity3) return;
60691           var box2 = pointBox(entity3.loc, context);
60692           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
60693         });
60694         context.on("enter.intro", function() {
60695           if (isTownHallSelected()) continueTo(selectedTownHall);
60696         });
60697       }, 550);
60698       context.history().on("change.intro", function() {
60699         if (!context.hasEntity(hallId)) {
60700           continueTo(clickTownHall);
60701         }
60702       });
60703       function continueTo(nextStep) {
60704         context.on("enter.intro", null);
60705         context.map().on("move.intro drawn.intro", null);
60706         context.history().on("change.intro", null);
60707         nextStep();
60708       }
60709     }
60710     function selectedTownHall() {
60711       if (!isTownHallSelected()) return clickTownHall();
60712       var entity = context.hasEntity(hallId);
60713       if (!entity) return clickTownHall();
60714       var box = pointBox(entity.loc, context);
60715       var onClick = function() {
60716         continueTo(editorTownHall);
60717       };
60718       reveal(
60719         box,
60720         helpHtml("intro.navigation.selected_townhall"),
60721         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60722       );
60723       context.map().on("move.intro drawn.intro", function() {
60724         var entity2 = context.hasEntity(hallId);
60725         if (!entity2) return;
60726         var box2 = pointBox(entity2.loc, context);
60727         reveal(
60728           box2,
60729           helpHtml("intro.navigation.selected_townhall"),
60730           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60731         );
60732       });
60733       context.history().on("change.intro", function() {
60734         if (!context.hasEntity(hallId)) {
60735           continueTo(clickTownHall);
60736         }
60737       });
60738       function continueTo(nextStep) {
60739         context.map().on("move.intro drawn.intro", null);
60740         context.history().on("change.intro", null);
60741         nextStep();
60742       }
60743     }
60744     function editorTownHall() {
60745       if (!isTownHallSelected()) return clickTownHall();
60746       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60747       var onClick = function() {
60748         continueTo(presetTownHall);
60749       };
60750       reveal(
60751         ".entity-editor-pane",
60752         helpHtml("intro.navigation.editor_townhall"),
60753         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60754       );
60755       context.on("exit.intro", function() {
60756         continueTo(clickTownHall);
60757       });
60758       context.history().on("change.intro", function() {
60759         if (!context.hasEntity(hallId)) {
60760           continueTo(clickTownHall);
60761         }
60762       });
60763       function continueTo(nextStep) {
60764         context.on("exit.intro", null);
60765         context.history().on("change.intro", null);
60766         context.container().select(".inspector-wrap").on("wheel.intro", null);
60767         nextStep();
60768       }
60769     }
60770     function presetTownHall() {
60771       if (!isTownHallSelected()) return clickTownHall();
60772       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60773       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60774       var entity = context.entity(context.selectedIDs()[0]);
60775       var preset = _mainPresetIndex.match(entity, context.graph());
60776       var onClick = function() {
60777         continueTo(fieldsTownHall);
60778       };
60779       reveal(
60780         ".entity-editor-pane .section-feature-type",
60781         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
60782         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60783       );
60784       context.on("exit.intro", function() {
60785         continueTo(clickTownHall);
60786       });
60787       context.history().on("change.intro", function() {
60788         if (!context.hasEntity(hallId)) {
60789           continueTo(clickTownHall);
60790         }
60791       });
60792       function continueTo(nextStep) {
60793         context.on("exit.intro", null);
60794         context.history().on("change.intro", null);
60795         context.container().select(".inspector-wrap").on("wheel.intro", null);
60796         nextStep();
60797       }
60798     }
60799     function fieldsTownHall() {
60800       if (!isTownHallSelected()) return clickTownHall();
60801       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60802       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60803       var onClick = function() {
60804         continueTo(closeTownHall);
60805       };
60806       reveal(
60807         ".entity-editor-pane .section-preset-fields",
60808         helpHtml("intro.navigation.fields_townhall"),
60809         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60810       );
60811       context.on("exit.intro", function() {
60812         continueTo(clickTownHall);
60813       });
60814       context.history().on("change.intro", function() {
60815         if (!context.hasEntity(hallId)) {
60816           continueTo(clickTownHall);
60817         }
60818       });
60819       function continueTo(nextStep) {
60820         context.on("exit.intro", null);
60821         context.history().on("change.intro", null);
60822         context.container().select(".inspector-wrap").on("wheel.intro", null);
60823         nextStep();
60824       }
60825     }
60826     function closeTownHall() {
60827       if (!isTownHallSelected()) return clickTownHall();
60828       var selector = ".entity-editor-pane button.close svg use";
60829       var href = select_default2(selector).attr("href") || "#iD-icon-close";
60830       reveal(
60831         ".entity-editor-pane",
60832         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
60833       );
60834       context.on("exit.intro", function() {
60835         continueTo(searchStreet);
60836       });
60837       context.history().on("change.intro", function() {
60838         var selector2 = ".entity-editor-pane button.close svg use";
60839         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60840         reveal(
60841           ".entity-editor-pane",
60842           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
60843           { duration: 0 }
60844         );
60845       });
60846       function continueTo(nextStep) {
60847         context.on("exit.intro", null);
60848         context.history().on("change.intro", null);
60849         nextStep();
60850       }
60851     }
60852     function searchStreet() {
60853       context.enter(modeBrowse(context));
60854       context.history().reset("initial");
60855       var msec = transitionTime(springStreet, context.map().center());
60856       if (msec) {
60857         reveal(null, null, { duration: 0 });
60858       }
60859       context.map().centerZoomEase(springStreet, 19, msec);
60860       timeout2(function() {
60861         reveal(
60862           ".search-header input",
60863           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
60864         );
60865         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
60866       }, msec + 100);
60867     }
60868     function checkSearchResult() {
60869       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
60870       var firstName = first.select(".entity-name");
60871       var name = _t("intro.graph.name.spring-street");
60872       if (!firstName.empty() && firstName.html() === name) {
60873         reveal(
60874           first.node(),
60875           helpHtml("intro.navigation.choose_street", { name }),
60876           { duration: 300 }
60877         );
60878         context.on("exit.intro", function() {
60879           continueTo(selectedStreet);
60880         });
60881         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60882       }
60883       function continueTo(nextStep) {
60884         context.on("exit.intro", null);
60885         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
60886         nextStep();
60887       }
60888     }
60889     function selectedStreet() {
60890       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60891         return searchStreet();
60892       }
60893       var onClick = function() {
60894         continueTo(editorStreet);
60895       };
60896       var entity = context.entity(springStreetEndId);
60897       var box = pointBox(entity.loc, context);
60898       box.height = 500;
60899       reveal(
60900         box,
60901         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60902         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60903       );
60904       timeout2(function() {
60905         context.map().on("move.intro drawn.intro", function() {
60906           var entity2 = context.hasEntity(springStreetEndId);
60907           if (!entity2) return;
60908           var box2 = pointBox(entity2.loc, context);
60909           box2.height = 500;
60910           reveal(
60911             box2,
60912             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60913             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60914           );
60915         });
60916       }, 600);
60917       context.on("enter.intro", function(mode) {
60918         if (!context.hasEntity(springStreetId)) {
60919           return continueTo(searchStreet);
60920         }
60921         var ids = context.selectedIDs();
60922         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
60923           context.enter(modeSelect(context, [springStreetId]));
60924         }
60925       });
60926       context.history().on("change.intro", function() {
60927         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60928           timeout2(function() {
60929             continueTo(searchStreet);
60930           }, 300);
60931         }
60932       });
60933       function continueTo(nextStep) {
60934         context.map().on("move.intro drawn.intro", null);
60935         context.on("enter.intro", null);
60936         context.history().on("change.intro", null);
60937         nextStep();
60938       }
60939     }
60940     function editorStreet() {
60941       var selector = ".entity-editor-pane button.close svg use";
60942       var href = select_default2(selector).attr("href") || "#iD-icon-close";
60943       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60944         button: { html: icon(href, "inline") },
60945         field1: onewayField.title(),
60946         field2: maxspeedField.title()
60947       }));
60948       context.on("exit.intro", function() {
60949         continueTo(play);
60950       });
60951       context.history().on("change.intro", function() {
60952         var selector2 = ".entity-editor-pane button.close svg use";
60953         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60954         reveal(
60955           ".entity-editor-pane",
60956           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60957             button: { html: icon(href2, "inline") },
60958             field1: onewayField.title(),
60959             field2: maxspeedField.title()
60960           }),
60961           { duration: 0 }
60962         );
60963       });
60964       function continueTo(nextStep) {
60965         context.on("exit.intro", null);
60966         context.history().on("change.intro", null);
60967         nextStep();
60968       }
60969     }
60970     function play() {
60971       dispatch14.call("done");
60972       reveal(
60973         ".ideditor",
60974         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
60975         {
60976           tooltipBox: ".intro-nav-wrap .chapter-point",
60977           buttonText: _t.html("intro.ok"),
60978           buttonCallback: function() {
60979             reveal(".ideditor");
60980           }
60981         }
60982       );
60983     }
60984     chapter.enter = function() {
60985       dragMap();
60986     };
60987     chapter.exit = function() {
60988       timeouts.forEach(window.clearTimeout);
60989       context.on("enter.intro exit.intro", null);
60990       context.map().on("move.intro drawn.intro", null);
60991       context.history().on("change.intro", null);
60992       context.container().select(".inspector-wrap").on("wheel.intro", null);
60993       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
60994     };
60995     chapter.restart = function() {
60996       chapter.exit();
60997       chapter.enter();
60998     };
60999     return utilRebind(chapter, dispatch14, "on");
61000   }
61001   var init_navigation = __esm({
61002     "modules/ui/intro/navigation.js"() {
61003       "use strict";
61004       init_src4();
61005       init_src5();
61006       init_presets();
61007       init_localizer();
61008       init_browse();
61009       init_select5();
61010       init_rebind();
61011       init_helper();
61012     }
61013   });
61014
61015   // modules/ui/intro/point.js
61016   var point_exports = {};
61017   __export(point_exports, {
61018     uiIntroPoint: () => uiIntroPoint
61019   });
61020   function uiIntroPoint(context, reveal) {
61021     var dispatch14 = dispatch_default("done");
61022     var timeouts = [];
61023     var intersection2 = [-85.63279, 41.94394];
61024     var building = [-85.632422, 41.944045];
61025     var cafePreset = _mainPresetIndex.item("amenity/cafe");
61026     var _pointID = null;
61027     var chapter = {
61028       title: "intro.points.title"
61029     };
61030     function timeout2(f2, t2) {
61031       timeouts.push(window.setTimeout(f2, t2));
61032     }
61033     function eventCancel(d3_event) {
61034       d3_event.stopPropagation();
61035       d3_event.preventDefault();
61036     }
61037     function addPoint() {
61038       context.enter(modeBrowse(context));
61039       context.history().reset("initial");
61040       var msec = transitionTime(intersection2, context.map().center());
61041       if (msec) {
61042         reveal(null, null, { duration: 0 });
61043       }
61044       context.map().centerZoomEase(intersection2, 19, msec);
61045       timeout2(function() {
61046         var tooltip = reveal(
61047           "button.add-point",
61048           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
61049         );
61050         _pointID = null;
61051         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
61052         context.on("enter.intro", function(mode) {
61053           if (mode.id !== "add-point") return;
61054           continueTo(placePoint);
61055         });
61056       }, msec + 100);
61057       function continueTo(nextStep) {
61058         context.on("enter.intro", null);
61059         nextStep();
61060       }
61061     }
61062     function placePoint() {
61063       if (context.mode().id !== "add-point") {
61064         return chapter.restart();
61065       }
61066       var pointBox2 = pad2(building, 150, context);
61067       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
61068       reveal(pointBox2, helpHtml("intro.points." + textId));
61069       context.map().on("move.intro drawn.intro", function() {
61070         pointBox2 = pad2(building, 150, context);
61071         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
61072       });
61073       context.on("enter.intro", function(mode) {
61074         if (mode.id !== "select") return chapter.restart();
61075         _pointID = context.mode().selectedIDs()[0];
61076         if (context.graph().geometry(_pointID) === "vertex") {
61077           context.map().on("move.intro drawn.intro", null);
61078           context.on("enter.intro", null);
61079           reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
61080             buttonText: _t.html("intro.ok"),
61081             buttonCallback: function() {
61082               return chapter.restart();
61083             }
61084           });
61085         } else {
61086           continueTo(searchPreset);
61087         }
61088       });
61089       function continueTo(nextStep) {
61090         context.map().on("move.intro drawn.intro", null);
61091         context.on("enter.intro", null);
61092         nextStep();
61093       }
61094     }
61095     function searchPreset() {
61096       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61097         return addPoint();
61098       }
61099       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61100       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61101       reveal(
61102         ".preset-search-input",
61103         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
61104       );
61105       context.on("enter.intro", function(mode) {
61106         if (!_pointID || !context.hasEntity(_pointID)) {
61107           return continueTo(addPoint);
61108         }
61109         var ids = context.selectedIDs();
61110         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
61111           context.enter(modeSelect(context, [_pointID]));
61112           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61113           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61114           reveal(
61115             ".preset-search-input",
61116             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
61117           );
61118           context.history().on("change.intro", null);
61119         }
61120       });
61121       function checkPresetSearch() {
61122         var first = context.container().select(".preset-list-item:first-child");
61123         if (first.classed("preset-amenity-cafe")) {
61124           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
61125           reveal(
61126             first.select(".preset-list-button").node(),
61127             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
61128             { duration: 300 }
61129           );
61130           context.history().on("change.intro", function() {
61131             continueTo(aboutFeatureEditor);
61132           });
61133         }
61134       }
61135       function continueTo(nextStep) {
61136         context.on("enter.intro", null);
61137         context.history().on("change.intro", null);
61138         context.container().select(".inspector-wrap").on("wheel.intro", null);
61139         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61140         nextStep();
61141       }
61142     }
61143     function aboutFeatureEditor() {
61144       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61145         return addPoint();
61146       }
61147       timeout2(function() {
61148         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
61149           tooltipClass: "intro-points-describe",
61150           buttonText: _t.html("intro.ok"),
61151           buttonCallback: function() {
61152             continueTo(addName);
61153           }
61154         });
61155       }, 400);
61156       context.on("exit.intro", function() {
61157         continueTo(reselectPoint);
61158       });
61159       function continueTo(nextStep) {
61160         context.on("exit.intro", null);
61161         nextStep();
61162       }
61163     }
61164     function addName() {
61165       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61166         return addPoint();
61167       }
61168       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61169       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name") + "{br}" + helpHtml("intro.points.add_reminder");
61170       timeout2(function() {
61171         var entity = context.entity(_pointID);
61172         if (entity.tags.name) {
61173           var tooltip = reveal(".entity-editor-pane", addNameString, {
61174             tooltipClass: "intro-points-describe",
61175             buttonText: _t.html("intro.ok"),
61176             buttonCallback: function() {
61177               continueTo(addCloseEditor);
61178             }
61179           });
61180           tooltip.select(".instruction").style("display", "none");
61181         } else {
61182           reveal(
61183             ".entity-editor-pane",
61184             addNameString,
61185             { tooltipClass: "intro-points-describe" }
61186           );
61187         }
61188       }, 400);
61189       context.history().on("change.intro", function() {
61190         continueTo(addCloseEditor);
61191       });
61192       context.on("exit.intro", function() {
61193         continueTo(reselectPoint);
61194       });
61195       function continueTo(nextStep) {
61196         context.on("exit.intro", null);
61197         context.history().on("change.intro", null);
61198         nextStep();
61199       }
61200     }
61201     function addCloseEditor() {
61202       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61203       var selector = ".entity-editor-pane button.close svg use";
61204       var href = select_default2(selector).attr("href") || "#iD-icon-close";
61205       context.on("exit.intro", function() {
61206         continueTo(reselectPoint);
61207       });
61208       reveal(
61209         ".entity-editor-pane",
61210         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
61211       );
61212       function continueTo(nextStep) {
61213         context.on("exit.intro", null);
61214         nextStep();
61215       }
61216     }
61217     function reselectPoint() {
61218       if (!_pointID) return chapter.restart();
61219       var entity = context.hasEntity(_pointID);
61220       if (!entity) return chapter.restart();
61221       var oldPreset = _mainPresetIndex.match(entity, context.graph());
61222       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
61223       context.enter(modeBrowse(context));
61224       var msec = transitionTime(entity.loc, context.map().center());
61225       if (msec) {
61226         reveal(null, null, { duration: 0 });
61227       }
61228       context.map().centerEase(entity.loc, msec);
61229       timeout2(function() {
61230         var box = pointBox(entity.loc, context);
61231         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
61232         timeout2(function() {
61233           context.map().on("move.intro drawn.intro", function() {
61234             var entity2 = context.hasEntity(_pointID);
61235             if (!entity2) return chapter.restart();
61236             var box2 = pointBox(entity2.loc, context);
61237             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
61238           });
61239         }, 600);
61240         context.on("enter.intro", function(mode) {
61241           if (mode.id !== "select") return;
61242           continueTo(updatePoint);
61243         });
61244       }, msec + 100);
61245       function continueTo(nextStep) {
61246         context.map().on("move.intro drawn.intro", null);
61247         context.on("enter.intro", null);
61248         nextStep();
61249       }
61250     }
61251     function updatePoint() {
61252       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61253         return continueTo(reselectPoint);
61254       }
61255       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61256       context.on("exit.intro", function() {
61257         continueTo(reselectPoint);
61258       });
61259       context.history().on("change.intro", function() {
61260         continueTo(updateCloseEditor);
61261       });
61262       timeout2(function() {
61263         reveal(
61264           ".entity-editor-pane",
61265           helpHtml("intro.points.update"),
61266           { tooltipClass: "intro-points-describe" }
61267         );
61268       }, 400);
61269       function continueTo(nextStep) {
61270         context.on("exit.intro", null);
61271         context.history().on("change.intro", null);
61272         nextStep();
61273       }
61274     }
61275     function updateCloseEditor() {
61276       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
61277         return continueTo(reselectPoint);
61278       }
61279       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61280       context.on("exit.intro", function() {
61281         continueTo(rightClickPoint);
61282       });
61283       timeout2(function() {
61284         reveal(
61285           ".entity-editor-pane",
61286           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
61287         );
61288       }, 500);
61289       function continueTo(nextStep) {
61290         context.on("exit.intro", null);
61291         nextStep();
61292       }
61293     }
61294     function rightClickPoint() {
61295       if (!_pointID) return chapter.restart();
61296       var entity = context.hasEntity(_pointID);
61297       if (!entity) return chapter.restart();
61298       context.enter(modeBrowse(context));
61299       var box = pointBox(entity.loc, context);
61300       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
61301       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
61302       timeout2(function() {
61303         context.map().on("move.intro", function() {
61304           var entity2 = context.hasEntity(_pointID);
61305           if (!entity2) return chapter.restart();
61306           var box2 = pointBox(entity2.loc, context);
61307           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
61308         });
61309       }, 600);
61310       context.on("enter.intro", function(mode) {
61311         if (mode.id !== "select") return;
61312         var ids = context.selectedIDs();
61313         if (ids.length !== 1 || ids[0] !== _pointID) return;
61314         timeout2(function() {
61315           var node = selectMenuItem(context, "delete").node();
61316           if (!node) return;
61317           continueTo(enterDelete);
61318         }, 50);
61319       });
61320       function continueTo(nextStep) {
61321         context.on("enter.intro", null);
61322         context.map().on("move.intro", null);
61323         nextStep();
61324       }
61325     }
61326     function enterDelete() {
61327       if (!_pointID) return chapter.restart();
61328       var entity = context.hasEntity(_pointID);
61329       if (!entity) return chapter.restart();
61330       var node = selectMenuItem(context, "delete").node();
61331       if (!node) {
61332         return continueTo(rightClickPoint);
61333       }
61334       reveal(
61335         ".edit-menu",
61336         helpHtml("intro.points.delete"),
61337         { padding: 50 }
61338       );
61339       timeout2(function() {
61340         context.map().on("move.intro", function() {
61341           if (selectMenuItem(context, "delete").empty()) {
61342             return continueTo(rightClickPoint);
61343           }
61344           reveal(
61345             ".edit-menu",
61346             helpHtml("intro.points.delete"),
61347             { duration: 0, padding: 50 }
61348           );
61349         });
61350       }, 300);
61351       context.on("exit.intro", function() {
61352         if (!_pointID) return chapter.restart();
61353         var entity2 = context.hasEntity(_pointID);
61354         if (entity2) return continueTo(rightClickPoint);
61355       });
61356       context.history().on("change.intro", function(changed) {
61357         if (changed.deleted().length) {
61358           continueTo(undo);
61359         }
61360       });
61361       function continueTo(nextStep) {
61362         context.map().on("move.intro", null);
61363         context.history().on("change.intro", null);
61364         context.on("exit.intro", null);
61365         nextStep();
61366       }
61367     }
61368     function undo() {
61369       context.history().on("change.intro", function() {
61370         continueTo(play);
61371       });
61372       reveal(
61373         ".top-toolbar button.undo-button",
61374         helpHtml("intro.points.undo")
61375       );
61376       function continueTo(nextStep) {
61377         context.history().on("change.intro", null);
61378         nextStep();
61379       }
61380     }
61381     function play() {
61382       dispatch14.call("done");
61383       reveal(
61384         ".ideditor",
61385         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
61386         {
61387           tooltipBox: ".intro-nav-wrap .chapter-area",
61388           buttonText: _t.html("intro.ok"),
61389           buttonCallback: function() {
61390             reveal(".ideditor");
61391           }
61392         }
61393       );
61394     }
61395     chapter.enter = function() {
61396       addPoint();
61397     };
61398     chapter.exit = function() {
61399       timeouts.forEach(window.clearTimeout);
61400       context.on("enter.intro exit.intro", null);
61401       context.map().on("move.intro drawn.intro", null);
61402       context.history().on("change.intro", null);
61403       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61404       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61405     };
61406     chapter.restart = function() {
61407       chapter.exit();
61408       chapter.enter();
61409     };
61410     return utilRebind(chapter, dispatch14, "on");
61411   }
61412   var init_point = __esm({
61413     "modules/ui/intro/point.js"() {
61414       "use strict";
61415       init_src4();
61416       init_src5();
61417       init_presets();
61418       init_localizer();
61419       init_change_preset();
61420       init_browse();
61421       init_select5();
61422       init_rebind();
61423       init_helper();
61424     }
61425   });
61426
61427   // modules/ui/intro/area.js
61428   var area_exports = {};
61429   __export(area_exports, {
61430     uiIntroArea: () => uiIntroArea
61431   });
61432   function uiIntroArea(context, reveal) {
61433     var dispatch14 = dispatch_default("done");
61434     var playground = [-85.63552, 41.94159];
61435     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
61436     var nameField = _mainPresetIndex.field("name");
61437     var descriptionField = _mainPresetIndex.field("description");
61438     var timeouts = [];
61439     var _areaID;
61440     var chapter = {
61441       title: "intro.areas.title"
61442     };
61443     function timeout2(f2, t2) {
61444       timeouts.push(window.setTimeout(f2, t2));
61445     }
61446     function eventCancel(d3_event) {
61447       d3_event.stopPropagation();
61448       d3_event.preventDefault();
61449     }
61450     function revealPlayground(center, text, options2) {
61451       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
61452       var box = pad2(center, padding, context);
61453       reveal(box, text, options2);
61454     }
61455     function addArea() {
61456       context.enter(modeBrowse(context));
61457       context.history().reset("initial");
61458       _areaID = null;
61459       var msec = transitionTime(playground, context.map().center());
61460       if (msec) {
61461         reveal(null, null, { duration: 0 });
61462       }
61463       context.map().centerZoomEase(playground, 19, msec);
61464       timeout2(function() {
61465         var tooltip = reveal(
61466           "button.add-area",
61467           helpHtml("intro.areas.add_playground")
61468         );
61469         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
61470         context.on("enter.intro", function(mode) {
61471           if (mode.id !== "add-area") return;
61472           continueTo(startPlayground);
61473         });
61474       }, msec + 100);
61475       function continueTo(nextStep) {
61476         context.on("enter.intro", null);
61477         nextStep();
61478       }
61479     }
61480     function startPlayground() {
61481       if (context.mode().id !== "add-area") {
61482         return chapter.restart();
61483       }
61484       _areaID = null;
61485       context.map().zoomEase(19.5, 500);
61486       timeout2(function() {
61487         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
61488         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
61489         revealPlayground(
61490           playground,
61491           startDrawString,
61492           { duration: 250 }
61493         );
61494         timeout2(function() {
61495           context.map().on("move.intro drawn.intro", function() {
61496             revealPlayground(
61497               playground,
61498               startDrawString,
61499               { duration: 0 }
61500             );
61501           });
61502           context.on("enter.intro", function(mode) {
61503             if (mode.id !== "draw-area") return chapter.restart();
61504             continueTo(continuePlayground);
61505           });
61506         }, 250);
61507       }, 550);
61508       function continueTo(nextStep) {
61509         context.map().on("move.intro drawn.intro", null);
61510         context.on("enter.intro", null);
61511         nextStep();
61512       }
61513     }
61514     function continuePlayground() {
61515       if (context.mode().id !== "draw-area") {
61516         return chapter.restart();
61517       }
61518       _areaID = null;
61519       revealPlayground(
61520         playground,
61521         helpHtml("intro.areas.continue_playground"),
61522         { duration: 250 }
61523       );
61524       timeout2(function() {
61525         context.map().on("move.intro drawn.intro", function() {
61526           revealPlayground(
61527             playground,
61528             helpHtml("intro.areas.continue_playground"),
61529             { duration: 0 }
61530           );
61531         });
61532       }, 250);
61533       context.on("enter.intro", function(mode) {
61534         if (mode.id === "draw-area") {
61535           var entity = context.hasEntity(context.selectedIDs()[0]);
61536           if (entity && entity.nodes.length >= 6) {
61537             return continueTo(finishPlayground);
61538           } else {
61539             return;
61540           }
61541         } else if (mode.id === "select") {
61542           _areaID = context.selectedIDs()[0];
61543           return continueTo(searchPresets);
61544         } else {
61545           return chapter.restart();
61546         }
61547       });
61548       function continueTo(nextStep) {
61549         context.map().on("move.intro drawn.intro", null);
61550         context.on("enter.intro", null);
61551         nextStep();
61552       }
61553     }
61554     function finishPlayground() {
61555       if (context.mode().id !== "draw-area") {
61556         return chapter.restart();
61557       }
61558       _areaID = null;
61559       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
61560       revealPlayground(
61561         playground,
61562         finishString,
61563         { duration: 250 }
61564       );
61565       timeout2(function() {
61566         context.map().on("move.intro drawn.intro", function() {
61567           revealPlayground(
61568             playground,
61569             finishString,
61570             { duration: 0 }
61571           );
61572         });
61573       }, 250);
61574       context.on("enter.intro", function(mode) {
61575         if (mode.id === "draw-area") {
61576           return;
61577         } else if (mode.id === "select") {
61578           _areaID = context.selectedIDs()[0];
61579           return continueTo(searchPresets);
61580         } else {
61581           return chapter.restart();
61582         }
61583       });
61584       function continueTo(nextStep) {
61585         context.map().on("move.intro drawn.intro", null);
61586         context.on("enter.intro", null);
61587         nextStep();
61588       }
61589     }
61590     function searchPresets() {
61591       if (!_areaID || !context.hasEntity(_areaID)) {
61592         return addArea();
61593       }
61594       var ids = context.selectedIDs();
61595       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61596         context.enter(modeSelect(context, [_areaID]));
61597       }
61598       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61599       timeout2(function() {
61600         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61601         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61602         reveal(
61603           ".preset-search-input",
61604           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61605         );
61606       }, 400);
61607       context.on("enter.intro", function(mode) {
61608         if (!_areaID || !context.hasEntity(_areaID)) {
61609           return continueTo(addArea);
61610         }
61611         var ids2 = context.selectedIDs();
61612         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
61613           context.enter(modeSelect(context, [_areaID]));
61614           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61615           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61616           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61617           reveal(
61618             ".preset-search-input",
61619             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61620           );
61621           context.history().on("change.intro", null);
61622         }
61623       });
61624       function checkPresetSearch() {
61625         var first = context.container().select(".preset-list-item:first-child");
61626         if (first.classed("preset-leisure-playground")) {
61627           reveal(
61628             first.select(".preset-list-button").node(),
61629             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
61630             { duration: 300 }
61631           );
61632           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
61633           context.history().on("change.intro", function() {
61634             continueTo(clickAddField);
61635           });
61636         }
61637       }
61638       function continueTo(nextStep) {
61639         context.container().select(".inspector-wrap").on("wheel.intro", null);
61640         context.on("enter.intro", null);
61641         context.history().on("change.intro", null);
61642         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61643         nextStep();
61644       }
61645     }
61646     function clickAddField() {
61647       if (!_areaID || !context.hasEntity(_areaID)) {
61648         return addArea();
61649       }
61650       var ids = context.selectedIDs();
61651       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61652         return searchPresets();
61653       }
61654       if (!context.container().select(".form-field-description").empty()) {
61655         return continueTo(describePlayground);
61656       }
61657       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61658       timeout2(function() {
61659         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61660         var entity = context.entity(_areaID);
61661         if (entity.tags.description) {
61662           return continueTo(play);
61663         }
61664         var box = context.container().select(".more-fields").node().getBoundingClientRect();
61665         if (box.top > 300) {
61666           var pane = context.container().select(".entity-editor-pane .inspector-body");
61667           var start2 = pane.node().scrollTop;
61668           var end = start2 + (box.top - 300);
61669           pane.transition().duration(250).tween("scroll.inspector", function() {
61670             var node = this;
61671             var i3 = number_default(start2, end);
61672             return function(t2) {
61673               node.scrollTop = i3(t2);
61674             };
61675           });
61676         }
61677         timeout2(function() {
61678           reveal(
61679             ".more-fields .combobox-input",
61680             helpHtml("intro.areas.add_field", {
61681               name: nameField.title(),
61682               description: descriptionField.title()
61683             }),
61684             { duration: 300 }
61685           );
61686           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
61687             var watcher;
61688             watcher = window.setInterval(function() {
61689               if (!context.container().select("div.combobox").empty()) {
61690                 window.clearInterval(watcher);
61691                 continueTo(chooseDescriptionField);
61692               }
61693             }, 300);
61694           });
61695         }, 300);
61696       }, 400);
61697       context.on("exit.intro", function() {
61698         return continueTo(searchPresets);
61699       });
61700       function continueTo(nextStep) {
61701         context.container().select(".inspector-wrap").on("wheel.intro", null);
61702         context.container().select(".more-fields .combobox-input").on("click.intro", null);
61703         context.on("exit.intro", null);
61704         nextStep();
61705       }
61706     }
61707     function chooseDescriptionField() {
61708       if (!_areaID || !context.hasEntity(_areaID)) {
61709         return addArea();
61710       }
61711       var ids = context.selectedIDs();
61712       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61713         return searchPresets();
61714       }
61715       if (!context.container().select(".form-field-description").empty()) {
61716         return continueTo(describePlayground);
61717       }
61718       if (context.container().select("div.combobox").empty()) {
61719         return continueTo(clickAddField);
61720       }
61721       var watcher;
61722       watcher = window.setInterval(function() {
61723         if (context.container().select("div.combobox").empty()) {
61724           window.clearInterval(watcher);
61725           timeout2(function() {
61726             if (context.container().select(".form-field-description").empty()) {
61727               continueTo(retryChooseDescription);
61728             } else {
61729               continueTo(describePlayground);
61730             }
61731           }, 300);
61732         }
61733       }, 300);
61734       reveal(
61735         "div.combobox",
61736         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
61737         { duration: 300 }
61738       );
61739       context.on("exit.intro", function() {
61740         return continueTo(searchPresets);
61741       });
61742       function continueTo(nextStep) {
61743         if (watcher) window.clearInterval(watcher);
61744         context.on("exit.intro", null);
61745         nextStep();
61746       }
61747     }
61748     function describePlayground() {
61749       if (!_areaID || !context.hasEntity(_areaID)) {
61750         return addArea();
61751       }
61752       var ids = context.selectedIDs();
61753       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61754         return searchPresets();
61755       }
61756       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61757       if (context.container().select(".form-field-description").empty()) {
61758         return continueTo(retryChooseDescription);
61759       }
61760       context.on("exit.intro", function() {
61761         continueTo(play);
61762       });
61763       reveal(
61764         ".entity-editor-pane",
61765         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
61766         { duration: 300 }
61767       );
61768       function continueTo(nextStep) {
61769         context.on("exit.intro", null);
61770         nextStep();
61771       }
61772     }
61773     function retryChooseDescription() {
61774       if (!_areaID || !context.hasEntity(_areaID)) {
61775         return addArea();
61776       }
61777       var ids = context.selectedIDs();
61778       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61779         return searchPresets();
61780       }
61781       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61782       reveal(
61783         ".entity-editor-pane",
61784         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
61785         {
61786           buttonText: _t.html("intro.ok"),
61787           buttonCallback: function() {
61788             continueTo(clickAddField);
61789           }
61790         }
61791       );
61792       context.on("exit.intro", function() {
61793         return continueTo(searchPresets);
61794       });
61795       function continueTo(nextStep) {
61796         context.on("exit.intro", null);
61797         nextStep();
61798       }
61799     }
61800     function play() {
61801       dispatch14.call("done");
61802       reveal(
61803         ".ideditor",
61804         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
61805         {
61806           tooltipBox: ".intro-nav-wrap .chapter-line",
61807           buttonText: _t.html("intro.ok"),
61808           buttonCallback: function() {
61809             reveal(".ideditor");
61810           }
61811         }
61812       );
61813     }
61814     chapter.enter = function() {
61815       addArea();
61816     };
61817     chapter.exit = function() {
61818       timeouts.forEach(window.clearTimeout);
61819       context.on("enter.intro exit.intro", null);
61820       context.map().on("move.intro drawn.intro", null);
61821       context.history().on("change.intro", null);
61822       context.container().select(".inspector-wrap").on("wheel.intro", null);
61823       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61824       context.container().select(".more-fields .combobox-input").on("click.intro", null);
61825     };
61826     chapter.restart = function() {
61827       chapter.exit();
61828       chapter.enter();
61829     };
61830     return utilRebind(chapter, dispatch14, "on");
61831   }
61832   var init_area4 = __esm({
61833     "modules/ui/intro/area.js"() {
61834       "use strict";
61835       init_src4();
61836       init_src8();
61837       init_presets();
61838       init_localizer();
61839       init_browse();
61840       init_select5();
61841       init_rebind();
61842       init_helper();
61843     }
61844   });
61845
61846   // modules/ui/intro/line.js
61847   var line_exports = {};
61848   __export(line_exports, {
61849     uiIntroLine: () => uiIntroLine
61850   });
61851   function uiIntroLine(context, reveal) {
61852     var dispatch14 = dispatch_default("done");
61853     var timeouts = [];
61854     var _tulipRoadID = null;
61855     var flowerRoadID = "w646";
61856     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
61857     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
61858     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
61859     var roadCategory = _mainPresetIndex.item("category-road_minor");
61860     var residentialPreset = _mainPresetIndex.item("highway/residential");
61861     var woodRoadID = "w525";
61862     var woodRoadEndID = "n2862";
61863     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
61864     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
61865     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
61866     var washingtonStreetID = "w522";
61867     var twelfthAvenueID = "w1";
61868     var eleventhAvenueEndID = "n3550";
61869     var twelfthAvenueEndID = "n5";
61870     var _washingtonSegmentID = null;
61871     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
61872     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
61873     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
61874     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
61875     var chapter = {
61876       title: "intro.lines.title"
61877     };
61878     function timeout2(f2, t2) {
61879       timeouts.push(window.setTimeout(f2, t2));
61880     }
61881     function eventCancel(d3_event) {
61882       d3_event.stopPropagation();
61883       d3_event.preventDefault();
61884     }
61885     function addLine() {
61886       context.enter(modeBrowse(context));
61887       context.history().reset("initial");
61888       var msec = transitionTime(tulipRoadStart, context.map().center());
61889       if (msec) {
61890         reveal(null, null, { duration: 0 });
61891       }
61892       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
61893       timeout2(function() {
61894         var tooltip = reveal(
61895           "button.add-line",
61896           helpHtml("intro.lines.add_line")
61897         );
61898         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
61899         context.on("enter.intro", function(mode) {
61900           if (mode.id !== "add-line") return;
61901           continueTo(startLine);
61902         });
61903       }, msec + 100);
61904       function continueTo(nextStep) {
61905         context.on("enter.intro", null);
61906         nextStep();
61907       }
61908     }
61909     function startLine() {
61910       if (context.mode().id !== "add-line") return chapter.restart();
61911       _tulipRoadID = null;
61912       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
61913       var box = pad2(tulipRoadStart, padding, context);
61914       box.height = box.height + 100;
61915       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
61916       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
61917       reveal(box, startLineString);
61918       context.map().on("move.intro drawn.intro", function() {
61919         padding = 70 * Math.pow(2, context.map().zoom() - 18);
61920         box = pad2(tulipRoadStart, padding, context);
61921         box.height = box.height + 100;
61922         reveal(box, startLineString, { duration: 0 });
61923       });
61924       context.on("enter.intro", function(mode) {
61925         if (mode.id !== "draw-line") return chapter.restart();
61926         continueTo(drawLine);
61927       });
61928       function continueTo(nextStep) {
61929         context.map().on("move.intro drawn.intro", null);
61930         context.on("enter.intro", null);
61931         nextStep();
61932       }
61933     }
61934     function drawLine() {
61935       if (context.mode().id !== "draw-line") return chapter.restart();
61936       _tulipRoadID = context.mode().selectedIDs()[0];
61937       context.map().centerEase(tulipRoadMidpoint, 500);
61938       timeout2(function() {
61939         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61940         var box = pad2(tulipRoadMidpoint, padding, context);
61941         box.height = box.height * 2;
61942         reveal(
61943           box,
61944           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
61945         );
61946         context.map().on("move.intro drawn.intro", function() {
61947           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61948           box = pad2(tulipRoadMidpoint, padding, context);
61949           box.height = box.height * 2;
61950           reveal(
61951             box,
61952             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
61953             { duration: 0 }
61954           );
61955         });
61956       }, 550);
61957       context.history().on("change.intro", function() {
61958         if (isLineConnected()) {
61959           continueTo(continueLine);
61960         }
61961       });
61962       context.on("enter.intro", function(mode) {
61963         if (mode.id === "draw-line") {
61964           return;
61965         } else if (mode.id === "select") {
61966           continueTo(retryIntersect);
61967           return;
61968         } else {
61969           return chapter.restart();
61970         }
61971       });
61972       function continueTo(nextStep) {
61973         context.map().on("move.intro drawn.intro", null);
61974         context.history().on("change.intro", null);
61975         context.on("enter.intro", null);
61976         nextStep();
61977       }
61978     }
61979     function isLineConnected() {
61980       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
61981       if (!entity) return false;
61982       var drawNodes = context.graph().childNodes(entity);
61983       return drawNodes.some(function(node) {
61984         return context.graph().parentWays(node).some(function(parent) {
61985           return parent.id === flowerRoadID;
61986         });
61987       });
61988     }
61989     function retryIntersect() {
61990       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
61991       var box = pad2(tulipRoadIntersection, 80, context);
61992       reveal(
61993         box,
61994         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
61995       );
61996       timeout2(chapter.restart, 3e3);
61997     }
61998     function continueLine() {
61999       if (context.mode().id !== "draw-line") return chapter.restart();
62000       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
62001       if (!entity) return chapter.restart();
62002       context.map().centerEase(tulipRoadIntersection, 500);
62003       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
62004       reveal(".main-map .surface", continueLineText);
62005       context.on("enter.intro", function(mode) {
62006         if (mode.id === "draw-line") {
62007           return;
62008         } else if (mode.id === "select") {
62009           return continueTo(chooseCategoryRoad);
62010         } else {
62011           return chapter.restart();
62012         }
62013       });
62014       function continueTo(nextStep) {
62015         context.on("enter.intro", null);
62016         nextStep();
62017       }
62018     }
62019     function chooseCategoryRoad() {
62020       if (context.mode().id !== "select") return chapter.restart();
62021       context.on("exit.intro", function() {
62022         return chapter.restart();
62023       });
62024       var button = context.container().select(".preset-category-road_minor .preset-list-button");
62025       if (button.empty()) return chapter.restart();
62026       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62027       timeout2(function() {
62028         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62029         reveal(
62030           button.node(),
62031           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
62032         );
62033         button.on("click.intro", function() {
62034           continueTo(choosePresetResidential);
62035         });
62036       }, 400);
62037       function continueTo(nextStep) {
62038         context.container().select(".inspector-wrap").on("wheel.intro", null);
62039         context.container().select(".preset-list-button").on("click.intro", null);
62040         context.on("exit.intro", null);
62041         nextStep();
62042       }
62043     }
62044     function choosePresetResidential() {
62045       if (context.mode().id !== "select") return chapter.restart();
62046       context.on("exit.intro", function() {
62047         return chapter.restart();
62048       });
62049       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
62050       if (subgrid.empty()) return chapter.restart();
62051       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
62052         continueTo(retryPresetResidential);
62053       });
62054       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
62055         continueTo(nameRoad);
62056       });
62057       timeout2(function() {
62058         reveal(
62059           subgrid.node(),
62060           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
62061           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
62062         );
62063       }, 300);
62064       function continueTo(nextStep) {
62065         context.container().select(".preset-list-button").on("click.intro", null);
62066         context.on("exit.intro", null);
62067         nextStep();
62068       }
62069     }
62070     function retryPresetResidential() {
62071       if (context.mode().id !== "select") return chapter.restart();
62072       context.on("exit.intro", function() {
62073         return chapter.restart();
62074       });
62075       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62076       timeout2(function() {
62077         var button = context.container().select(".entity-editor-pane .preset-list-button");
62078         reveal(
62079           button.node(),
62080           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
62081         );
62082         button.on("click.intro", function() {
62083           continueTo(chooseCategoryRoad);
62084         });
62085       }, 500);
62086       function continueTo(nextStep) {
62087         context.container().select(".inspector-wrap").on("wheel.intro", null);
62088         context.container().select(".preset-list-button").on("click.intro", null);
62089         context.on("exit.intro", null);
62090         nextStep();
62091       }
62092     }
62093     function nameRoad() {
62094       context.on("exit.intro", function() {
62095         continueTo(didNameRoad);
62096       });
62097       timeout2(function() {
62098         reveal(
62099           ".entity-editor-pane",
62100           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
62101           { tooltipClass: "intro-lines-name_road" }
62102         );
62103       }, 500);
62104       function continueTo(nextStep) {
62105         context.on("exit.intro", null);
62106         nextStep();
62107       }
62108     }
62109     function didNameRoad() {
62110       context.history().checkpoint("doneAddLine");
62111       timeout2(function() {
62112         reveal(".main-map .surface", helpHtml("intro.lines.did_name_road"), {
62113           buttonText: _t.html("intro.ok"),
62114           buttonCallback: function() {
62115             continueTo(updateLine);
62116           }
62117         });
62118       }, 500);
62119       function continueTo(nextStep) {
62120         nextStep();
62121       }
62122     }
62123     function updateLine() {
62124       context.history().reset("doneAddLine");
62125       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62126         return chapter.restart();
62127       }
62128       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
62129       if (msec) {
62130         reveal(null, null, { duration: 0 });
62131       }
62132       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
62133       timeout2(function() {
62134         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
62135         var box = pad2(woodRoadDragMidpoint, padding, context);
62136         var advance = function() {
62137           continueTo(addNode);
62138         };
62139         reveal(
62140           box,
62141           helpHtml("intro.lines.update_line"),
62142           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62143         );
62144         context.map().on("move.intro drawn.intro", function() {
62145           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
62146           var box2 = pad2(woodRoadDragMidpoint, padding2, context);
62147           reveal(
62148             box2,
62149             helpHtml("intro.lines.update_line"),
62150             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62151           );
62152         });
62153       }, msec + 100);
62154       function continueTo(nextStep) {
62155         context.map().on("move.intro drawn.intro", null);
62156         nextStep();
62157       }
62158     }
62159     function addNode() {
62160       context.history().reset("doneAddLine");
62161       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62162         return chapter.restart();
62163       }
62164       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
62165       var box = pad2(woodRoadAddNode, padding, context);
62166       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
62167       reveal(box, addNodeString);
62168       context.map().on("move.intro drawn.intro", function() {
62169         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
62170         var box2 = pad2(woodRoadAddNode, padding2, context);
62171         reveal(box2, addNodeString, { duration: 0 });
62172       });
62173       context.history().on("change.intro", function(changed) {
62174         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62175           return continueTo(updateLine);
62176         }
62177         if (changed.created().length === 1) {
62178           timeout2(function() {
62179             continueTo(startDragEndpoint);
62180           }, 500);
62181         }
62182       });
62183       context.on("enter.intro", function(mode) {
62184         if (mode.id !== "select") {
62185           continueTo(updateLine);
62186         }
62187       });
62188       function continueTo(nextStep) {
62189         context.map().on("move.intro drawn.intro", null);
62190         context.history().on("change.intro", null);
62191         context.on("enter.intro", null);
62192         nextStep();
62193       }
62194     }
62195     function startDragEndpoint() {
62196       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62197         return continueTo(updateLine);
62198       }
62199       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62200       var box = pad2(woodRoadDragEndpoint, padding, context);
62201       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
62202       reveal(box, startDragString);
62203       context.map().on("move.intro drawn.intro", function() {
62204         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62205           return continueTo(updateLine);
62206         }
62207         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62208         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62209         reveal(box2, startDragString, { duration: 0 });
62210         var entity = context.entity(woodRoadEndID);
62211         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
62212           continueTo(finishDragEndpoint);
62213         }
62214       });
62215       function continueTo(nextStep) {
62216         context.map().on("move.intro drawn.intro", null);
62217         nextStep();
62218       }
62219     }
62220     function finishDragEndpoint() {
62221       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62222         return continueTo(updateLine);
62223       }
62224       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62225       var box = pad2(woodRoadDragEndpoint, padding, context);
62226       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
62227       reveal(box, finishDragString);
62228       context.map().on("move.intro drawn.intro", function() {
62229         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62230           return continueTo(updateLine);
62231         }
62232         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62233         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62234         reveal(box2, finishDragString, { duration: 0 });
62235         var entity = context.entity(woodRoadEndID);
62236         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
62237           continueTo(startDragEndpoint);
62238         }
62239       });
62240       context.on("enter.intro", function() {
62241         continueTo(startDragMidpoint);
62242       });
62243       function continueTo(nextStep) {
62244         context.map().on("move.intro drawn.intro", null);
62245         context.on("enter.intro", null);
62246         nextStep();
62247       }
62248     }
62249     function startDragMidpoint() {
62250       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62251         return continueTo(updateLine);
62252       }
62253       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
62254         context.enter(modeSelect(context, [woodRoadID]));
62255       }
62256       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
62257       var box = pad2(woodRoadDragMidpoint, padding, context);
62258       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
62259       context.map().on("move.intro drawn.intro", function() {
62260         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62261           return continueTo(updateLine);
62262         }
62263         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
62264         var box2 = pad2(woodRoadDragMidpoint, padding2, context);
62265         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
62266       });
62267       context.history().on("change.intro", function(changed) {
62268         if (changed.created().length === 1) {
62269           continueTo(continueDragMidpoint);
62270         }
62271       });
62272       context.on("enter.intro", function(mode) {
62273         if (mode.id !== "select") {
62274           context.enter(modeSelect(context, [woodRoadID]));
62275         }
62276       });
62277       function continueTo(nextStep) {
62278         context.map().on("move.intro drawn.intro", null);
62279         context.history().on("change.intro", null);
62280         context.on("enter.intro", null);
62281         nextStep();
62282       }
62283     }
62284     function continueDragMidpoint() {
62285       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62286         return continueTo(updateLine);
62287       }
62288       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
62289       var box = pad2(woodRoadDragEndpoint, padding, context);
62290       box.height += 400;
62291       var advance = function() {
62292         context.history().checkpoint("doneUpdateLine");
62293         continueTo(deleteLines);
62294       };
62295       reveal(
62296         box,
62297         helpHtml("intro.lines.continue_drag_midpoint"),
62298         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62299       );
62300       context.map().on("move.intro drawn.intro", function() {
62301         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
62302           return continueTo(updateLine);
62303         }
62304         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
62305         var box2 = pad2(woodRoadDragEndpoint, padding2, context);
62306         box2.height += 400;
62307         reveal(
62308           box2,
62309           helpHtml("intro.lines.continue_drag_midpoint"),
62310           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62311         );
62312       });
62313       function continueTo(nextStep) {
62314         context.map().on("move.intro drawn.intro", null);
62315         nextStep();
62316       }
62317     }
62318     function deleteLines() {
62319       context.history().reset("doneUpdateLine");
62320       context.enter(modeBrowse(context));
62321       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62322         return chapter.restart();
62323       }
62324       var msec = transitionTime(deleteLinesLoc, context.map().center());
62325       if (msec) {
62326         reveal(null, null, { duration: 0 });
62327       }
62328       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
62329       timeout2(function() {
62330         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62331         var box = pad2(deleteLinesLoc, padding, context);
62332         box.top -= 200;
62333         box.height += 400;
62334         var advance = function() {
62335           continueTo(rightClickIntersection);
62336         };
62337         reveal(
62338           box,
62339           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
62340           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62341         );
62342         context.map().on("move.intro drawn.intro", function() {
62343           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62344           var box2 = pad2(deleteLinesLoc, padding2, context);
62345           box2.top -= 200;
62346           box2.height += 400;
62347           reveal(
62348             box2,
62349             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
62350             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62351           );
62352         });
62353         context.history().on("change.intro", function() {
62354           timeout2(function() {
62355             continueTo(deleteLines);
62356           }, 500);
62357         });
62358       }, msec + 100);
62359       function continueTo(nextStep) {
62360         context.map().on("move.intro drawn.intro", null);
62361         context.history().on("change.intro", null);
62362         nextStep();
62363       }
62364     }
62365     function rightClickIntersection() {
62366       context.history().reset("doneUpdateLine");
62367       context.enter(modeBrowse(context));
62368       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
62369       var rightClickString = helpHtml("intro.lines.split_street", {
62370         street1: _t("intro.graph.name.11th-avenue"),
62371         street2: _t("intro.graph.name.washington-street")
62372       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
62373       timeout2(function() {
62374         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
62375         var box = pad2(eleventhAvenueEnd, padding, context);
62376         reveal(box, rightClickString);
62377         context.map().on("move.intro drawn.intro", function() {
62378           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
62379           var box2 = pad2(eleventhAvenueEnd, padding2, context);
62380           reveal(
62381             box2,
62382             rightClickString,
62383             { duration: 0 }
62384           );
62385         });
62386         context.on("enter.intro", function(mode) {
62387           if (mode.id !== "select") return;
62388           var ids = context.selectedIDs();
62389           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
62390           timeout2(function() {
62391             var node = selectMenuItem(context, "split").node();
62392             if (!node) return;
62393             continueTo(splitIntersection);
62394           }, 50);
62395         });
62396         context.history().on("change.intro", function() {
62397           timeout2(function() {
62398             continueTo(deleteLines);
62399           }, 300);
62400         });
62401       }, 600);
62402       function continueTo(nextStep) {
62403         context.map().on("move.intro drawn.intro", null);
62404         context.on("enter.intro", null);
62405         context.history().on("change.intro", null);
62406         nextStep();
62407       }
62408     }
62409     function splitIntersection() {
62410       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62411         return continueTo(deleteLines);
62412       }
62413       var node = selectMenuItem(context, "split").node();
62414       if (!node) {
62415         return continueTo(rightClickIntersection);
62416       }
62417       var wasChanged = false;
62418       _washingtonSegmentID = null;
62419       reveal(
62420         ".edit-menu",
62421         helpHtml(
62422           "intro.lines.split_intersection",
62423           { street: _t("intro.graph.name.washington-street") }
62424         ),
62425         { padding: 50 }
62426       );
62427       context.map().on("move.intro drawn.intro", function() {
62428         var node2 = selectMenuItem(context, "split").node();
62429         if (!wasChanged && !node2) {
62430           return continueTo(rightClickIntersection);
62431         }
62432         reveal(
62433           ".edit-menu",
62434           helpHtml(
62435             "intro.lines.split_intersection",
62436             { street: _t("intro.graph.name.washington-street") }
62437           ),
62438           { duration: 0, padding: 50 }
62439         );
62440       });
62441       context.history().on("change.intro", function(changed) {
62442         wasChanged = true;
62443         timeout2(function() {
62444           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
62445             _washingtonSegmentID = changed.created()[0].id;
62446             continueTo(didSplit);
62447           } else {
62448             _washingtonSegmentID = null;
62449             continueTo(retrySplit);
62450           }
62451         }, 300);
62452       });
62453       function continueTo(nextStep) {
62454         context.map().on("move.intro drawn.intro", null);
62455         context.history().on("change.intro", null);
62456         nextStep();
62457       }
62458     }
62459     function retrySplit() {
62460       context.enter(modeBrowse(context));
62461       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
62462       var advance = function() {
62463         continueTo(rightClickIntersection);
62464       };
62465       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
62466       var box = pad2(eleventhAvenueEnd, padding, context);
62467       reveal(
62468         box,
62469         helpHtml("intro.lines.retry_split"),
62470         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
62471       );
62472       context.map().on("move.intro drawn.intro", function() {
62473         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
62474         var box2 = pad2(eleventhAvenueEnd, padding2, context);
62475         reveal(
62476           box2,
62477           helpHtml("intro.lines.retry_split"),
62478           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
62479         );
62480       });
62481       function continueTo(nextStep) {
62482         context.map().on("move.intro drawn.intro", null);
62483         nextStep();
62484       }
62485     }
62486     function didSplit() {
62487       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62488         return continueTo(rightClickIntersection);
62489       }
62490       var ids = context.selectedIDs();
62491       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
62492       var street = _t("intro.graph.name.washington-street");
62493       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62494       var box = pad2(twelfthAvenue, padding, context);
62495       box.width = box.width / 2;
62496       reveal(
62497         box,
62498         helpHtml(string, { street1: street, street2: street }),
62499         { duration: 500 }
62500       );
62501       timeout2(function() {
62502         context.map().centerZoomEase(twelfthAvenue, 18, 500);
62503         context.map().on("move.intro drawn.intro", function() {
62504           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62505           var box2 = pad2(twelfthAvenue, padding2, context);
62506           box2.width = box2.width / 2;
62507           reveal(
62508             box2,
62509             helpHtml(string, { street1: street, street2: street }),
62510             { duration: 0 }
62511           );
62512         });
62513       }, 600);
62514       context.on("enter.intro", function() {
62515         var ids2 = context.selectedIDs();
62516         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
62517           continueTo(multiSelect2);
62518         }
62519       });
62520       context.history().on("change.intro", function() {
62521         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62522           return continueTo(rightClickIntersection);
62523         }
62524       });
62525       function continueTo(nextStep) {
62526         context.map().on("move.intro drawn.intro", null);
62527         context.on("enter.intro", null);
62528         context.history().on("change.intro", null);
62529         nextStep();
62530       }
62531     }
62532     function multiSelect2() {
62533       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62534         return continueTo(rightClickIntersection);
62535       }
62536       var ids = context.selectedIDs();
62537       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
62538       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
62539       if (hasWashington && hasTwelfth) {
62540         return continueTo(multiRightClick);
62541       } else if (!hasWashington && !hasTwelfth) {
62542         return continueTo(didSplit);
62543       }
62544       context.map().centerZoomEase(twelfthAvenue, 18, 500);
62545       timeout2(function() {
62546         var selected, other2, padding, box;
62547         if (hasWashington) {
62548           selected = _t("intro.graph.name.washington-street");
62549           other2 = _t("intro.graph.name.12th-avenue");
62550           padding = 60 * Math.pow(2, context.map().zoom() - 18);
62551           box = pad2(twelfthAvenueEnd, padding, context);
62552           box.width *= 3;
62553         } else {
62554           selected = _t("intro.graph.name.12th-avenue");
62555           other2 = _t("intro.graph.name.washington-street");
62556           padding = 200 * Math.pow(2, context.map().zoom() - 18);
62557           box = pad2(twelfthAvenue, padding, context);
62558           box.width /= 2;
62559         }
62560         reveal(
62561           box,
62562           helpHtml(
62563             "intro.lines.multi_select",
62564             { selected, other1: other2 }
62565           ) + " " + helpHtml(
62566             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62567             { selected, other2 }
62568           )
62569         );
62570         context.map().on("move.intro drawn.intro", function() {
62571           if (hasWashington) {
62572             selected = _t("intro.graph.name.washington-street");
62573             other2 = _t("intro.graph.name.12th-avenue");
62574             padding = 60 * Math.pow(2, context.map().zoom() - 18);
62575             box = pad2(twelfthAvenueEnd, padding, context);
62576             box.width *= 3;
62577           } else {
62578             selected = _t("intro.graph.name.12th-avenue");
62579             other2 = _t("intro.graph.name.washington-street");
62580             padding = 200 * Math.pow(2, context.map().zoom() - 18);
62581             box = pad2(twelfthAvenue, padding, context);
62582             box.width /= 2;
62583           }
62584           reveal(
62585             box,
62586             helpHtml(
62587               "intro.lines.multi_select",
62588               { selected, other1: other2 }
62589             ) + " " + helpHtml(
62590               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62591               { selected, other2 }
62592             ),
62593             { duration: 0 }
62594           );
62595         });
62596         context.on("enter.intro", function() {
62597           continueTo(multiSelect2);
62598         });
62599         context.history().on("change.intro", function() {
62600           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62601             return continueTo(rightClickIntersection);
62602           }
62603         });
62604       }, 600);
62605       function continueTo(nextStep) {
62606         context.map().on("move.intro drawn.intro", null);
62607         context.on("enter.intro", null);
62608         context.history().on("change.intro", null);
62609         nextStep();
62610       }
62611     }
62612     function multiRightClick() {
62613       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62614         return continueTo(rightClickIntersection);
62615       }
62616       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62617       var box = pad2(twelfthAvenue, padding, context);
62618       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
62619       reveal(box, rightClickString);
62620       context.map().on("move.intro drawn.intro", function() {
62621         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62622         var box2 = pad2(twelfthAvenue, padding2, context);
62623         reveal(box2, rightClickString, { duration: 0 });
62624       });
62625       context.ui().editMenu().on("toggled.intro", function(open) {
62626         if (!open) return;
62627         timeout2(function() {
62628           var ids = context.selectedIDs();
62629           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62630             var node = selectMenuItem(context, "delete").node();
62631             if (!node) return;
62632             continueTo(multiDelete);
62633           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62634             return continueTo(multiSelect2);
62635           } else {
62636             return continueTo(didSplit);
62637           }
62638         }, 300);
62639       });
62640       context.history().on("change.intro", function() {
62641         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62642           return continueTo(rightClickIntersection);
62643         }
62644       });
62645       function continueTo(nextStep) {
62646         context.map().on("move.intro drawn.intro", null);
62647         context.ui().editMenu().on("toggled.intro", null);
62648         context.history().on("change.intro", null);
62649         nextStep();
62650       }
62651     }
62652     function multiDelete() {
62653       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62654         return continueTo(rightClickIntersection);
62655       }
62656       var node = selectMenuItem(context, "delete").node();
62657       if (!node) return continueTo(multiRightClick);
62658       reveal(
62659         ".edit-menu",
62660         helpHtml("intro.lines.multi_delete"),
62661         { padding: 50 }
62662       );
62663       context.map().on("move.intro drawn.intro", function() {
62664         reveal(
62665           ".edit-menu",
62666           helpHtml("intro.lines.multi_delete"),
62667           { duration: 0, padding: 50 }
62668         );
62669       });
62670       context.on("exit.intro", function() {
62671         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62672           return continueTo(multiSelect2);
62673         }
62674       });
62675       context.history().on("change.intro", function() {
62676         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62677           continueTo(retryDelete);
62678         } else {
62679           continueTo(play);
62680         }
62681       });
62682       function continueTo(nextStep) {
62683         context.map().on("move.intro drawn.intro", null);
62684         context.on("exit.intro", null);
62685         context.history().on("change.intro", null);
62686         nextStep();
62687       }
62688     }
62689     function retryDelete() {
62690       context.enter(modeBrowse(context));
62691       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62692       var box = pad2(twelfthAvenue, padding, context);
62693       reveal(box, helpHtml("intro.lines.retry_delete"), {
62694         buttonText: _t.html("intro.ok"),
62695         buttonCallback: function() {
62696           continueTo(multiSelect2);
62697         }
62698       });
62699       function continueTo(nextStep) {
62700         nextStep();
62701       }
62702     }
62703     function play() {
62704       dispatch14.call("done");
62705       reveal(
62706         ".ideditor",
62707         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
62708         {
62709           tooltipBox: ".intro-nav-wrap .chapter-building",
62710           buttonText: _t.html("intro.ok"),
62711           buttonCallback: function() {
62712             reveal(".ideditor");
62713           }
62714         }
62715       );
62716     }
62717     chapter.enter = function() {
62718       addLine();
62719     };
62720     chapter.exit = function() {
62721       timeouts.forEach(window.clearTimeout);
62722       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
62723       context.on("enter.intro exit.intro", null);
62724       context.map().on("move.intro drawn.intro", null);
62725       context.history().on("change.intro", null);
62726       context.container().select(".inspector-wrap").on("wheel.intro", null);
62727       context.container().select(".preset-list-button").on("click.intro", null);
62728     };
62729     chapter.restart = function() {
62730       chapter.exit();
62731       chapter.enter();
62732     };
62733     return utilRebind(chapter, dispatch14, "on");
62734   }
62735   var init_line2 = __esm({
62736     "modules/ui/intro/line.js"() {
62737       "use strict";
62738       init_src4();
62739       init_src5();
62740       init_presets();
62741       init_localizer();
62742       init_geo2();
62743       init_browse();
62744       init_select5();
62745       init_rebind();
62746       init_helper();
62747     }
62748   });
62749
62750   // modules/ui/intro/building.js
62751   var building_exports = {};
62752   __export(building_exports, {
62753     uiIntroBuilding: () => uiIntroBuilding
62754   });
62755   function uiIntroBuilding(context, reveal) {
62756     var dispatch14 = dispatch_default("done");
62757     var house = [-85.62815, 41.95638];
62758     var tank = [-85.62732, 41.95347];
62759     var buildingCatetory = _mainPresetIndex.item("category-building");
62760     var housePreset = _mainPresetIndex.item("building/house");
62761     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
62762     var timeouts = [];
62763     var _houseID = null;
62764     var _tankID = null;
62765     var chapter = {
62766       title: "intro.buildings.title"
62767     };
62768     function timeout2(f2, t2) {
62769       timeouts.push(window.setTimeout(f2, t2));
62770     }
62771     function eventCancel(d3_event) {
62772       d3_event.stopPropagation();
62773       d3_event.preventDefault();
62774     }
62775     function revealHouse(center, text, options2) {
62776       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
62777       var box = pad2(center, padding, context);
62778       reveal(box, text, options2);
62779     }
62780     function revealTank(center, text, options2) {
62781       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
62782       var box = pad2(center, padding, context);
62783       reveal(box, text, options2);
62784     }
62785     function addHouse() {
62786       context.enter(modeBrowse(context));
62787       context.history().reset("initial");
62788       _houseID = null;
62789       var msec = transitionTime(house, context.map().center());
62790       if (msec) {
62791         reveal(null, null, { duration: 0 });
62792       }
62793       context.map().centerZoomEase(house, 19, msec);
62794       timeout2(function() {
62795         var tooltip = reveal(
62796           "button.add-area",
62797           helpHtml("intro.buildings.add_building")
62798         );
62799         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
62800         context.on("enter.intro", function(mode) {
62801           if (mode.id !== "add-area") return;
62802           continueTo(startHouse);
62803         });
62804       }, msec + 100);
62805       function continueTo(nextStep) {
62806         context.on("enter.intro", null);
62807         nextStep();
62808       }
62809     }
62810     function startHouse() {
62811       if (context.mode().id !== "add-area") {
62812         return continueTo(addHouse);
62813       }
62814       _houseID = null;
62815       context.map().zoomEase(20, 500);
62816       timeout2(function() {
62817         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
62818         revealHouse(house, startString);
62819         context.map().on("move.intro drawn.intro", function() {
62820           revealHouse(house, startString, { duration: 0 });
62821         });
62822         context.on("enter.intro", function(mode) {
62823           if (mode.id !== "draw-area") return chapter.restart();
62824           continueTo(continueHouse);
62825         });
62826       }, 550);
62827       function continueTo(nextStep) {
62828         context.map().on("move.intro drawn.intro", null);
62829         context.on("enter.intro", null);
62830         nextStep();
62831       }
62832     }
62833     function continueHouse() {
62834       if (context.mode().id !== "draw-area") {
62835         return continueTo(addHouse);
62836       }
62837       _houseID = null;
62838       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
62839       revealHouse(house, continueString);
62840       context.map().on("move.intro drawn.intro", function() {
62841         revealHouse(house, continueString, { duration: 0 });
62842       });
62843       context.on("enter.intro", function(mode) {
62844         if (mode.id === "draw-area") {
62845           return;
62846         } else if (mode.id === "select") {
62847           var graph = context.graph();
62848           var way = context.entity(context.selectedIDs()[0]);
62849           var nodes = graph.childNodes(way);
62850           var points = utilArrayUniq(nodes).map(function(n3) {
62851             return context.projection(n3.loc);
62852           });
62853           if (isMostlySquare(points)) {
62854             _houseID = way.id;
62855             return continueTo(chooseCategoryBuilding);
62856           } else {
62857             return continueTo(retryHouse);
62858           }
62859         } else {
62860           return chapter.restart();
62861         }
62862       });
62863       function continueTo(nextStep) {
62864         context.map().on("move.intro drawn.intro", null);
62865         context.on("enter.intro", null);
62866         nextStep();
62867       }
62868     }
62869     function retryHouse() {
62870       var onClick = function() {
62871         continueTo(addHouse);
62872       };
62873       revealHouse(
62874         house,
62875         helpHtml("intro.buildings.retry_building"),
62876         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62877       );
62878       context.map().on("move.intro drawn.intro", function() {
62879         revealHouse(
62880           house,
62881           helpHtml("intro.buildings.retry_building"),
62882           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62883         );
62884       });
62885       function continueTo(nextStep) {
62886         context.map().on("move.intro drawn.intro", null);
62887         nextStep();
62888       }
62889     }
62890     function chooseCategoryBuilding() {
62891       if (!_houseID || !context.hasEntity(_houseID)) {
62892         return addHouse();
62893       }
62894       var ids = context.selectedIDs();
62895       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62896         context.enter(modeSelect(context, [_houseID]));
62897       }
62898       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62899       timeout2(function() {
62900         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62901         var button = context.container().select(".preset-category-building .preset-list-button");
62902         reveal(
62903           button.node(),
62904           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
62905         );
62906         button.on("click.intro", function() {
62907           button.on("click.intro", null);
62908           continueTo(choosePresetHouse);
62909         });
62910       }, 400);
62911       context.on("enter.intro", function(mode) {
62912         if (!_houseID || !context.hasEntity(_houseID)) {
62913           return continueTo(addHouse);
62914         }
62915         var ids2 = context.selectedIDs();
62916         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62917           return continueTo(chooseCategoryBuilding);
62918         }
62919       });
62920       function continueTo(nextStep) {
62921         context.container().select(".inspector-wrap").on("wheel.intro", null);
62922         context.container().select(".preset-list-button").on("click.intro", null);
62923         context.on("enter.intro", null);
62924         nextStep();
62925       }
62926     }
62927     function choosePresetHouse() {
62928       if (!_houseID || !context.hasEntity(_houseID)) {
62929         return addHouse();
62930       }
62931       var ids = context.selectedIDs();
62932       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62933         context.enter(modeSelect(context, [_houseID]));
62934       }
62935       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62936       timeout2(function() {
62937         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62938         var button = context.container().select(".preset-building-house .preset-list-button");
62939         reveal(
62940           button.node(),
62941           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
62942           { duration: 300 }
62943         );
62944         button.on("click.intro", function() {
62945           button.on("click.intro", null);
62946           continueTo(closeEditorHouse);
62947         });
62948       }, 400);
62949       context.on("enter.intro", function(mode) {
62950         if (!_houseID || !context.hasEntity(_houseID)) {
62951           return continueTo(addHouse);
62952         }
62953         var ids2 = context.selectedIDs();
62954         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62955           return continueTo(chooseCategoryBuilding);
62956         }
62957       });
62958       function continueTo(nextStep) {
62959         context.container().select(".inspector-wrap").on("wheel.intro", null);
62960         context.container().select(".preset-list-button").on("click.intro", null);
62961         context.on("enter.intro", null);
62962         nextStep();
62963       }
62964     }
62965     function closeEditorHouse() {
62966       if (!_houseID || !context.hasEntity(_houseID)) {
62967         return addHouse();
62968       }
62969       var ids = context.selectedIDs();
62970       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62971         context.enter(modeSelect(context, [_houseID]));
62972       }
62973       context.history().checkpoint("hasHouse");
62974       context.on("exit.intro", function() {
62975         continueTo(rightClickHouse);
62976       });
62977       timeout2(function() {
62978         reveal(
62979           ".entity-editor-pane",
62980           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
62981         );
62982       }, 500);
62983       function continueTo(nextStep) {
62984         context.on("exit.intro", null);
62985         nextStep();
62986       }
62987     }
62988     function rightClickHouse() {
62989       if (!_houseID) return chapter.restart();
62990       context.enter(modeBrowse(context));
62991       context.history().reset("hasHouse");
62992       var zoom = context.map().zoom();
62993       if (zoom < 20) {
62994         zoom = 20;
62995       }
62996       context.map().centerZoomEase(house, zoom, 500);
62997       context.on("enter.intro", function(mode) {
62998         if (mode.id !== "select") return;
62999         var ids = context.selectedIDs();
63000         if (ids.length !== 1 || ids[0] !== _houseID) return;
63001         timeout2(function() {
63002           var node = selectMenuItem(context, "orthogonalize").node();
63003           if (!node) return;
63004           continueTo(clickSquare);
63005         }, 50);
63006       });
63007       context.map().on("move.intro drawn.intro", function() {
63008         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
63009         revealHouse(house, rightclickString, { duration: 0 });
63010       });
63011       context.history().on("change.intro", function() {
63012         continueTo(rightClickHouse);
63013       });
63014       function continueTo(nextStep) {
63015         context.on("enter.intro", null);
63016         context.map().on("move.intro drawn.intro", null);
63017         context.history().on("change.intro", null);
63018         nextStep();
63019       }
63020     }
63021     function clickSquare() {
63022       if (!_houseID) return chapter.restart();
63023       var entity = context.hasEntity(_houseID);
63024       if (!entity) return continueTo(rightClickHouse);
63025       var node = selectMenuItem(context, "orthogonalize").node();
63026       if (!node) {
63027         return continueTo(rightClickHouse);
63028       }
63029       var wasChanged = false;
63030       reveal(
63031         ".edit-menu",
63032         helpHtml("intro.buildings.square_building"),
63033         { padding: 50 }
63034       );
63035       context.on("enter.intro", function(mode) {
63036         if (mode.id === "browse") {
63037           continueTo(rightClickHouse);
63038         } else if (mode.id === "move" || mode.id === "rotate") {
63039           continueTo(retryClickSquare);
63040         }
63041       });
63042       context.map().on("move.intro", function() {
63043         var node2 = selectMenuItem(context, "orthogonalize").node();
63044         if (!wasChanged && !node2) {
63045           return continueTo(rightClickHouse);
63046         }
63047         reveal(
63048           ".edit-menu",
63049           helpHtml("intro.buildings.square_building"),
63050           { duration: 0, padding: 50 }
63051         );
63052       });
63053       context.history().on("change.intro", function() {
63054         wasChanged = true;
63055         context.history().on("change.intro", null);
63056         timeout2(function() {
63057           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
63058             continueTo(doneSquare);
63059           } else {
63060             continueTo(retryClickSquare);
63061           }
63062         }, 500);
63063       });
63064       function continueTo(nextStep) {
63065         context.on("enter.intro", null);
63066         context.map().on("move.intro", null);
63067         context.history().on("change.intro", null);
63068         nextStep();
63069       }
63070     }
63071     function retryClickSquare() {
63072       context.enter(modeBrowse(context));
63073       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
63074         buttonText: _t.html("intro.ok"),
63075         buttonCallback: function() {
63076           continueTo(rightClickHouse);
63077         }
63078       });
63079       function continueTo(nextStep) {
63080         nextStep();
63081       }
63082     }
63083     function doneSquare() {
63084       context.history().checkpoint("doneSquare");
63085       revealHouse(house, helpHtml("intro.buildings.done_square"), {
63086         buttonText: _t.html("intro.ok"),
63087         buttonCallback: function() {
63088           continueTo(addTank);
63089         }
63090       });
63091       function continueTo(nextStep) {
63092         nextStep();
63093       }
63094     }
63095     function addTank() {
63096       context.enter(modeBrowse(context));
63097       context.history().reset("doneSquare");
63098       _tankID = null;
63099       var msec = transitionTime(tank, context.map().center());
63100       if (msec) {
63101         reveal(null, null, { duration: 0 });
63102       }
63103       context.map().centerZoomEase(tank, 19.5, msec);
63104       timeout2(function() {
63105         reveal(
63106           "button.add-area",
63107           helpHtml("intro.buildings.add_tank")
63108         );
63109         context.on("enter.intro", function(mode) {
63110           if (mode.id !== "add-area") return;
63111           continueTo(startTank);
63112         });
63113       }, msec + 100);
63114       function continueTo(nextStep) {
63115         context.on("enter.intro", null);
63116         nextStep();
63117       }
63118     }
63119     function startTank() {
63120       if (context.mode().id !== "add-area") {
63121         return continueTo(addTank);
63122       }
63123       _tankID = null;
63124       timeout2(function() {
63125         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
63126         revealTank(tank, startString);
63127         context.map().on("move.intro drawn.intro", function() {
63128           revealTank(tank, startString, { duration: 0 });
63129         });
63130         context.on("enter.intro", function(mode) {
63131           if (mode.id !== "draw-area") return chapter.restart();
63132           continueTo(continueTank);
63133         });
63134       }, 550);
63135       function continueTo(nextStep) {
63136         context.map().on("move.intro drawn.intro", null);
63137         context.on("enter.intro", null);
63138         nextStep();
63139       }
63140     }
63141     function continueTank() {
63142       if (context.mode().id !== "draw-area") {
63143         return continueTo(addTank);
63144       }
63145       _tankID = null;
63146       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
63147       revealTank(tank, continueString);
63148       context.map().on("move.intro drawn.intro", function() {
63149         revealTank(tank, continueString, { duration: 0 });
63150       });
63151       context.on("enter.intro", function(mode) {
63152         if (mode.id === "draw-area") {
63153           return;
63154         } else if (mode.id === "select") {
63155           _tankID = context.selectedIDs()[0];
63156           return continueTo(searchPresetTank);
63157         } else {
63158           return continueTo(addTank);
63159         }
63160       });
63161       function continueTo(nextStep) {
63162         context.map().on("move.intro drawn.intro", null);
63163         context.on("enter.intro", null);
63164         nextStep();
63165       }
63166     }
63167     function searchPresetTank() {
63168       if (!_tankID || !context.hasEntity(_tankID)) {
63169         return addTank();
63170       }
63171       var ids = context.selectedIDs();
63172       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
63173         context.enter(modeSelect(context, [_tankID]));
63174       }
63175       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
63176       timeout2(function() {
63177         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
63178         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
63179         reveal(
63180           ".preset-search-input",
63181           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
63182         );
63183       }, 400);
63184       context.on("enter.intro", function(mode) {
63185         if (!_tankID || !context.hasEntity(_tankID)) {
63186           return continueTo(addTank);
63187         }
63188         var ids2 = context.selectedIDs();
63189         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
63190           context.enter(modeSelect(context, [_tankID]));
63191           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
63192           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
63193           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
63194           reveal(
63195             ".preset-search-input",
63196             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
63197           );
63198           context.history().on("change.intro", null);
63199         }
63200       });
63201       function checkPresetSearch() {
63202         var first = context.container().select(".preset-list-item:first-child");
63203         if (first.classed("preset-man_made-storage_tank")) {
63204           reveal(
63205             first.select(".preset-list-button").node(),
63206             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
63207             { duration: 300 }
63208           );
63209           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
63210           context.history().on("change.intro", function() {
63211             continueTo(closeEditorTank);
63212           });
63213         }
63214       }
63215       function continueTo(nextStep) {
63216         context.container().select(".inspector-wrap").on("wheel.intro", null);
63217         context.on("enter.intro", null);
63218         context.history().on("change.intro", null);
63219         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
63220         nextStep();
63221       }
63222     }
63223     function closeEditorTank() {
63224       if (!_tankID || !context.hasEntity(_tankID)) {
63225         return addTank();
63226       }
63227       var ids = context.selectedIDs();
63228       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
63229         context.enter(modeSelect(context, [_tankID]));
63230       }
63231       context.history().checkpoint("hasTank");
63232       context.on("exit.intro", function() {
63233         continueTo(rightClickTank);
63234       });
63235       timeout2(function() {
63236         reveal(
63237           ".entity-editor-pane",
63238           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
63239         );
63240       }, 500);
63241       function continueTo(nextStep) {
63242         context.on("exit.intro", null);
63243         nextStep();
63244       }
63245     }
63246     function rightClickTank() {
63247       if (!_tankID) return continueTo(addTank);
63248       context.enter(modeBrowse(context));
63249       context.history().reset("hasTank");
63250       context.map().centerEase(tank, 500);
63251       timeout2(function() {
63252         context.on("enter.intro", function(mode) {
63253           if (mode.id !== "select") return;
63254           var ids = context.selectedIDs();
63255           if (ids.length !== 1 || ids[0] !== _tankID) return;
63256           timeout2(function() {
63257             var node = selectMenuItem(context, "circularize").node();
63258             if (!node) return;
63259             continueTo(clickCircle);
63260           }, 50);
63261         });
63262         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
63263         revealTank(tank, rightclickString);
63264         context.map().on("move.intro drawn.intro", function() {
63265           revealTank(tank, rightclickString, { duration: 0 });
63266         });
63267         context.history().on("change.intro", function() {
63268           continueTo(rightClickTank);
63269         });
63270       }, 600);
63271       function continueTo(nextStep) {
63272         context.on("enter.intro", null);
63273         context.map().on("move.intro drawn.intro", null);
63274         context.history().on("change.intro", null);
63275         nextStep();
63276       }
63277     }
63278     function clickCircle() {
63279       if (!_tankID) return chapter.restart();
63280       var entity = context.hasEntity(_tankID);
63281       if (!entity) return continueTo(rightClickTank);
63282       var node = selectMenuItem(context, "circularize").node();
63283       if (!node) {
63284         return continueTo(rightClickTank);
63285       }
63286       var wasChanged = false;
63287       reveal(
63288         ".edit-menu",
63289         helpHtml("intro.buildings.circle_tank"),
63290         { padding: 50 }
63291       );
63292       context.on("enter.intro", function(mode) {
63293         if (mode.id === "browse") {
63294           continueTo(rightClickTank);
63295         } else if (mode.id === "move" || mode.id === "rotate") {
63296           continueTo(retryClickCircle);
63297         }
63298       });
63299       context.map().on("move.intro", function() {
63300         var node2 = selectMenuItem(context, "circularize").node();
63301         if (!wasChanged && !node2) {
63302           return continueTo(rightClickTank);
63303         }
63304         reveal(
63305           ".edit-menu",
63306           helpHtml("intro.buildings.circle_tank"),
63307           { duration: 0, padding: 50 }
63308         );
63309       });
63310       context.history().on("change.intro", function() {
63311         wasChanged = true;
63312         context.history().on("change.intro", null);
63313         timeout2(function() {
63314           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
63315             continueTo(play);
63316           } else {
63317             continueTo(retryClickCircle);
63318           }
63319         }, 500);
63320       });
63321       function continueTo(nextStep) {
63322         context.on("enter.intro", null);
63323         context.map().on("move.intro", null);
63324         context.history().on("change.intro", null);
63325         nextStep();
63326       }
63327     }
63328     function retryClickCircle() {
63329       context.enter(modeBrowse(context));
63330       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
63331         buttonText: _t.html("intro.ok"),
63332         buttonCallback: function() {
63333           continueTo(rightClickTank);
63334         }
63335       });
63336       function continueTo(nextStep) {
63337         nextStep();
63338       }
63339     }
63340     function play() {
63341       dispatch14.call("done");
63342       reveal(
63343         ".ideditor",
63344         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
63345         {
63346           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
63347           buttonText: _t.html("intro.ok"),
63348           buttonCallback: function() {
63349             reveal(".ideditor");
63350           }
63351         }
63352       );
63353     }
63354     chapter.enter = function() {
63355       addHouse();
63356     };
63357     chapter.exit = function() {
63358       timeouts.forEach(window.clearTimeout);
63359       context.on("enter.intro exit.intro", null);
63360       context.map().on("move.intro drawn.intro", null);
63361       context.history().on("change.intro", null);
63362       context.container().select(".inspector-wrap").on("wheel.intro", null);
63363       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
63364       context.container().select(".more-fields .combobox-input").on("click.intro", null);
63365     };
63366     chapter.restart = function() {
63367       chapter.exit();
63368       chapter.enter();
63369     };
63370     return utilRebind(chapter, dispatch14, "on");
63371   }
63372   var init_building = __esm({
63373     "modules/ui/intro/building.js"() {
63374       "use strict";
63375       init_src4();
63376       init_presets();
63377       init_localizer();
63378       init_browse();
63379       init_select5();
63380       init_util();
63381       init_helper();
63382     }
63383   });
63384
63385   // modules/ui/intro/start_editing.js
63386   var start_editing_exports = {};
63387   __export(start_editing_exports, {
63388     uiIntroStartEditing: () => uiIntroStartEditing
63389   });
63390   function uiIntroStartEditing(context, reveal) {
63391     var dispatch14 = dispatch_default("done", "startEditing");
63392     var modalSelection = select_default2(null);
63393     var chapter = {
63394       title: "intro.startediting.title"
63395     };
63396     function showHelp() {
63397       reveal(
63398         ".map-control.help-control",
63399         helpHtml("intro.startediting.help"),
63400         {
63401           buttonText: _t.html("intro.ok"),
63402           buttonCallback: function() {
63403             shortcuts();
63404           }
63405         }
63406       );
63407     }
63408     function shortcuts() {
63409       reveal(
63410         ".map-control.help-control",
63411         helpHtml("intro.startediting.shortcuts"),
63412         {
63413           buttonText: _t.html("intro.ok"),
63414           buttonCallback: function() {
63415             showSave();
63416           }
63417         }
63418       );
63419     }
63420     function showSave() {
63421       context.container().selectAll(".shaded").remove();
63422       reveal(
63423         ".top-toolbar button.save",
63424         helpHtml("intro.startediting.save"),
63425         {
63426           buttonText: _t.html("intro.ok"),
63427           buttonCallback: function() {
63428             showStart();
63429           }
63430         }
63431       );
63432     }
63433     function showStart() {
63434       context.container().selectAll(".shaded").remove();
63435       modalSelection = uiModal(context.container());
63436       modalSelection.select(".modal").attr("class", "modal-splash modal");
63437       modalSelection.selectAll(".close").remove();
63438       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
63439         modalSelection.remove();
63440       });
63441       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63442       startbutton.append("h2").call(_t.append("intro.startediting.start"));
63443       dispatch14.call("startEditing");
63444     }
63445     chapter.enter = function() {
63446       showHelp();
63447     };
63448     chapter.exit = function() {
63449       modalSelection.remove();
63450       context.container().selectAll(".shaded").remove();
63451     };
63452     return utilRebind(chapter, dispatch14, "on");
63453   }
63454   var init_start_editing = __esm({
63455     "modules/ui/intro/start_editing.js"() {
63456       "use strict";
63457       init_src4();
63458       init_src5();
63459       init_localizer();
63460       init_helper();
63461       init_modal();
63462       init_rebind();
63463     }
63464   });
63465
63466   // modules/ui/intro/intro.js
63467   var intro_exports = {};
63468   __export(intro_exports, {
63469     uiIntro: () => uiIntro
63470   });
63471   function uiIntro(context) {
63472     const INTRO_IMAGERY = "Bing";
63473     let _introGraph = {};
63474     let _currChapter;
63475     function intro(selection2) {
63476       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
63477         for (let id2 in dataIntroGraph) {
63478           if (!_introGraph[id2]) {
63479             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
63480           }
63481         }
63482         selection2.call(startIntro);
63483       }).catch(function() {
63484       });
63485     }
63486     function startIntro(selection2) {
63487       context.enter(modeBrowse(context));
63488       let osm = context.connection();
63489       let history = context.history().toJSON();
63490       let hash2 = window.location.hash;
63491       let center = context.map().center();
63492       let zoom = context.map().zoom();
63493       let background = context.background().baseLayerSource();
63494       let overlays = context.background().overlayLayerSources();
63495       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
63496       let caches = osm && osm.caches();
63497       let baseEntities = context.history().graph().base().entities;
63498       context.ui().sidebar.expand();
63499       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
63500       context.inIntro(true);
63501       if (osm) {
63502         osm.toggle(false).reset();
63503       }
63504       context.history().reset();
63505       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
63506       context.history().checkpoint("initial");
63507       let imagery = context.background().findSource(INTRO_IMAGERY);
63508       if (imagery) {
63509         context.background().baseLayerSource(imagery);
63510       } else {
63511         context.background().bing();
63512       }
63513       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
63514       let layers = context.layers();
63515       layers.all().forEach((item) => {
63516         if (typeof item.layer.enabled === "function") {
63517           item.layer.enabled(item.id === "osm");
63518         }
63519       });
63520       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
63521       let curtain = uiCurtain(context.container().node());
63522       selection2.call(curtain);
63523       corePreferences("walkthrough_started", "yes");
63524       let storedProgress = corePreferences("walkthrough_progress") || "";
63525       let progress = storedProgress.split(";").filter(Boolean);
63526       let chapters = chapterFlow.map((chapter, i3) => {
63527         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
63528           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
63529           if (i3 < chapterFlow.length - 1) {
63530             const next = chapterFlow[i3 + 1];
63531             context.container().select(`button.chapter-${next}`).classed("next", true);
63532           }
63533           progress.push(chapter);
63534           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
63535         });
63536         return s2;
63537       });
63538       chapters[chapters.length - 1].on("startEditing", () => {
63539         progress.push("startEditing");
63540         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
63541         let incomplete = utilArrayDifference(chapterFlow, progress);
63542         if (!incomplete.length) {
63543           corePreferences("walkthrough_completed", "yes");
63544         }
63545         curtain.remove();
63546         navwrap.remove();
63547         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
63548         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
63549         if (osm) {
63550           osm.toggle(true).reset().caches(caches);
63551         }
63552         context.history().reset().merge(Object.values(baseEntities));
63553         context.background().baseLayerSource(background);
63554         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
63555         if (history) {
63556           context.history().fromJSON(history, false);
63557         }
63558         context.map().centerZoom(center, zoom);
63559         window.history.replaceState(null, "", hash2);
63560         context.inIntro(false);
63561       });
63562       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
63563       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63564       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
63565       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => `chapter chapter-${chapterFlow[i3]}`).on("click", enterChapter);
63566       buttons.append("span").html((d2) => _t.html(d2.title));
63567       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
63568       enterChapter(null, chapters[0]);
63569       function enterChapter(d3_event, newChapter) {
63570         if (_currChapter) {
63571           _currChapter.exit();
63572         }
63573         context.enter(modeBrowse(context));
63574         _currChapter = newChapter;
63575         _currChapter.enter();
63576         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
63577       }
63578     }
63579     return intro;
63580   }
63581   var chapterUi, chapterFlow;
63582   var init_intro = __esm({
63583     "modules/ui/intro/intro.js"() {
63584       "use strict";
63585       init_localizer();
63586       init_helper();
63587       init_preferences();
63588       init_file_fetcher();
63589       init_graph();
63590       init_browse();
63591       init_entity();
63592       init_icon();
63593       init_curtain();
63594       init_util();
63595       init_welcome();
63596       init_navigation();
63597       init_point();
63598       init_area4();
63599       init_line2();
63600       init_building();
63601       init_start_editing();
63602       chapterUi = {
63603         welcome: uiIntroWelcome,
63604         navigation: uiIntroNavigation,
63605         point: uiIntroPoint,
63606         area: uiIntroArea,
63607         line: uiIntroLine,
63608         building: uiIntroBuilding,
63609         startEditing: uiIntroStartEditing
63610       };
63611       chapterFlow = [
63612         "welcome",
63613         "navigation",
63614         "point",
63615         "area",
63616         "line",
63617         "building",
63618         "startEditing"
63619       ];
63620     }
63621   });
63622
63623   // modules/ui/intro/index.js
63624   var intro_exports2 = {};
63625   __export(intro_exports2, {
63626     uiIntro: () => uiIntro
63627   });
63628   var init_intro2 = __esm({
63629     "modules/ui/intro/index.js"() {
63630       "use strict";
63631       init_intro();
63632     }
63633   });
63634
63635   // modules/ui/issues_info.js
63636   var issues_info_exports = {};
63637   __export(issues_info_exports, {
63638     uiIssuesInfo: () => uiIssuesInfo
63639   });
63640   function uiIssuesInfo(context) {
63641     var warningsItem = {
63642       id: "warnings",
63643       count: 0,
63644       iconID: "iD-icon-alert",
63645       descriptionID: "issues.warnings_and_errors"
63646     };
63647     var resolvedItem = {
63648       id: "resolved",
63649       count: 0,
63650       iconID: "iD-icon-apply",
63651       descriptionID: "issues.user_resolved_issues"
63652     };
63653     function update(selection2) {
63654       var shownItems = [];
63655       var liveIssues = context.validator().getIssues({
63656         what: corePreferences("validate-what") || "edited",
63657         where: corePreferences("validate-where") || "all"
63658       });
63659       if (liveIssues.length) {
63660         warningsItem.count = liveIssues.length;
63661         shownItems.push(warningsItem);
63662       }
63663       if (corePreferences("validate-what") === "all") {
63664         var resolvedIssues = context.validator().getResolvedIssues();
63665         if (resolvedIssues.length) {
63666           resolvedItem.count = resolvedIssues.length;
63667           shownItems.push(resolvedItem);
63668         }
63669       }
63670       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
63671         return d2.id;
63672       });
63673       chips.exit().remove();
63674       var enter = chips.enter().append("a").attr("class", function(d2) {
63675         return "chip " + d2.id + "-count";
63676       }).attr("href", "#").each(function(d2) {
63677         var chipSelection = select_default2(this);
63678         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
63679         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
63680           d3_event.preventDefault();
63681           tooltipBehavior.hide(select_default2(this));
63682           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
63683         });
63684         chipSelection.call(svgIcon("#" + d2.iconID));
63685       });
63686       enter.append("span").attr("class", "count");
63687       enter.merge(chips).selectAll("span.count").text(function(d2) {
63688         return d2.count.toString();
63689       });
63690     }
63691     return function(selection2) {
63692       update(selection2);
63693       context.validator().on("validated.infobox", function() {
63694         update(selection2);
63695       });
63696     };
63697   }
63698   var init_issues_info = __esm({
63699     "modules/ui/issues_info.js"() {
63700       "use strict";
63701       init_src5();
63702       init_preferences();
63703       init_icon();
63704       init_localizer();
63705       init_tooltip();
63706     }
63707   });
63708
63709   // modules/util/IntervalTasksQueue.js
63710   var IntervalTasksQueue_exports = {};
63711   __export(IntervalTasksQueue_exports, {
63712     IntervalTasksQueue: () => IntervalTasksQueue
63713   });
63714   var IntervalTasksQueue;
63715   var init_IntervalTasksQueue = __esm({
63716     "modules/util/IntervalTasksQueue.js"() {
63717       "use strict";
63718       IntervalTasksQueue = class {
63719         /**
63720          * Interval in milliseconds inside which only 1 task can execute.
63721          * e.g. if interval is 200ms, and 5 async tasks are unqueued,
63722          * they will complete in ~1s if not cleared
63723          * @param {number} intervalInMs
63724          */
63725         constructor(intervalInMs) {
63726           this.intervalInMs = intervalInMs;
63727           this.pendingHandles = [];
63728           this.time = 0;
63729         }
63730         enqueue(task) {
63731           let taskTimeout = this.time;
63732           this.time += this.intervalInMs;
63733           this.pendingHandles.push(setTimeout(() => {
63734             this.time -= this.intervalInMs;
63735             task();
63736           }, taskTimeout));
63737         }
63738         clear() {
63739           this.pendingHandles.forEach((timeoutHandle) => {
63740             clearTimeout(timeoutHandle);
63741           });
63742           this.pendingHandles = [];
63743           this.time = 0;
63744         }
63745       };
63746     }
63747   });
63748
63749   // modules/renderer/background_source.js
63750   var background_source_exports = {};
63751   __export(background_source_exports, {
63752     rendererBackgroundSource: () => rendererBackgroundSource
63753   });
63754   function localeDateString(s2) {
63755     if (!s2) return null;
63756     var options2 = { day: "numeric", month: "short", year: "numeric" };
63757     var d2 = new Date(s2);
63758     if (isNaN(d2.getTime())) return null;
63759     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
63760   }
63761   function vintageRange(vintage) {
63762     var s2;
63763     if (vintage.start || vintage.end) {
63764       s2 = vintage.start || "?";
63765       if (vintage.start !== vintage.end) {
63766         s2 += " - " + (vintage.end || "?");
63767       }
63768     }
63769     return s2;
63770   }
63771   function rendererBackgroundSource(data) {
63772     var source = Object.assign({}, data);
63773     var _offset = [0, 0];
63774     var _name = source.name;
63775     var _description = source.description;
63776     var _best = !!source.best;
63777     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
63778     source.tileSize = data.tileSize || 256;
63779     source.zoomExtent = data.zoomExtent || [0, 22];
63780     source.overzoom = data.overzoom !== false;
63781     source.offset = function(val) {
63782       if (!arguments.length) return _offset;
63783       _offset = val;
63784       return source;
63785     };
63786     source.nudge = function(val, zoomlevel) {
63787       _offset[0] += val[0] / Math.pow(2, zoomlevel);
63788       _offset[1] += val[1] / Math.pow(2, zoomlevel);
63789       return source;
63790     };
63791     source.name = function() {
63792       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63793       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
63794     };
63795     source.label = function() {
63796       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63797       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
63798     };
63799     source.hasDescription = function() {
63800       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63801       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
63802       return descriptionText !== "";
63803     };
63804     source.description = function() {
63805       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
63806       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
63807     };
63808     source.best = function() {
63809       return _best;
63810     };
63811     source.area = function() {
63812       if (!data.polygon) return Number.MAX_VALUE;
63813       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
63814       return isNaN(area) ? 0 : area;
63815     };
63816     source.imageryUsed = function() {
63817       return _name || source.id;
63818     };
63819     source.template = function(val) {
63820       if (!arguments.length) return _template;
63821       if (source.id === "custom" || source.id === "Bing") {
63822         _template = val;
63823       }
63824       return source;
63825     };
63826     source.url = function(coord2) {
63827       var result = _template.replace(/#[\s\S]*/u, "");
63828       if (result === "") return result;
63829       if (!source.type || source.id === "custom") {
63830         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
63831           source.type = "wms";
63832           source.projection = "EPSG:3857";
63833         } else if (/\{(x|y)\}/.test(result)) {
63834           source.type = "tms";
63835         } else if (/\{u\}/.test(result)) {
63836           source.type = "bing";
63837         }
63838       }
63839       if (source.type === "wms") {
63840         var tileToProjectedCoords = function(x2, y2, z2) {
63841           var zoomSize = Math.pow(2, z2);
63842           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
63843           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
63844           switch (source.projection) {
63845             case "EPSG:4326":
63846               return {
63847                 x: lon * 180 / Math.PI,
63848                 y: lat * 180 / Math.PI
63849               };
63850             default:
63851               var mercCoords = mercatorRaw(lon, lat);
63852               return {
63853                 x: 2003750834e-2 / Math.PI * mercCoords[0],
63854                 y: 2003750834e-2 / Math.PI * mercCoords[1]
63855               };
63856           }
63857         };
63858         var tileSize = source.tileSize;
63859         var projection2 = source.projection;
63860         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
63861         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
63862         result = result.replace(/\{(\w+)\}/g, function(token, key) {
63863           switch (key) {
63864             case "width":
63865             case "height":
63866               return tileSize;
63867             case "proj":
63868               return projection2;
63869             case "wkid":
63870               return projection2.replace(/^EPSG:/, "");
63871             case "bbox":
63872               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
63873               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
63874                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
63875               } else {
63876                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
63877               }
63878             case "w":
63879               return minXmaxY.x;
63880             case "s":
63881               return maxXminY.y;
63882             case "n":
63883               return maxXminY.x;
63884             case "e":
63885               return minXmaxY.y;
63886             default:
63887               return token;
63888           }
63889         });
63890       } else if (source.type === "tms") {
63891         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" : "");
63892       } else if (source.type === "bing") {
63893         result = result.replace("{u}", function() {
63894           var u2 = "";
63895           for (var zoom = coord2[2]; zoom > 0; zoom--) {
63896             var b2 = 0;
63897             var mask = 1 << zoom - 1;
63898             if ((coord2[0] & mask) !== 0) b2++;
63899             if ((coord2[1] & mask) !== 0) b2 += 2;
63900             u2 += b2.toString();
63901           }
63902           return u2;
63903         });
63904       }
63905       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
63906         var subdomains = r2.split(",");
63907         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
63908       });
63909       return result;
63910     };
63911     source.validZoom = function(z2, underzoom) {
63912       if (underzoom === void 0) underzoom = 0;
63913       return source.zoomExtent[0] - underzoom <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
63914     };
63915     source.isLocatorOverlay = function() {
63916       return source.id === "mapbox_locator_overlay";
63917     };
63918     source.isHidden = function() {
63919       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
63920     };
63921     source.copyrightNotices = function() {
63922     };
63923     source.getMetadata = function(center, tileCoord, callback) {
63924       var vintage = {
63925         start: localeDateString(source.startDate),
63926         end: localeDateString(source.endDate)
63927       };
63928       vintage.range = vintageRange(vintage);
63929       var metadata = { vintage };
63930       callback(null, metadata);
63931     };
63932     return source;
63933   }
63934   var import_lodash4, isRetina, _a2;
63935   var init_background_source = __esm({
63936     "modules/renderer/background_source.js"() {
63937       "use strict";
63938       init_src2();
63939       init_src18();
63940       import_lodash4 = __toESM(require_lodash());
63941       init_localizer();
63942       init_geo2();
63943       init_util();
63944       init_aes();
63945       init_IntervalTasksQueue();
63946       isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
63947       (_a2 = window.matchMedia) == null ? void 0 : _a2.call(window, `
63948         (-webkit-min-device-pixel-ratio: 2), /* Safari */
63949         (min-resolution: 2dppx),             /* standard */
63950         (min-resolution: 192dpi)             /* fallback */
63951     `).addListener(function() {
63952         isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
63953       });
63954       rendererBackgroundSource.Bing = function(data, dispatch14) {
63955         data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
63956         var bing = rendererBackgroundSource(data);
63957         var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
63958         const strictParam = "n";
63959         var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
63960         var cache = {};
63961         var inflight = {};
63962         var providers = [];
63963         var taskQueue = new IntervalTasksQueue(250);
63964         var metadataLastZoom = -1;
63965         json_default(url).then(function(json) {
63966           let imageryResource = json.resourceSets[0].resources[0];
63967           let template = imageryResource.imageUrl;
63968           let subDomains = imageryResource.imageUrlSubdomains;
63969           let subDomainNumbers = subDomains.map((subDomain) => {
63970             return subDomain.substring(1);
63971           }).join(",");
63972           template = template.replace("{subdomain}", `t{switch:${subDomainNumbers}}`).replace("{quadkey}", "{u}");
63973           if (!new URLSearchParams(template).has(strictParam)) {
63974             template += `&${strictParam}=z`;
63975           }
63976           bing.template(template);
63977           providers = imageryResource.imageryProviders.map(function(provider) {
63978             return {
63979               attribution: provider.attribution,
63980               areas: provider.coverageAreas.map(function(area) {
63981                 return {
63982                   zoom: [area.zoomMin, area.zoomMax],
63983                   extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
63984                 };
63985               })
63986             };
63987           });
63988           dispatch14.call("change");
63989         }).catch(function() {
63990         });
63991         bing.copyrightNotices = function(zoom, extent) {
63992           zoom = Math.min(zoom, 21);
63993           return providers.filter(function(provider) {
63994             return provider.areas.some(function(area) {
63995               return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
63996             });
63997           }).map(function(provider) {
63998             return provider.attribution;
63999           }).join(", ");
64000         };
64001         bing.getMetadata = function(center, tileCoord, callback) {
64002           var tileID = tileCoord.slice(0, 3).join("/");
64003           var zoom = Math.min(tileCoord[2], 21);
64004           var centerPoint = center[1] + "," + center[0];
64005           var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
64006           if (inflight[tileID]) return;
64007           if (!cache[tileID]) {
64008             cache[tileID] = {};
64009           }
64010           if (cache[tileID] && cache[tileID].metadata) {
64011             return callback(null, cache[tileID].metadata);
64012           }
64013           inflight[tileID] = true;
64014           if (metadataLastZoom !== tileCoord[2]) {
64015             metadataLastZoom = tileCoord[2];
64016             taskQueue.clear();
64017           }
64018           taskQueue.enqueue(() => {
64019             json_default(url2).then(function(result) {
64020               delete inflight[tileID];
64021               if (!result) {
64022                 throw new Error("Unknown Error");
64023               }
64024               var vintage = {
64025                 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
64026                 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
64027               };
64028               vintage.range = vintageRange(vintage);
64029               var metadata = { vintage };
64030               cache[tileID].metadata = metadata;
64031               if (callback) callback(null, metadata);
64032             }).catch(function(err) {
64033               delete inflight[tileID];
64034               if (callback) callback(err.message);
64035             });
64036           });
64037         };
64038         bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
64039         return bing;
64040       };
64041       rendererBackgroundSource.Esri = function(data) {
64042         if (data.template.match(/blankTile/) === null) {
64043           data.template = data.template + "?blankTile=false";
64044         }
64045         var esri = rendererBackgroundSource(data);
64046         var cache = {};
64047         var inflight = {};
64048         var _prevCenter;
64049         esri.fetchTilemap = function(center) {
64050           if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
64051           _prevCenter = center;
64052           var z2 = 20;
64053           var dummyUrl = esri.url([1, 2, 3]);
64054           var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
64055           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));
64056           var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
64057           json_default(tilemapUrl).then(function(tilemap) {
64058             if (!tilemap) {
64059               throw new Error("Unknown Error");
64060             }
64061             var hasTiles = true;
64062             for (var i3 = 0; i3 < tilemap.data.length; i3++) {
64063               if (!tilemap.data[i3]) {
64064                 hasTiles = false;
64065                 break;
64066               }
64067             }
64068             esri.zoomExtent[1] = hasTiles ? 22 : 19;
64069           }).catch(function() {
64070           });
64071         };
64072         esri.getMetadata = function(center, tileCoord, callback) {
64073           if (esri.id !== "EsriWorldImagery") {
64074             return callback(null, {});
64075           }
64076           var tileID = tileCoord.slice(0, 3).join("/");
64077           var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
64078           var centerPoint = center[0] + "," + center[1];
64079           var unknown = _t("info_panels.background.unknown");
64080           var vintage = {};
64081           var metadata = {};
64082           if (inflight[tileID]) return;
64083           var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
64084           url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
64085           if (!cache[tileID]) {
64086             cache[tileID] = {};
64087           }
64088           if (cache[tileID] && cache[tileID].metadata) {
64089             return callback(null, cache[tileID].metadata);
64090           }
64091           inflight[tileID] = true;
64092           json_default(url).then(function(result) {
64093             delete inflight[tileID];
64094             result = result.features.map((f2) => f2.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
64095             if (!result) {
64096               throw new Error("Unknown Error");
64097             } else if (result.features && result.features.length < 1) {
64098               throw new Error("No Results");
64099             } else if (result.error && result.error.message) {
64100               throw new Error(result.error.message);
64101             }
64102             var captureDate = localeDateString(result.SRC_DATE2);
64103             vintage = {
64104               start: captureDate,
64105               end: captureDate,
64106               range: captureDate
64107             };
64108             metadata = {
64109               vintage,
64110               source: clean2(result.NICE_NAME),
64111               description: clean2(result.NICE_DESC),
64112               resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
64113               accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
64114             };
64115             if (isFinite(metadata.resolution)) {
64116               metadata.resolution += " m";
64117             }
64118             if (isFinite(metadata.accuracy)) {
64119               metadata.accuracy += " m";
64120             }
64121             cache[tileID].metadata = metadata;
64122             if (callback) callback(null, metadata);
64123           }).catch(function(err) {
64124             delete inflight[tileID];
64125             if (callback) callback(err.message);
64126           });
64127           function clean2(val) {
64128             return String(val).trim() || unknown;
64129           }
64130         };
64131         return esri;
64132       };
64133       rendererBackgroundSource.None = function() {
64134         var source = rendererBackgroundSource({ id: "none", template: "" });
64135         source.name = function() {
64136           return _t("background.none");
64137         };
64138         source.label = function() {
64139           return _t.append("background.none");
64140         };
64141         source.imageryUsed = function() {
64142           return null;
64143         };
64144         source.area = function() {
64145           return -1;
64146         };
64147         return source;
64148       };
64149       rendererBackgroundSource.Custom = function(template) {
64150         var source = rendererBackgroundSource({ id: "custom", template });
64151         source.name = function() {
64152           return _t("background.custom");
64153         };
64154         source.label = function() {
64155           return _t.append("background.custom");
64156         };
64157         source.imageryUsed = function() {
64158           var cleaned = source.template();
64159           if (cleaned.indexOf("?") !== -1) {
64160             var parts = cleaned.split("?", 2);
64161             var qs = utilStringQs(parts[1]);
64162             ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
64163               if (qs[param]) {
64164                 qs[param] = "{apikey}";
64165               }
64166             });
64167             cleaned = parts[0] + "?" + utilQsString(qs, true);
64168           }
64169           cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
64170           return "Custom (" + cleaned + " )";
64171         };
64172         source.area = function() {
64173           return -2;
64174         };
64175         return source;
64176       };
64177     }
64178   });
64179
64180   // node_modules/@turf/helpers/dist/esm/index.js
64181   function feature2(geom, properties, options2 = {}) {
64182     const feat = { type: "Feature" };
64183     if (options2.id === 0 || options2.id) {
64184       feat.id = options2.id;
64185     }
64186     if (options2.bbox) {
64187       feat.bbox = options2.bbox;
64188     }
64189     feat.properties = properties || {};
64190     feat.geometry = geom;
64191     return feat;
64192   }
64193   function polygon(coordinates, properties, options2 = {}) {
64194     for (const ring of coordinates) {
64195       if (ring.length < 4) {
64196         throw new Error(
64197           "Each LinearRing of a Polygon must have 4 or more Positions."
64198         );
64199       }
64200       if (ring[ring.length - 1].length !== ring[0].length) {
64201         throw new Error("First and last Position are not equivalent.");
64202       }
64203       for (let j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
64204         if (ring[ring.length - 1][j2] !== ring[0][j2]) {
64205           throw new Error("First and last Position are not equivalent.");
64206         }
64207       }
64208     }
64209     const geom = {
64210       type: "Polygon",
64211       coordinates
64212     };
64213     return feature2(geom, properties, options2);
64214   }
64215   function lineString(coordinates, properties, options2 = {}) {
64216     if (coordinates.length < 2) {
64217       throw new Error("coordinates must be an array of two or more positions");
64218     }
64219     const geom = {
64220       type: "LineString",
64221       coordinates
64222     };
64223     return feature2(geom, properties, options2);
64224   }
64225   function multiLineString(coordinates, properties, options2 = {}) {
64226     const geom = {
64227       type: "MultiLineString",
64228       coordinates
64229     };
64230     return feature2(geom, properties, options2);
64231   }
64232   function multiPolygon(coordinates, properties, options2 = {}) {
64233     const geom = {
64234       type: "MultiPolygon",
64235       coordinates
64236     };
64237     return feature2(geom, properties, options2);
64238   }
64239   var earthRadius, factors;
64240   var init_esm3 = __esm({
64241     "node_modules/@turf/helpers/dist/esm/index.js"() {
64242       earthRadius = 63710088e-1;
64243       factors = {
64244         centimeters: earthRadius * 100,
64245         centimetres: earthRadius * 100,
64246         degrees: 360 / (2 * Math.PI),
64247         feet: earthRadius * 3.28084,
64248         inches: earthRadius * 39.37,
64249         kilometers: earthRadius / 1e3,
64250         kilometres: earthRadius / 1e3,
64251         meters: earthRadius,
64252         metres: earthRadius,
64253         miles: earthRadius / 1609.344,
64254         millimeters: earthRadius * 1e3,
64255         millimetres: earthRadius * 1e3,
64256         nauticalmiles: earthRadius / 1852,
64257         radians: 1,
64258         yards: earthRadius * 1.0936
64259       };
64260     }
64261   });
64262
64263   // node_modules/@turf/invariant/dist/esm/index.js
64264   function getGeom(geojson) {
64265     if (geojson.type === "Feature") {
64266       return geojson.geometry;
64267     }
64268     return geojson;
64269   }
64270   var init_esm4 = __esm({
64271     "node_modules/@turf/invariant/dist/esm/index.js"() {
64272     }
64273   });
64274
64275   // node_modules/@turf/bbox-clip/dist/esm/index.js
64276   function lineclip(points, bbox2, result) {
64277     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
64278     let a2;
64279     let b2;
64280     if (!result) result = [];
64281     for (i3 = 1; i3 < len; i3++) {
64282       a2 = points[i3 - 1];
64283       b2 = points[i3];
64284       codeB = lastCode = bitCode(b2, bbox2);
64285       while (true) {
64286         if (!(codeA | codeB)) {
64287           part.push(a2);
64288           if (codeB !== lastCode) {
64289             part.push(b2);
64290             if (i3 < len - 1) {
64291               result.push(part);
64292               part = [];
64293             }
64294           } else if (i3 === len - 1) {
64295             part.push(b2);
64296           }
64297           break;
64298         } else if (codeA & codeB) {
64299           break;
64300         } else if (codeA) {
64301           a2 = intersect(a2, b2, codeA, bbox2);
64302           codeA = bitCode(a2, bbox2);
64303         } else {
64304           b2 = intersect(a2, b2, codeB, bbox2);
64305           codeB = bitCode(b2, bbox2);
64306         }
64307       }
64308       codeA = lastCode;
64309     }
64310     if (part.length) result.push(part);
64311     return result;
64312   }
64313   function polygonclip(points, bbox2) {
64314     var result, edge, prev, prevInside, i3, p2, inside;
64315     for (edge = 1; edge <= 8; edge *= 2) {
64316       result = [];
64317       prev = points[points.length - 1];
64318       prevInside = !(bitCode(prev, bbox2) & edge);
64319       for (i3 = 0; i3 < points.length; i3++) {
64320         p2 = points[i3];
64321         inside = !(bitCode(p2, bbox2) & edge);
64322         if (inside !== prevInside) result.push(intersect(prev, p2, edge, bbox2));
64323         if (inside) result.push(p2);
64324         prev = p2;
64325         prevInside = inside;
64326       }
64327       points = result;
64328       if (!points.length) break;
64329     }
64330     return result;
64331   }
64332   function intersect(a2, b2, edge, bbox2) {
64333     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;
64334   }
64335   function bitCode(p2, bbox2) {
64336     var code = 0;
64337     if (p2[0] < bbox2[0]) code |= 1;
64338     else if (p2[0] > bbox2[2]) code |= 2;
64339     if (p2[1] < bbox2[1]) code |= 4;
64340     else if (p2[1] > bbox2[3]) code |= 8;
64341     return code;
64342   }
64343   function bboxClip(feature3, bbox2) {
64344     const geom = getGeom(feature3);
64345     const type2 = geom.type;
64346     const properties = feature3.type === "Feature" ? feature3.properties : {};
64347     let coords = geom.coordinates;
64348     switch (type2) {
64349       case "LineString":
64350       case "MultiLineString": {
64351         const lines = [];
64352         if (type2 === "LineString") {
64353           coords = [coords];
64354         }
64355         coords.forEach((line) => {
64356           lineclip(line, bbox2, lines);
64357         });
64358         if (lines.length === 1) {
64359           return lineString(lines[0], properties);
64360         }
64361         return multiLineString(lines, properties);
64362       }
64363       case "Polygon":
64364         return polygon(clipPolygon(coords, bbox2), properties);
64365       case "MultiPolygon":
64366         return multiPolygon(
64367           coords.map((poly) => {
64368             return clipPolygon(poly, bbox2);
64369           }),
64370           properties
64371         );
64372       default:
64373         throw new Error("geometry " + type2 + " not supported");
64374     }
64375   }
64376   function clipPolygon(rings, bbox2) {
64377     const outRings = [];
64378     for (const ring of rings) {
64379       const clipped = polygonclip(ring, bbox2);
64380       if (clipped.length > 0) {
64381         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
64382           clipped.push(clipped[0]);
64383         }
64384         if (clipped.length >= 4) {
64385           outRings.push(clipped);
64386         }
64387       }
64388     }
64389     return outRings;
64390   }
64391   var turf_bbox_clip_default;
64392   var init_esm5 = __esm({
64393     "node_modules/@turf/bbox-clip/dist/esm/index.js"() {
64394       init_esm3();
64395       init_esm4();
64396       turf_bbox_clip_default = bboxClip;
64397     }
64398   });
64399
64400   // node_modules/@turf/meta/dist/esm/index.js
64401   function coordEach(geojson, callback, excludeWrapCoord) {
64402     if (geojson === null) return;
64403     var j2, k2, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
64404     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
64405       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
64406       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
64407       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
64408       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
64409         var multiFeatureIndex = 0;
64410         var geometryIndex = 0;
64411         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
64412         if (geometry === null) continue;
64413         coords = geometry.coordinates;
64414         var geomType = geometry.type;
64415         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
64416         switch (geomType) {
64417           case null:
64418             break;
64419           case "Point":
64420             if (callback(
64421               coords,
64422               coordIndex,
64423               featureIndex,
64424               multiFeatureIndex,
64425               geometryIndex
64426             ) === false)
64427               return false;
64428             coordIndex++;
64429             multiFeatureIndex++;
64430             break;
64431           case "LineString":
64432           case "MultiPoint":
64433             for (j2 = 0; j2 < coords.length; j2++) {
64434               if (callback(
64435                 coords[j2],
64436                 coordIndex,
64437                 featureIndex,
64438                 multiFeatureIndex,
64439                 geometryIndex
64440               ) === false)
64441                 return false;
64442               coordIndex++;
64443               if (geomType === "MultiPoint") multiFeatureIndex++;
64444             }
64445             if (geomType === "LineString") multiFeatureIndex++;
64446             break;
64447           case "Polygon":
64448           case "MultiLineString":
64449             for (j2 = 0; j2 < coords.length; j2++) {
64450               for (k2 = 0; k2 < coords[j2].length - wrapShrink; k2++) {
64451                 if (callback(
64452                   coords[j2][k2],
64453                   coordIndex,
64454                   featureIndex,
64455                   multiFeatureIndex,
64456                   geometryIndex
64457                 ) === false)
64458                   return false;
64459                 coordIndex++;
64460               }
64461               if (geomType === "MultiLineString") multiFeatureIndex++;
64462               if (geomType === "Polygon") geometryIndex++;
64463             }
64464             if (geomType === "Polygon") multiFeatureIndex++;
64465             break;
64466           case "MultiPolygon":
64467             for (j2 = 0; j2 < coords.length; j2++) {
64468               geometryIndex = 0;
64469               for (k2 = 0; k2 < coords[j2].length; k2++) {
64470                 for (l2 = 0; l2 < coords[j2][k2].length - wrapShrink; l2++) {
64471                   if (callback(
64472                     coords[j2][k2][l2],
64473                     coordIndex,
64474                     featureIndex,
64475                     multiFeatureIndex,
64476                     geometryIndex
64477                   ) === false)
64478                     return false;
64479                   coordIndex++;
64480                 }
64481                 geometryIndex++;
64482               }
64483               multiFeatureIndex++;
64484             }
64485             break;
64486           case "GeometryCollection":
64487             for (j2 = 0; j2 < geometry.geometries.length; j2++)
64488               if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
64489                 return false;
64490             break;
64491           default:
64492             throw new Error("Unknown Geometry Type");
64493         }
64494       }
64495     }
64496   }
64497   var init_esm6 = __esm({
64498     "node_modules/@turf/meta/dist/esm/index.js"() {
64499     }
64500   });
64501
64502   // node_modules/@turf/bbox/dist/esm/index.js
64503   function bbox(geojson, options2 = {}) {
64504     if (geojson.bbox != null && true !== options2.recompute) {
64505       return geojson.bbox;
64506     }
64507     const result = [Infinity, Infinity, -Infinity, -Infinity];
64508     coordEach(geojson, (coord2) => {
64509       if (result[0] > coord2[0]) {
64510         result[0] = coord2[0];
64511       }
64512       if (result[1] > coord2[1]) {
64513         result[1] = coord2[1];
64514       }
64515       if (result[2] < coord2[0]) {
64516         result[2] = coord2[0];
64517       }
64518       if (result[3] < coord2[1]) {
64519         result[3] = coord2[1];
64520       }
64521     });
64522     return result;
64523   }
64524   var turf_bbox_default;
64525   var init_esm7 = __esm({
64526     "node_modules/@turf/bbox/dist/esm/index.js"() {
64527       init_esm6();
64528       turf_bbox_default = bbox;
64529     }
64530   });
64531
64532   // modules/renderer/tile_layer.js
64533   var tile_layer_exports = {};
64534   __export(tile_layer_exports, {
64535     rendererTileLayer: () => rendererTileLayer
64536   });
64537   function rendererTileLayer(context) {
64538     var transformProp = utilPrefixCSSProperty("Transform");
64539     var tiler8 = utilTiler();
64540     var _tileSize = 256;
64541     var _projection;
64542     var _cache5 = {};
64543     var _tileOrigin;
64544     var _zoom;
64545     var _source;
64546     var _underzoom = 0;
64547     function tileSizeAtZoom(d2, z2) {
64548       return d2.tileSize * Math.pow(2, z2 - d2[2]) / d2.tileSize;
64549     }
64550     function atZoom(t2, distance) {
64551       var power = Math.pow(2, distance);
64552       return [
64553         Math.floor(t2[0] * power),
64554         Math.floor(t2[1] * power),
64555         t2[2] + distance
64556       ];
64557     }
64558     function lookUp(d2) {
64559       for (var up = -1; up > -d2[2]; up--) {
64560         var tile = atZoom(d2, up);
64561         if (_cache5[_source.url(tile)] !== false) {
64562           return tile;
64563         }
64564       }
64565     }
64566     function uniqueBy(a2, n3) {
64567       var o2 = [];
64568       var seen = {};
64569       for (var i3 = 0; i3 < a2.length; i3++) {
64570         if (seen[a2[i3][n3]] === void 0) {
64571           o2.push(a2[i3]);
64572           seen[a2[i3][n3]] = true;
64573         }
64574       }
64575       return o2;
64576     }
64577     function addSource(d2) {
64578       d2.url = _source.url(d2);
64579       d2.tileSize = _tileSize;
64580       d2.source = _source;
64581       return d2;
64582     }
64583     function background(selection2) {
64584       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
64585       var pixelOffset;
64586       if (_source) {
64587         pixelOffset = [
64588           _source.offset()[0] * Math.pow(2, _zoom),
64589           _source.offset()[1] * Math.pow(2, _zoom)
64590         ];
64591       } else {
64592         pixelOffset = [0, 0];
64593       }
64594       tiler8.scale(_projection.scale() * 2 * Math.PI).translate([
64595         _projection.translate()[0] + pixelOffset[0],
64596         _projection.translate()[1] + pixelOffset[1]
64597       ]);
64598       _tileOrigin = [
64599         _projection.scale() * Math.PI - _projection.translate()[0],
64600         _projection.scale() * Math.PI - _projection.translate()[1]
64601       ];
64602       render(selection2);
64603     }
64604     function render(selection2) {
64605       if (!_source) return;
64606       var requests = [];
64607       var showDebug = context.getDebug("tile") && !_source.overlay;
64608       if (_source.validZoom(_zoom, _underzoom)) {
64609         tiler8.skipNullIsland(!!_source.overlay);
64610         tiler8().forEach(function(d2) {
64611           addSource(d2);
64612           if (d2.url === "") return;
64613           if (typeof d2.url !== "string") return;
64614           requests.push(d2);
64615           if (_cache5[d2.url] === false && lookUp(d2)) {
64616             requests.push(addSource(lookUp(d2)));
64617           }
64618         });
64619         requests = uniqueBy(requests, "url").filter(function(r2) {
64620           return _cache5[r2.url] !== false;
64621         });
64622       }
64623       function load(d3_event, d2) {
64624         _cache5[d2.url] = true;
64625         select_default2(this).on("error", null).on("load", null);
64626         render(selection2);
64627       }
64628       function error(d3_event, d2) {
64629         _cache5[d2.url] = false;
64630         select_default2(this).on("error", null).on("load", null).remove();
64631         render(selection2);
64632       }
64633       function imageTransform(d2) {
64634         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
64635         var scale = tileSizeAtZoom(d2, _zoom);
64636         return "translate(" + ((d2[0] * ts + d2.source.offset()[0] * Math.pow(2, _zoom)) * _tileSize / d2.tileSize - _tileOrigin[0]) + "px," + ((d2[1] * ts + d2.source.offset()[1] * Math.pow(2, _zoom)) * _tileSize / d2.tileSize - _tileOrigin[1]) + "px) scale(" + scale * _tileSize / d2.tileSize + "," + scale * _tileSize / d2.tileSize + ")";
64637       }
64638       function tileCenter(d2) {
64639         var ts = d2.tileSize * Math.pow(2, _zoom - d2[2]);
64640         return [
64641           d2[0] * ts - _tileOrigin[0] + ts / 2,
64642           d2[1] * ts - _tileOrigin[1] + ts / 2
64643         ];
64644       }
64645       function debugTransform(d2) {
64646         var coord2 = tileCenter(d2);
64647         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
64648       }
64649       var dims = tiler8.size();
64650       var mapCenter = [dims[0] / 2, dims[1] / 2];
64651       var minDist = Math.max(dims[0], dims[1]);
64652       var nearCenter;
64653       requests.forEach(function(d2) {
64654         var c2 = tileCenter(d2);
64655         var dist = geoVecLength(c2, mapCenter);
64656         if (dist < minDist) {
64657           minDist = dist;
64658           nearCenter = d2;
64659         }
64660       });
64661       var image = selection2.selectAll("img").data(requests, function(d2) {
64662         return d2.url;
64663       });
64664       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).on("transitionend", function() {
64665         const tile = select_default2(this);
64666         if (tile.classed("tile-removing")) {
64667           tile.remove();
64668         }
64669       });
64670       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
64671         return d2.url;
64672       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
64673         return d2 === nearCenter;
64674       }).sort((a2, b2) => a2[2] - b2[2]);
64675       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
64676         return d2.url;
64677       });
64678       debug2.exit().remove();
64679       if (showDebug) {
64680         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
64681         debugEnter.append("div").attr("class", "tile-label-debug-coord");
64682         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
64683         debug2 = debug2.merge(debugEnter);
64684         debug2.style(transformProp, debugTransform);
64685         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
64686           return d2[2] + " / " + d2[0] + " / " + d2[1];
64687         });
64688         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
64689           var span = select_default2(this);
64690           var center = context.projection.invert(tileCenter(d2));
64691           _source.getMetadata(center, d2, function(err, result) {
64692             if (result && result.vintage && result.vintage.range) {
64693               span.text(result.vintage.range);
64694             } else {
64695               span.text("");
64696               span.call(_t.append("info_panels.background.vintage"));
64697               span.append("span").text(": ");
64698               span.call(_t.append("info_panels.background.unknown"));
64699             }
64700           });
64701         });
64702       }
64703     }
64704     background.projection = function(val) {
64705       if (!arguments.length) return _projection;
64706       _projection = val;
64707       return background;
64708     };
64709     background.dimensions = function(val) {
64710       if (!arguments.length) return tiler8.size();
64711       tiler8.size(val);
64712       return background;
64713     };
64714     background.source = function(val) {
64715       if (!arguments.length) return _source;
64716       _source = val;
64717       _tileSize = _source.tileSize;
64718       _cache5 = {};
64719       tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
64720       return background;
64721     };
64722     background.underzoom = function(amount) {
64723       if (!arguments.length) return _underzoom;
64724       _underzoom = amount;
64725       return background;
64726     };
64727     return background;
64728   }
64729   var init_tile_layer = __esm({
64730     "modules/renderer/tile_layer.js"() {
64731       "use strict";
64732       init_src5();
64733       init_localizer();
64734       init_geo2();
64735       init_util();
64736     }
64737   });
64738
64739   // modules/renderer/background.js
64740   var background_exports2 = {};
64741   __export(background_exports2, {
64742     rendererBackground: () => rendererBackground
64743   });
64744   function rendererBackground(context) {
64745     const dispatch14 = dispatch_default("change");
64746     const baseLayer = rendererTileLayer(context).projection(context.projection);
64747     let _checkedBlocklists = [];
64748     let _isValid = true;
64749     let _overlayLayers = [];
64750     let _brightness = 1;
64751     let _contrast = 1;
64752     let _saturation = 1;
64753     let _sharpness = 1;
64754     function ensureImageryIndex() {
64755       return _mainFileFetcher.get("imagery").then((sources) => {
64756         if (_imageryIndex) return _imageryIndex;
64757         _imageryIndex = {
64758           imagery: sources,
64759           features: {}
64760         };
64761         const features = sources.map((source) => {
64762           if (!source.polygon) return null;
64763           const rings = source.polygon.map((ring) => [ring]);
64764           const feature3 = {
64765             type: "Feature",
64766             properties: { id: source.id },
64767             geometry: { type: "MultiPolygon", coordinates: rings }
64768           };
64769           _imageryIndex.features[source.id] = feature3;
64770           return feature3;
64771         }).filter(Boolean);
64772         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
64773         _imageryIndex.backgrounds = sources.map((source) => {
64774           if (source.type === "bing") {
64775             return rendererBackgroundSource.Bing(source, dispatch14);
64776           } else if (/^EsriWorldImagery/.test(source.id)) {
64777             return rendererBackgroundSource.Esri(source);
64778           } else {
64779             return rendererBackgroundSource(source);
64780           }
64781         });
64782         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
64783         let template = corePreferences("background-custom-template") || "";
64784         const custom = rendererBackgroundSource.Custom(template);
64785         _imageryIndex.backgrounds.unshift(custom);
64786         return _imageryIndex;
64787       });
64788     }
64789     function background(selection2) {
64790       const currSource = baseLayer.source();
64791       if (context.map().zoom() > 18) {
64792         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
64793           const center = context.map().center();
64794           currSource.fetchTilemap(center);
64795         }
64796       }
64797       const sources = background.sources(context.map().extent());
64798       const wasValid = _isValid;
64799       _isValid = !!sources.filter((d2) => d2 === currSource).length;
64800       if (wasValid !== _isValid) {
64801         background.updateImagery();
64802       }
64803       let baseFilter = "";
64804       if (_brightness !== 1) {
64805         baseFilter += ` brightness(${_brightness})`;
64806       }
64807       if (_contrast !== 1) {
64808         baseFilter += ` contrast(${_contrast})`;
64809       }
64810       if (_saturation !== 1) {
64811         baseFilter += ` saturate(${_saturation})`;
64812       }
64813       if (_sharpness < 1) {
64814         const blur = number_default(0.5, 5)(1 - _sharpness);
64815         baseFilter += ` blur(${blur}px)`;
64816       }
64817       let base = selection2.selectAll(".layer-background").data([0]);
64818       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
64819       base.style("filter", baseFilter || null);
64820       let imagery = base.selectAll(".layer-imagery").data([0]);
64821       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
64822       let maskFilter = "";
64823       let mixBlendMode = "";
64824       if (_sharpness > 1) {
64825         mixBlendMode = "overlay";
64826         maskFilter = "saturate(0) blur(3px) invert(1)";
64827         let contrast = _sharpness - 1;
64828         maskFilter += ` contrast(${contrast})`;
64829         let brightness = number_default(1, 0.85)(_sharpness - 1);
64830         maskFilter += ` brightness(${brightness})`;
64831       }
64832       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
64833       mask.exit().remove();
64834       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);
64835       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
64836       overlays.exit().remove();
64837       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
64838     }
64839     background.updateImagery = function() {
64840       let currSource = baseLayer.source();
64841       if (context.inIntro() || !currSource) return;
64842       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
64843       const meters = geoOffsetToMeters(currSource.offset());
64844       const EPSILON = 0.01;
64845       const x2 = +meters[0].toFixed(2);
64846       const y2 = +meters[1].toFixed(2);
64847       let hash2 = utilStringQs(window.location.hash);
64848       let id2 = currSource.id;
64849       if (id2 === "custom") {
64850         id2 = `custom:${currSource.template()}`;
64851       }
64852       if (id2) {
64853         hash2.background = id2;
64854       } else {
64855         delete hash2.background;
64856       }
64857       if (o2) {
64858         hash2.overlays = o2;
64859       } else {
64860         delete hash2.overlays;
64861       }
64862       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
64863         hash2.offset = `${x2},${y2}`;
64864       } else {
64865         delete hash2.offset;
64866       }
64867       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
64868       let imageryUsed = [];
64869       let photoOverlaysUsed = [];
64870       const currUsed = currSource.imageryUsed();
64871       if (currUsed && _isValid) {
64872         imageryUsed.push(currUsed);
64873       }
64874       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
64875       const dataLayer = context.layers().layer("data");
64876       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
64877         imageryUsed.push(dataLayer.getSrc());
64878       }
64879       const photoOverlayLayers = {
64880         streetside: "Bing Streetside",
64881         mapillary: "Mapillary Images",
64882         "mapillary-map-features": "Mapillary Map Features",
64883         "mapillary-signs": "Mapillary Signs",
64884         kartaview: "KartaView Images",
64885         vegbilder: "Norwegian Road Administration Images",
64886         mapilio: "Mapilio Images",
64887         panoramax: "Panoramax Images"
64888       };
64889       for (let layerID in photoOverlayLayers) {
64890         const layer = context.layers().layer(layerID);
64891         if (layer && layer.enabled()) {
64892           photoOverlaysUsed.push(layerID);
64893           imageryUsed.push(photoOverlayLayers[layerID]);
64894         }
64895       }
64896       context.history().imageryUsed(imageryUsed);
64897       context.history().photoOverlaysUsed(photoOverlaysUsed);
64898     };
64899     background.sources = (extent, zoom, includeCurrent) => {
64900       if (!_imageryIndex) return [];
64901       let visible = {};
64902       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
64903       const currSource = baseLayer.source();
64904       const osm = context.connection();
64905       const blocklists = osm && osm.imageryBlocklists() || [];
64906       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
64907       if (blocklistChanged) {
64908         _imageryIndex.backgrounds.forEach((source) => {
64909           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
64910         });
64911         _checkedBlocklists = blocklists.map((regex) => String(regex));
64912       }
64913       return _imageryIndex.backgrounds.filter((source) => {
64914         if (includeCurrent && currSource === source) return true;
64915         if (source.isBlocked) return false;
64916         if (!source.polygon) return true;
64917         if (zoom && zoom < 6) return false;
64918         return visible[source.id];
64919       });
64920     };
64921     background.dimensions = (val) => {
64922       if (!val) return;
64923       baseLayer.dimensions(val);
64924       _overlayLayers.forEach((layer) => layer.dimensions(val));
64925     };
64926     background.baseLayerSource = function(d2) {
64927       if (!arguments.length) return baseLayer.source();
64928       const osm = context.connection();
64929       if (!osm) return background;
64930       const blocklists = osm.imageryBlocklists();
64931       const template = d2.template();
64932       let fail = false;
64933       let tested = 0;
64934       let regex;
64935       for (let i3 = 0; i3 < blocklists.length; i3++) {
64936         regex = blocklists[i3];
64937         fail = regex.test(template);
64938         tested++;
64939         if (fail) break;
64940       }
64941       if (!tested) {
64942         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
64943         fail = regex.test(template);
64944       }
64945       baseLayer.source(!fail ? d2 : background.findSource("none"));
64946       dispatch14.call("change");
64947       background.updateImagery();
64948       return background;
64949     };
64950     background.findSource = (id2) => {
64951       if (!id2 || !_imageryIndex) return null;
64952       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
64953     };
64954     background.bing = () => {
64955       background.baseLayerSource(background.findSource("Bing"));
64956     };
64957     background.showsLayer = (d2) => {
64958       const currSource = baseLayer.source();
64959       if (!d2 || !currSource) return false;
64960       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
64961     };
64962     background.overlayLayerSources = () => {
64963       return _overlayLayers.map((layer) => layer.source());
64964     };
64965     background.toggleOverlayLayer = (d2) => {
64966       let layer;
64967       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
64968         layer = _overlayLayers[i3];
64969         if (layer.source() === d2) {
64970           _overlayLayers.splice(i3, 1);
64971           dispatch14.call("change");
64972           background.updateImagery();
64973           return;
64974         }
64975       }
64976       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
64977         baseLayer.dimensions()
64978       );
64979       _overlayLayers.push(layer);
64980       dispatch14.call("change");
64981       background.updateImagery();
64982     };
64983     background.nudge = (d2, zoom) => {
64984       const currSource = baseLayer.source();
64985       if (currSource) {
64986         currSource.nudge(d2, zoom);
64987         dispatch14.call("change");
64988         background.updateImagery();
64989       }
64990       return background;
64991     };
64992     background.offset = function(d2) {
64993       const currSource = baseLayer.source();
64994       if (!arguments.length) {
64995         return currSource && currSource.offset() || [0, 0];
64996       }
64997       if (currSource) {
64998         currSource.offset(d2);
64999         dispatch14.call("change");
65000         background.updateImagery();
65001       }
65002       return background;
65003     };
65004     background.brightness = function(d2) {
65005       if (!arguments.length) return _brightness;
65006       _brightness = d2;
65007       if (context.mode()) dispatch14.call("change");
65008       return background;
65009     };
65010     background.contrast = function(d2) {
65011       if (!arguments.length) return _contrast;
65012       _contrast = d2;
65013       if (context.mode()) dispatch14.call("change");
65014       return background;
65015     };
65016     background.saturation = function(d2) {
65017       if (!arguments.length) return _saturation;
65018       _saturation = d2;
65019       if (context.mode()) dispatch14.call("change");
65020       return background;
65021     };
65022     background.sharpness = function(d2) {
65023       if (!arguments.length) return _sharpness;
65024       _sharpness = d2;
65025       if (context.mode()) dispatch14.call("change");
65026       return background;
65027     };
65028     let _loadPromise;
65029     background.ensureLoaded = () => {
65030       if (_loadPromise) return _loadPromise;
65031       return _loadPromise = ensureImageryIndex();
65032     };
65033     background.init = () => {
65034       const loadPromise = background.ensureLoaded();
65035       const hash2 = utilStringQs(window.location.hash);
65036       const requestedBackground = hash2.background || hash2.layer;
65037       const lastUsedBackground = corePreferences("background-last-used");
65038       return loadPromise.then((imageryIndex) => {
65039         const extent = context.map().extent();
65040         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
65041         const first = validBackgrounds.length && validBackgrounds[0];
65042         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
65043         let best;
65044         if (!requestedBackground && extent) {
65045           const viewArea = extent.area();
65046           best = validBackgrounds.find((s2) => {
65047             if (!s2.best() || s2.overlay) return false;
65048             let bbox2 = turf_bbox_default(turf_bbox_clip_default(
65049               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
65050               extent.rectangle()
65051             ));
65052             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
65053             return area / viewArea > 0.5;
65054           });
65055         }
65056         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
65057           const template = requestedBackground.replace(/^custom:/, "");
65058           const custom = background.findSource("custom");
65059           background.baseLayerSource(custom.template(template));
65060           corePreferences("background-custom-template", template);
65061         } else {
65062           background.baseLayerSource(
65063             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
65064           );
65065         }
65066         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
65067         if (locator) {
65068           background.toggleOverlayLayer(locator);
65069         }
65070         const overlays = (hash2.overlays || "").split(",");
65071         overlays.forEach((overlay) => {
65072           overlay = background.findSource(overlay);
65073           if (overlay) {
65074             background.toggleOverlayLayer(overlay);
65075           }
65076         });
65077         if (hash2.gpx) {
65078           const gpx2 = context.layers().layer("data");
65079           if (gpx2) {
65080             gpx2.url(hash2.gpx, ".gpx");
65081           }
65082         }
65083         if (hash2.offset) {
65084           const offset = hash2.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
65085           if (offset.length === 2) {
65086             background.offset(geoMetersToOffset(offset));
65087           }
65088         }
65089       }).catch((err) => {
65090         console.error(err);
65091       });
65092     };
65093     return utilRebind(background, dispatch14, "on");
65094   }
65095   var import_which_polygon3, _imageryIndex;
65096   var init_background2 = __esm({
65097     "modules/renderer/background.js"() {
65098       "use strict";
65099       init_src4();
65100       init_src8();
65101       init_src5();
65102       init_esm5();
65103       init_esm7();
65104       import_which_polygon3 = __toESM(require_which_polygon());
65105       init_preferences();
65106       init_file_fetcher();
65107       init_geo2();
65108       init_background_source();
65109       init_tile_layer();
65110       init_util();
65111       init_rebind();
65112       _imageryIndex = null;
65113     }
65114   });
65115
65116   // modules/renderer/features.js
65117   var features_exports = {};
65118   __export(features_exports, {
65119     rendererFeatures: () => rendererFeatures
65120   });
65121   function rendererFeatures(context) {
65122     var dispatch14 = dispatch_default("change", "redraw");
65123     const features = {};
65124     var _deferred2 = /* @__PURE__ */ new Set();
65125     var traffic_roads = {
65126       "motorway": true,
65127       "motorway_link": true,
65128       "trunk": true,
65129       "trunk_link": true,
65130       "primary": true,
65131       "primary_link": true,
65132       "secondary": true,
65133       "secondary_link": true,
65134       "tertiary": true,
65135       "tertiary_link": true,
65136       "residential": true,
65137       "unclassified": true,
65138       "living_street": true,
65139       "busway": true
65140     };
65141     var service_roads = {
65142       "service": true,
65143       "road": true,
65144       "track": true
65145     };
65146     var paths = {
65147       "path": true,
65148       "footway": true,
65149       "cycleway": true,
65150       "bridleway": true,
65151       "steps": true,
65152       "ladder": true,
65153       "pedestrian": true
65154     };
65155     var _cullFactor = 1;
65156     var _cache5 = {};
65157     var _rules = {};
65158     var _stats = {};
65159     var _keys = [];
65160     var _hidden = [];
65161     var _forceVisible = {};
65162     function update() {
65163       const hash2 = utilStringQs(window.location.hash);
65164       const disabled = features.disabled();
65165       if (disabled.length) {
65166         hash2.disable_features = disabled.join(",");
65167       } else {
65168         delete hash2.disable_features;
65169       }
65170       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
65171       corePreferences("disabled-features", disabled.join(","));
65172       _hidden = features.hidden();
65173       dispatch14.call("change");
65174       dispatch14.call("redraw");
65175     }
65176     function defineRule(k2, filter2, max3) {
65177       var isEnabled = true;
65178       _keys.push(k2);
65179       _rules[k2] = {
65180         filter: filter2,
65181         enabled: isEnabled,
65182         // whether the user wants it enabled..
65183         count: 0,
65184         currentMax: max3 || Infinity,
65185         defaultMax: max3 || Infinity,
65186         enable: function() {
65187           this.enabled = true;
65188           this.currentMax = this.defaultMax;
65189         },
65190         disable: function() {
65191           this.enabled = false;
65192           this.currentMax = 0;
65193         },
65194         hidden: function() {
65195           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
65196         },
65197         autoHidden: function() {
65198           return this.hidden() && this.currentMax > 0;
65199         }
65200       };
65201     }
65202     defineRule("points", function isPoint(tags, geometry) {
65203       return geometry === "point";
65204     }, 200);
65205     defineRule("traffic_roads", function isTrafficRoad(tags) {
65206       return traffic_roads[tags.highway];
65207     });
65208     defineRule("service_roads", function isServiceRoad(tags) {
65209       return service_roads[tags.highway];
65210     });
65211     defineRule("paths", function isPath(tags) {
65212       return paths[tags.highway];
65213     });
65214     defineRule("buildings", function isBuilding(tags) {
65215       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
65216     }, 250);
65217     defineRule("building_parts", function isBuildingPart(tags) {
65218       return !!tags["building:part"];
65219     });
65220     defineRule("indoor", function isIndoor(tags) {
65221       return !!tags.indoor && tags.indoor !== "no" || !!tags.indoormark && tags.indoormark !== "no";
65222     });
65223     defineRule("landuse", function isLanduse(tags, geometry) {
65224       return geometry === "area" && (!!tags.landuse || !!tags.natural || !!tags.leisure || !!tags.amenity) && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
65225     });
65226     defineRule("boundaries", function isBoundary(tags, geometry) {
65227       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);
65228     });
65229     defineRule("water", function isWater(tags) {
65230       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";
65231     });
65232     defineRule("rail", function isRail(tags) {
65233       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
65234     });
65235     defineRule("pistes", function isPiste(tags) {
65236       return tags["piste:type"];
65237     });
65238     defineRule("aerialways", function isAerialways(tags) {
65239       return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
65240     });
65241     defineRule("power", function isPower(tags) {
65242       return !!tags.power;
65243     });
65244     defineRule("past_future", function isPastFuture(tags) {
65245       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
65246         return false;
65247       }
65248       const keys2 = Object.keys(tags);
65249       for (const key of keys2) {
65250         if (osmLifecyclePrefixes[tags[key]]) return true;
65251         const parts = key.split(":");
65252         if (parts.length === 1) continue;
65253         const prefix = parts[0];
65254         if (osmLifecyclePrefixes[prefix]) return true;
65255       }
65256       return false;
65257     });
65258     defineRule("others", function isOther(tags, geometry) {
65259       return geometry === "line" || geometry === "area";
65260     });
65261     features.features = function() {
65262       return _rules;
65263     };
65264     features.keys = function() {
65265       return _keys;
65266     };
65267     features.enabled = function(k2) {
65268       if (!arguments.length) {
65269         return _keys.filter(function(k3) {
65270           return _rules[k3].enabled;
65271         });
65272       }
65273       return _rules[k2] && _rules[k2].enabled;
65274     };
65275     features.disabled = function(k2) {
65276       if (!arguments.length) {
65277         return _keys.filter(function(k3) {
65278           return !_rules[k3].enabled;
65279         });
65280       }
65281       return _rules[k2] && !_rules[k2].enabled;
65282     };
65283     features.hidden = function(k2) {
65284       var _a3;
65285       if (!arguments.length) {
65286         return _keys.filter(function(k3) {
65287           return _rules[k3].hidden();
65288         });
65289       }
65290       return (_a3 = _rules[k2]) == null ? void 0 : _a3.hidden();
65291     };
65292     features.autoHidden = function(k2) {
65293       if (!arguments.length) {
65294         return _keys.filter(function(k3) {
65295           return _rules[k3].autoHidden();
65296         });
65297       }
65298       return _rules[k2] && _rules[k2].autoHidden();
65299     };
65300     features.enable = function(k2) {
65301       if (_rules[k2] && !_rules[k2].enabled) {
65302         _rules[k2].enable();
65303         update();
65304       }
65305     };
65306     features.enableAll = function() {
65307       var didEnable = false;
65308       for (var k2 in _rules) {
65309         if (!_rules[k2].enabled) {
65310           didEnable = true;
65311           _rules[k2].enable();
65312         }
65313       }
65314       if (didEnable) update();
65315     };
65316     features.disable = function(k2) {
65317       if (_rules[k2] && _rules[k2].enabled) {
65318         _rules[k2].disable();
65319         update();
65320       }
65321     };
65322     features.disableAll = function() {
65323       var didDisable = false;
65324       for (var k2 in _rules) {
65325         if (_rules[k2].enabled) {
65326           didDisable = true;
65327           _rules[k2].disable();
65328         }
65329       }
65330       if (didDisable) update();
65331     };
65332     features.toggle = function(k2) {
65333       if (_rules[k2]) {
65334         (function(f2) {
65335           return f2.enabled ? f2.disable() : f2.enable();
65336         })(_rules[k2]);
65337         update();
65338       }
65339     };
65340     features.resetStats = function() {
65341       for (var i3 = 0; i3 < _keys.length; i3++) {
65342         _rules[_keys[i3]].count = 0;
65343       }
65344       dispatch14.call("change");
65345     };
65346     features.gatherStats = function(d2, resolver, dimensions) {
65347       var needsRedraw = false;
65348       var types = utilArrayGroupBy(d2, "type");
65349       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
65350       var currHidden, geometry, matches, i3, j2;
65351       for (i3 = 0; i3 < _keys.length; i3++) {
65352         _rules[_keys[i3]].count = 0;
65353       }
65354       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
65355       for (i3 = 0; i3 < entities.length; i3++) {
65356         geometry = entities[i3].geometry(resolver);
65357         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
65358         for (j2 = 0; j2 < matches.length; j2++) {
65359           _rules[matches[j2]].count++;
65360         }
65361       }
65362       currHidden = features.hidden();
65363       if (currHidden !== _hidden) {
65364         _hidden = currHidden;
65365         needsRedraw = true;
65366         dispatch14.call("change");
65367       }
65368       return needsRedraw;
65369     };
65370     features.stats = function() {
65371       for (var i3 = 0; i3 < _keys.length; i3++) {
65372         _stats[_keys[i3]] = _rules[_keys[i3]].count;
65373       }
65374       return _stats;
65375     };
65376     features.clear = function(d2) {
65377       for (var i3 = 0; i3 < d2.length; i3++) {
65378         features.clearEntity(d2[i3]);
65379       }
65380     };
65381     features.clearEntity = function(entity) {
65382       delete _cache5[osmEntity.key(entity)];
65383     };
65384     features.reset = function() {
65385       Array.from(_deferred2).forEach(function(handle) {
65386         window.cancelIdleCallback(handle);
65387         _deferred2.delete(handle);
65388       });
65389       _cache5 = {};
65390     };
65391     function relationShouldBeChecked(relation) {
65392       return relation.tags.type === "boundary";
65393     }
65394     features.getMatches = function(entity, resolver, geometry) {
65395       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
65396       var ent = osmEntity.key(entity);
65397       if (!_cache5[ent]) {
65398         _cache5[ent] = {};
65399       }
65400       if (!_cache5[ent].matches) {
65401         var matches = {};
65402         var hasMatch = false;
65403         for (var i3 = 0; i3 < _keys.length; i3++) {
65404           if (_keys[i3] === "others") {
65405             if (hasMatch) continue;
65406             if (entity.type === "way") {
65407               var parents = features.getParents(entity, resolver, geometry);
65408               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
65409               parents.length > 0 && parents.every(function(parent) {
65410                 return parent.tags.type === "boundary";
65411               })) {
65412                 var pkey = osmEntity.key(parents[0]);
65413                 if (_cache5[pkey] && _cache5[pkey].matches) {
65414                   matches = Object.assign({}, _cache5[pkey].matches);
65415                   continue;
65416                 }
65417               }
65418             }
65419           }
65420           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
65421             matches[_keys[i3]] = hasMatch = true;
65422           }
65423         }
65424         _cache5[ent].matches = matches;
65425       }
65426       return _cache5[ent].matches;
65427     };
65428     features.getParents = function(entity, resolver, geometry) {
65429       if (geometry === "point") return [];
65430       var ent = osmEntity.key(entity);
65431       if (!_cache5[ent]) {
65432         _cache5[ent] = {};
65433       }
65434       if (!_cache5[ent].parents) {
65435         var parents = [];
65436         if (geometry === "vertex") {
65437           parents = resolver.parentWays(entity);
65438         } else {
65439           parents = resolver.parentRelations(entity);
65440         }
65441         _cache5[ent].parents = parents;
65442       }
65443       return _cache5[ent].parents;
65444     };
65445     features.isHiddenPreset = function(preset, geometry) {
65446       if (!_hidden.length) return false;
65447       if (!preset.tags) return false;
65448       var test = preset.setTags({}, geometry);
65449       for (var key in _rules) {
65450         if (_rules[key].filter(test, geometry)) {
65451           if (_hidden.indexOf(key) !== -1) {
65452             return key;
65453           }
65454           return false;
65455         }
65456       }
65457       return false;
65458     };
65459     features.isHiddenFeature = function(entity, resolver, geometry) {
65460       if (!_hidden.length) return false;
65461       if (!entity.version) return false;
65462       if (_forceVisible[entity.id]) return false;
65463       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
65464       return matches.length && matches.every(function(k2) {
65465         return features.hidden(k2);
65466       });
65467     };
65468     features.isHiddenChild = function(entity, resolver, geometry) {
65469       if (!_hidden.length) return false;
65470       if (!entity.version || geometry === "point") return false;
65471       if (_forceVisible[entity.id]) return false;
65472       var parents = features.getParents(entity, resolver, geometry);
65473       if (!parents.length) return false;
65474       for (var i3 = 0; i3 < parents.length; i3++) {
65475         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
65476           return false;
65477         }
65478       }
65479       return true;
65480     };
65481     features.hasHiddenConnections = function(entity, resolver) {
65482       if (!_hidden.length) return false;
65483       var childNodes, connections;
65484       if (entity.type === "midpoint") {
65485         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
65486         connections = [];
65487       } else {
65488         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
65489         connections = features.getParents(entity, resolver, entity.geometry(resolver));
65490       }
65491       connections = childNodes.reduce(function(result, e3) {
65492         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
65493       }, connections);
65494       return connections.some(function(e3) {
65495         return features.isHidden(e3, resolver, e3.geometry(resolver));
65496       });
65497     };
65498     features.isHidden = function(entity, resolver, geometry) {
65499       if (!_hidden.length) return false;
65500       if (!entity.version) return false;
65501       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
65502       return fn(entity, resolver, geometry);
65503     };
65504     features.filter = function(d2, resolver) {
65505       if (!_hidden.length) return d2;
65506       var result = [];
65507       for (var i3 = 0; i3 < d2.length; i3++) {
65508         var entity = d2[i3];
65509         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
65510           result.push(entity);
65511         }
65512       }
65513       return result;
65514     };
65515     features.forceVisible = function(entityIDs) {
65516       if (!arguments.length) return Object.keys(_forceVisible);
65517       _forceVisible = {};
65518       for (var i3 = 0; i3 < entityIDs.length; i3++) {
65519         _forceVisible[entityIDs[i3]] = true;
65520         var entity = context.hasEntity(entityIDs[i3]);
65521         if (entity && entity.type === "relation") {
65522           for (var j2 in entity.members) {
65523             _forceVisible[entity.members[j2].id] = true;
65524           }
65525         }
65526       }
65527       return features;
65528     };
65529     features.init = function() {
65530       var storage = corePreferences("disabled-features");
65531       if (storage) {
65532         var storageDisabled = storage.replace(/;/g, ",").split(",");
65533         storageDisabled.forEach(features.disable);
65534       }
65535       var hash2 = utilStringQs(window.location.hash);
65536       if (hash2.disable_features) {
65537         var hashDisabled = hash2.disable_features.replace(/;/g, ",").split(",");
65538         hashDisabled.forEach(features.disable);
65539       }
65540     };
65541     context.history().on("merge.features", function(newEntities) {
65542       if (!newEntities) return;
65543       var handle = window.requestIdleCallback(function() {
65544         var graph = context.graph();
65545         var types = utilArrayGroupBy(newEntities, "type");
65546         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
65547         for (var i3 = 0; i3 < entities.length; i3++) {
65548           var geometry = entities[i3].geometry(graph);
65549           features.getMatches(entities[i3], graph, geometry);
65550         }
65551       });
65552       _deferred2.add(handle);
65553     });
65554     return utilRebind(features, dispatch14, "on");
65555   }
65556   var init_features = __esm({
65557     "modules/renderer/features.js"() {
65558       "use strict";
65559       init_src4();
65560       init_preferences();
65561       init_osm();
65562       init_rebind();
65563       init_util();
65564     }
65565   });
65566
65567   // modules/util/bind_once.js
65568   var bind_once_exports = {};
65569   __export(bind_once_exports, {
65570     utilBindOnce: () => utilBindOnce
65571   });
65572   function utilBindOnce(target, type2, listener, capture) {
65573     var typeOnce = type2 + ".once";
65574     function one2() {
65575       target.on(typeOnce, null);
65576       listener.apply(this, arguments);
65577     }
65578     target.on(typeOnce, one2, capture);
65579     return this;
65580   }
65581   var init_bind_once = __esm({
65582     "modules/util/bind_once.js"() {
65583       "use strict";
65584     }
65585   });
65586
65587   // modules/util/zoom_pan.js
65588   var zoom_pan_exports = {};
65589   __export(zoom_pan_exports, {
65590     utilZoomPan: () => utilZoomPan
65591   });
65592   function defaultFilter3(d3_event) {
65593     return !d3_event.ctrlKey && !d3_event.button;
65594   }
65595   function defaultExtent2() {
65596     var e3 = this;
65597     if (e3 instanceof SVGElement) {
65598       e3 = e3.ownerSVGElement || e3;
65599       if (e3.hasAttribute("viewBox")) {
65600         e3 = e3.viewBox.baseVal;
65601         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
65602       }
65603       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
65604     }
65605     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
65606   }
65607   function defaultWheelDelta2(d3_event) {
65608     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
65609   }
65610   function defaultConstrain2(transform2, extent, translateExtent) {
65611     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];
65612     return transform2.translate(
65613       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
65614       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
65615     );
65616   }
65617   function utilZoomPan() {
65618     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;
65619     function zoom(selection2) {
65620       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
65621       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
65622     }
65623     zoom.transform = function(collection, transform2, point) {
65624       var selection2 = collection.selection ? collection.selection() : collection;
65625       if (collection !== selection2) {
65626         schedule(collection, transform2, point);
65627       } else {
65628         selection2.interrupt().each(function() {
65629           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
65630         });
65631       }
65632     };
65633     zoom.scaleBy = function(selection2, k2, p2) {
65634       zoom.scaleTo(selection2, function() {
65635         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
65636         return k0 * k1;
65637       }, p2);
65638     };
65639     zoom.scaleTo = function(selection2, k2, p2) {
65640       zoom.transform(selection2, function() {
65641         var e3 = extent.apply(this, arguments), t02 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t02.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
65642         return constrain(translate(scale(t02, k1), p02, p1), e3, translateExtent);
65643       }, p2);
65644     };
65645     zoom.translateBy = function(selection2, x2, y2) {
65646       zoom.transform(selection2, function() {
65647         return constrain(_transform.translate(
65648           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
65649           typeof y2 === "function" ? y2.apply(this, arguments) : y2
65650         ), extent.apply(this, arguments), translateExtent);
65651       });
65652     };
65653     zoom.translateTo = function(selection2, x2, y2, p2) {
65654       zoom.transform(selection2, function() {
65655         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
65656         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
65657           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
65658           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
65659         ), e3, translateExtent);
65660       }, p2);
65661     };
65662     function scale(transform2, k2) {
65663       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
65664       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
65665     }
65666     function translate(transform2, p02, p1) {
65667       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
65668       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
65669     }
65670     function centroid(extent2) {
65671       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
65672     }
65673     function schedule(transition2, transform2, point) {
65674       transition2.on("start.zoom", function() {
65675         gesture(this, arguments).start(null);
65676       }).on("interrupt.zoom end.zoom", function() {
65677         gesture(this, arguments).end(null);
65678       }).tween("zoom", function() {
65679         var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
65680         return function(t2) {
65681           if (t2 === 1) {
65682             t2 = b2;
65683           } else {
65684             var l2 = i3(t2);
65685             var k2 = w2 / l2[2];
65686             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
65687           }
65688           g3.zoom(null, null, t2);
65689         };
65690       });
65691     }
65692     function gesture(that, args, clean2) {
65693       return !clean2 && _activeGesture || new Gesture(that, args);
65694     }
65695     function Gesture(that, args) {
65696       this.that = that;
65697       this.args = args;
65698       this.active = 0;
65699       this.extent = extent.apply(that, args);
65700     }
65701     Gesture.prototype = {
65702       start: function(d3_event) {
65703         if (++this.active === 1) {
65704           _activeGesture = this;
65705           dispatch14.call("start", this, d3_event);
65706         }
65707         return this;
65708       },
65709       zoom: function(d3_event, key, transform2) {
65710         if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
65711         if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
65712         if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
65713         _transform = transform2;
65714         dispatch14.call("zoom", this, d3_event, key, transform2);
65715         return this;
65716       },
65717       end: function(d3_event) {
65718         if (--this.active === 0) {
65719           _activeGesture = null;
65720           dispatch14.call("end", this, d3_event);
65721         }
65722         return this;
65723       }
65724     };
65725     function wheeled(d3_event) {
65726       if (!filter2.apply(this, arguments)) return;
65727       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);
65728       if (g3.wheel) {
65729         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
65730           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
65731         }
65732         clearTimeout(g3.wheel);
65733       } else {
65734         g3.mouse = [p2, t2.invert(p2)];
65735         interrupt_default(this);
65736         g3.start(d3_event);
65737       }
65738       d3_event.preventDefault();
65739       d3_event.stopImmediatePropagation();
65740       g3.wheel = setTimeout(wheelidled, _wheelDelay);
65741       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
65742       function wheelidled() {
65743         g3.wheel = null;
65744         g3.end(d3_event);
65745       }
65746     }
65747     var _downPointerIDs = /* @__PURE__ */ new Set();
65748     var _pointerLocGetter;
65749     function pointerdown(d3_event) {
65750       _downPointerIDs.add(d3_event.pointerId);
65751       if (!filter2.apply(this, arguments)) return;
65752       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
65753       var started;
65754       d3_event.stopImmediatePropagation();
65755       _pointerLocGetter = utilFastMouse(this);
65756       var loc = _pointerLocGetter(d3_event);
65757       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
65758       if (!g3.pointer0) {
65759         g3.pointer0 = p2;
65760         started = true;
65761       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
65762         g3.pointer1 = p2;
65763       }
65764       if (started) {
65765         interrupt_default(this);
65766         g3.start(d3_event);
65767       }
65768     }
65769     function pointermove(d3_event) {
65770       if (!_downPointerIDs.has(d3_event.pointerId)) return;
65771       if (!_activeGesture || !_pointerLocGetter) return;
65772       var g3 = gesture(this, arguments);
65773       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
65774       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
65775       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
65776         if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
65777         if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
65778         g3.end(d3_event);
65779         return;
65780       }
65781       d3_event.preventDefault();
65782       d3_event.stopImmediatePropagation();
65783       var loc = _pointerLocGetter(d3_event);
65784       var t2, p2, l2;
65785       if (isPointer0) g3.pointer0[0] = loc;
65786       else if (isPointer1) g3.pointer1[0] = loc;
65787       t2 = _transform;
65788       if (g3.pointer1) {
65789         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;
65790         t2 = scale(t2, Math.sqrt(dp / dl));
65791         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
65792         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
65793       } else if (g3.pointer0) {
65794         p2 = g3.pointer0[0];
65795         l2 = g3.pointer0[1];
65796       } else {
65797         return;
65798       }
65799       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
65800     }
65801     function pointerup(d3_event) {
65802       if (!_downPointerIDs.has(d3_event.pointerId)) return;
65803       _downPointerIDs.delete(d3_event.pointerId);
65804       if (!_activeGesture) return;
65805       var g3 = gesture(this, arguments);
65806       d3_event.stopImmediatePropagation();
65807       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
65808       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
65809       if (g3.pointer1 && !g3.pointer0) {
65810         g3.pointer0 = g3.pointer1;
65811         delete g3.pointer1;
65812       }
65813       if (g3.pointer0) {
65814         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
65815       } else {
65816         g3.end(d3_event);
65817       }
65818     }
65819     zoom.wheelDelta = function(_2) {
65820       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
65821     };
65822     zoom.filter = function(_2) {
65823       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
65824     };
65825     zoom.extent = function(_2) {
65826       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
65827     };
65828     zoom.scaleExtent = function(_2) {
65829       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
65830     };
65831     zoom.translateExtent = function(_2) {
65832       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]]];
65833     };
65834     zoom.constrain = function(_2) {
65835       return arguments.length ? (constrain = _2, zoom) : constrain;
65836     };
65837     zoom.interpolate = function(_2) {
65838       return arguments.length ? (interpolate = _2, zoom) : interpolate;
65839     };
65840     zoom._transform = function(_2) {
65841       return arguments.length ? (_transform = _2, zoom) : _transform;
65842     };
65843     return utilRebind(zoom, dispatch14, "on");
65844   }
65845   var init_zoom_pan = __esm({
65846     "modules/util/zoom_pan.js"() {
65847       "use strict";
65848       init_src4();
65849       init_src8();
65850       init_src5();
65851       init_src11();
65852       init_src12();
65853       init_transform3();
65854       init_util2();
65855       init_rebind();
65856     }
65857   });
65858
65859   // modules/util/double_up.js
65860   var double_up_exports = {};
65861   __export(double_up_exports, {
65862     utilDoubleUp: () => utilDoubleUp
65863   });
65864   function utilDoubleUp() {
65865     var dispatch14 = dispatch_default("doubleUp");
65866     var _maxTimespan = 500;
65867     var _maxDistance = 20;
65868     var _pointer;
65869     function pointerIsValidFor(loc) {
65870       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
65871       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
65872     }
65873     function pointerdown(d3_event) {
65874       if (d3_event.ctrlKey || d3_event.button === 2) return;
65875       var loc = [d3_event.clientX, d3_event.clientY];
65876       if (_pointer && !pointerIsValidFor(loc)) {
65877         _pointer = void 0;
65878       }
65879       if (!_pointer) {
65880         _pointer = {
65881           startLoc: loc,
65882           startTime: (/* @__PURE__ */ new Date()).getTime(),
65883           upCount: 0,
65884           pointerId: d3_event.pointerId
65885         };
65886       } else {
65887         _pointer.pointerId = d3_event.pointerId;
65888       }
65889     }
65890     function pointerup(d3_event) {
65891       if (d3_event.ctrlKey || d3_event.button === 2) return;
65892       if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
65893       _pointer.upCount += 1;
65894       if (_pointer.upCount === 2) {
65895         var loc = [d3_event.clientX, d3_event.clientY];
65896         if (pointerIsValidFor(loc)) {
65897           var locInThis = utilFastMouse(this)(d3_event);
65898           dispatch14.call("doubleUp", this, d3_event, locInThis);
65899         }
65900         _pointer = void 0;
65901       }
65902     }
65903     function doubleUp(selection2) {
65904       if ("PointerEvent" in window) {
65905         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
65906       } else {
65907         selection2.on("dblclick.doubleUp", function(d3_event) {
65908           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
65909         });
65910       }
65911     }
65912     doubleUp.off = function(selection2) {
65913       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
65914     };
65915     return utilRebind(doubleUp, dispatch14, "on");
65916   }
65917   var init_double_up = __esm({
65918     "modules/util/double_up.js"() {
65919       "use strict";
65920       init_src4();
65921       init_util2();
65922       init_rebind();
65923       init_vector();
65924     }
65925   });
65926
65927   // modules/renderer/map.js
65928   var map_exports = {};
65929   __export(map_exports, {
65930     rendererMap: () => rendererMap
65931   });
65932   function clamp2(num, min3, max3) {
65933     return Math.max(min3, Math.min(num, max3));
65934   }
65935   function rendererMap(context) {
65936     var dispatch14 = dispatch_default(
65937       "move",
65938       "drawn",
65939       "crossEditableZoom",
65940       "hitMinZoom",
65941       "changeHighlighting",
65942       "changeAreaFill"
65943     );
65944     var projection2 = context.projection;
65945     var curtainProjection = context.curtainProjection;
65946     var drawLayers;
65947     var drawPoints;
65948     var drawVertices;
65949     var drawLines;
65950     var drawAreas;
65951     var drawMidpoints;
65952     var drawLabels;
65953     var _selection = select_default2(null);
65954     var supersurface = select_default2(null);
65955     var wrapper = select_default2(null);
65956     var surface = select_default2(null);
65957     var _dimensions = [1, 1];
65958     var _dblClickZoomEnabled = true;
65959     var _redrawEnabled = true;
65960     var _gestureTransformStart;
65961     var _transformStart = projection2.transform();
65962     var _transformLast;
65963     var _isTransformed = false;
65964     var _minzoom = 0;
65965     var _getMouseCoords;
65966     var _lastPointerEvent;
65967     var _lastWithinEditableZoom;
65968     var _pointerDown = false;
65969     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
65970     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
65971     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
65972       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
65973     }).on("end.map", function() {
65974       _pointerDown = false;
65975     });
65976     var _doubleUpHandler = utilDoubleUp();
65977     var scheduleRedraw = throttle_default(redraw, 750);
65978     function cancelPendingRedraw() {
65979       scheduleRedraw.cancel();
65980     }
65981     function map2(selection2) {
65982       _selection = selection2;
65983       context.on("change.map", immediateRedraw);
65984       var osm = context.connection();
65985       if (osm) {
65986         osm.on("change.map", immediateRedraw);
65987       }
65988       function didUndoOrRedo(targetTransform) {
65989         var mode = context.mode().id;
65990         if (mode !== "browse" && mode !== "select") return;
65991         if (targetTransform) {
65992           map2.transformEase(targetTransform);
65993         }
65994       }
65995       context.history().on("merge.map", function() {
65996         scheduleRedraw();
65997       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
65998         didUndoOrRedo(fromStack.transform);
65999       }).on("redone.map", function(stack) {
66000         didUndoOrRedo(stack.transform);
66001       });
66002       context.background().on("change.map", immediateRedraw);
66003       context.features().on("redraw.map", immediateRedraw);
66004       drawLayers.on("change.map", function() {
66005         context.background().updateImagery();
66006         immediateRedraw();
66007       });
66008       selection2.on("wheel.map mousewheel.map", function(d3_event) {
66009         d3_event.preventDefault();
66010       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
66011       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
66012       wrapper = supersurface.append("div").attr("class", "layer layer-data");
66013       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
66014       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
66015         _lastPointerEvent = d3_event;
66016         if (d3_event.button === 2) {
66017           d3_event.stopPropagation();
66018         }
66019       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
66020         _lastPointerEvent = d3_event;
66021         if (resetTransform()) {
66022           immediateRedraw();
66023         }
66024       }).on(_pointerPrefix + "move.map", function(d3_event) {
66025         _lastPointerEvent = d3_event;
66026       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
66027         if (map2.editableDataEnabled() && !_isTransformed) {
66028           var hover = d3_event.target.__data__;
66029           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
66030           dispatch14.call("drawn", this, { full: false });
66031         }
66032       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
66033         if (map2.editableDataEnabled() && !_isTransformed) {
66034           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
66035           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
66036           dispatch14.call("drawn", this, { full: false });
66037         }
66038       });
66039       var detected = utilDetect();
66040       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
66041       // but we only need to do this on desktop Safari anyway. – #7694
66042       !detected.isMobileWebKit) {
66043         surface.on("gesturestart.surface", function(d3_event) {
66044           d3_event.preventDefault();
66045           _gestureTransformStart = projection2.transform();
66046         }).on("gesturechange.surface", gestureChange);
66047       }
66048       updateAreaFill();
66049       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
66050         if (!_dblClickZoomEnabled) return;
66051         if (typeof d3_event.target.__data__ === "object" && // or area fills
66052         !select_default2(d3_event.target).classed("fill")) return;
66053         var zoomOut2 = d3_event.shiftKey;
66054         var t2 = projection2.transform();
66055         var p1 = t2.invert(p02);
66056         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
66057         t2.x = p02[0] - p1[0] * t2.k;
66058         t2.y = p02[1] - p1[1] * t2.k;
66059         map2.transformEase(t2);
66060       });
66061       context.on("enter.map", function() {
66062         if (!map2.editableDataEnabled(
66063           true
66064           /* skip zoom check */
66065         )) return;
66066         if (_isTransformed) return;
66067         var graph = context.graph();
66068         var selectedAndParents = {};
66069         context.selectedIDs().forEach(function(id2) {
66070           var entity = graph.hasEntity(id2);
66071           if (entity) {
66072             selectedAndParents[entity.id] = entity;
66073             if (entity.type === "node") {
66074               graph.parentWays(entity).forEach(function(parent) {
66075                 selectedAndParents[parent.id] = parent;
66076               });
66077             }
66078           }
66079         });
66080         var data = Object.values(selectedAndParents);
66081         var filter2 = function(d2) {
66082           return d2.id in selectedAndParents;
66083         };
66084         data = context.features().filter(data, graph);
66085         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
66086         dispatch14.call("drawn", this, { full: false });
66087         scheduleRedraw();
66088       });
66089       map2.dimensions(utilGetDimensions(selection2));
66090     }
66091     function zoomEventFilter(d3_event) {
66092       if (d3_event.type === "mousedown") {
66093         var hasOrphan = false;
66094         var listeners = window.__on;
66095         for (var i3 = 0; i3 < listeners.length; i3++) {
66096           var listener = listeners[i3];
66097           if (listener.name === "zoom" && listener.type === "mouseup") {
66098             hasOrphan = true;
66099             break;
66100           }
66101         }
66102         if (hasOrphan) {
66103           var event = window.CustomEvent;
66104           if (event) {
66105             event = new event("mouseup");
66106           } else {
66107             event = window.document.createEvent("Event");
66108             event.initEvent("mouseup", false, false);
66109           }
66110           event.view = window;
66111           window.dispatchEvent(event);
66112         }
66113       }
66114       return d3_event.button !== 2;
66115     }
66116     function pxCenter() {
66117       return [_dimensions[0] / 2, _dimensions[1] / 2];
66118     }
66119     function drawEditable(difference2, extent) {
66120       var mode = context.mode();
66121       var graph = context.graph();
66122       var features = context.features();
66123       var all = context.history().intersects(map2.extent());
66124       var fullRedraw = false;
66125       var data;
66126       var set4;
66127       var filter2;
66128       var applyFeatureLayerFilters = true;
66129       if (map2.isInWideSelection()) {
66130         data = [];
66131         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
66132           var entity = context.hasEntity(id2);
66133           if (entity) data.push(entity);
66134         });
66135         fullRedraw = true;
66136         filter2 = utilFunctor(true);
66137         applyFeatureLayerFilters = false;
66138       } else if (difference2) {
66139         var complete = difference2.complete(map2.extent());
66140         data = Object.values(complete).filter(Boolean);
66141         set4 = new Set(Object.keys(complete));
66142         filter2 = function(d2) {
66143           return set4.has(d2.id);
66144         };
66145         features.clear(data);
66146       } else {
66147         if (features.gatherStats(all, graph, _dimensions)) {
66148           extent = void 0;
66149         }
66150         if (extent) {
66151           data = context.history().intersects(map2.extent().intersection(extent));
66152           set4 = new Set(data.map(function(entity) {
66153             return entity.id;
66154           }));
66155           filter2 = function(d2) {
66156             return set4.has(d2.id);
66157           };
66158         } else {
66159           data = all;
66160           fullRedraw = true;
66161           filter2 = utilFunctor(true);
66162         }
66163       }
66164       if (applyFeatureLayerFilters) {
66165         data = features.filter(data, graph);
66166       } else {
66167         context.features().resetStats();
66168       }
66169       if (mode && mode.id === "select") {
66170         surface.call(drawVertices.drawSelected, graph, map2.extent());
66171       }
66172       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);
66173       dispatch14.call("drawn", this, { full: true });
66174     }
66175     map2.init = function() {
66176       drawLayers = svgLayers(projection2, context);
66177       drawPoints = svgPoints(projection2, context);
66178       drawVertices = svgVertices(projection2, context);
66179       drawLines = svgLines(projection2, context);
66180       drawAreas = svgAreas(projection2, context);
66181       drawMidpoints = svgMidpoints(projection2, context);
66182       drawLabels = svgLabels(projection2, context);
66183     };
66184     function editOff() {
66185       context.features().resetStats();
66186       surface.selectAll(".layer-osm *").remove();
66187       surface.selectAll(".layer-touch:not(.markers) *").remove();
66188       var allowed = {
66189         "browse": true,
66190         "save": true,
66191         "select-note": true,
66192         "select-data": true,
66193         "select-error": true
66194       };
66195       var mode = context.mode();
66196       if (mode && !allowed[mode.id]) {
66197         context.enter(modeBrowse(context));
66198       }
66199       dispatch14.call("drawn", this, { full: true });
66200     }
66201     function gestureChange(d3_event) {
66202       var e3 = d3_event;
66203       e3.preventDefault();
66204       var props = {
66205         deltaMode: 0,
66206         // dummy values to ignore in zoomPan
66207         deltaY: 1,
66208         // dummy values to ignore in zoomPan
66209         clientX: e3.clientX,
66210         clientY: e3.clientY,
66211         screenX: e3.screenX,
66212         screenY: e3.screenY,
66213         x: e3.x,
66214         y: e3.y
66215       };
66216       var e22 = new WheelEvent("wheel", props);
66217       e22._scale = e3.scale;
66218       e22._rotation = e3.rotation;
66219       _selection.node().dispatchEvent(e22);
66220     }
66221     function zoomPan2(event, key, transform2) {
66222       var source = event && event.sourceEvent || event;
66223       var eventTransform = transform2 || event && event.transform;
66224       var x2 = eventTransform.x;
66225       var y2 = eventTransform.y;
66226       var k2 = eventTransform.k;
66227       if (source && source.type === "wheel") {
66228         if (_pointerDown) return;
66229         var detected = utilDetect();
66230         var dX = source.deltaX;
66231         var dY = source.deltaY;
66232         var x22 = x2;
66233         var y22 = y2;
66234         var k22 = k2;
66235         var t02, p02, p1;
66236         if (source.deltaMode === 1) {
66237           var lines = Math.abs(source.deltaY);
66238           var sign2 = source.deltaY > 0 ? 1 : -1;
66239           dY = sign2 * clamp2(
66240             lines * 18.001,
66241             4.000244140625,
66242             // min
66243             350.000244140625
66244             // max
66245           );
66246           t02 = _isTransformed ? _transformLast : _transformStart;
66247           p02 = _getMouseCoords(source);
66248           p1 = t02.invert(p02);
66249           k22 = t02.k * Math.pow(2, -dY / 500);
66250           k22 = clamp2(k22, kMin, kMax);
66251           x22 = p02[0] - p1[0] * k22;
66252           y22 = p02[1] - p1[1] * k22;
66253         } else if (source._scale) {
66254           t02 = _gestureTransformStart;
66255           p02 = _getMouseCoords(source);
66256           p1 = t02.invert(p02);
66257           k22 = t02.k * source._scale;
66258           k22 = clamp2(k22, kMin, kMax);
66259           x22 = p02[0] - p1[0] * k22;
66260           y22 = p02[1] - p1[1] * k22;
66261         } else if (source.ctrlKey && !isInteger(dY)) {
66262           dY *= 6;
66263           t02 = _isTransformed ? _transformLast : _transformStart;
66264           p02 = _getMouseCoords(source);
66265           p1 = t02.invert(p02);
66266           k22 = t02.k * Math.pow(2, -dY / 500);
66267           k22 = clamp2(k22, kMin, kMax);
66268           x22 = p02[0] - p1[0] * k22;
66269           y22 = p02[1] - p1[1] * k22;
66270         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
66271           t02 = _isTransformed ? _transformLast : _transformStart;
66272           p02 = _getMouseCoords(source);
66273           p1 = t02.invert(p02);
66274           k22 = t02.k * Math.pow(2, -dY / 500);
66275           k22 = clamp2(k22, kMin, kMax);
66276           x22 = p02[0] - p1[0] * k22;
66277           y22 = p02[1] - p1[1] * k22;
66278         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
66279           p1 = projection2.translate();
66280           x22 = p1[0] - dX;
66281           y22 = p1[1] - dY;
66282           k22 = projection2.scale();
66283           k22 = clamp2(k22, kMin, kMax);
66284         }
66285         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
66286           x2 = x22;
66287           y2 = y22;
66288           k2 = k22;
66289           eventTransform = identity2.translate(x22, y22).scale(k22);
66290           if (_zoomerPanner._transform) {
66291             _zoomerPanner._transform(eventTransform);
66292           } else {
66293             _selection.node().__zoom = eventTransform;
66294           }
66295         }
66296       }
66297       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
66298         return;
66299       }
66300       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
66301         surface.interrupt();
66302         dispatch14.call("hitMinZoom", this, map2);
66303         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
66304         scheduleRedraw();
66305         dispatch14.call("move", this, map2);
66306         return;
66307       }
66308       projection2.transform(eventTransform);
66309       var withinEditableZoom = map2.withinEditableZoom();
66310       if (_lastWithinEditableZoom !== withinEditableZoom) {
66311         if (_lastWithinEditableZoom !== void 0) {
66312           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
66313         }
66314         _lastWithinEditableZoom = withinEditableZoom;
66315       }
66316       var scale = k2 / _transformStart.k;
66317       var tX = (x2 / scale - _transformStart.x) * scale;
66318       var tY = (y2 / scale - _transformStart.y) * scale;
66319       if (context.inIntro()) {
66320         curtainProjection.transform({
66321           x: x2 - tX,
66322           y: y2 - tY,
66323           k: k2
66324         });
66325       }
66326       if (source) {
66327         _lastPointerEvent = event;
66328       }
66329       _isTransformed = true;
66330       _transformLast = eventTransform;
66331       utilSetTransform(supersurface, tX, tY, scale);
66332       scheduleRedraw();
66333       dispatch14.call("move", this, map2);
66334       function isInteger(val) {
66335         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
66336       }
66337     }
66338     function resetTransform() {
66339       if (!_isTransformed) return false;
66340       utilSetTransform(supersurface, 0, 0);
66341       _isTransformed = false;
66342       if (context.inIntro()) {
66343         curtainProjection.transform(projection2.transform());
66344       }
66345       return true;
66346     }
66347     function redraw(difference2, extent) {
66348       if (typeof window === "undefined") return;
66349       if (surface.empty() || !_redrawEnabled) return;
66350       if (resetTransform()) {
66351         difference2 = extent = void 0;
66352       }
66353       var zoom = map2.zoom();
66354       var z2 = String(~~zoom);
66355       if (surface.attr("data-zoom") !== z2) {
66356         surface.attr("data-zoom", z2);
66357       }
66358       var lat = map2.center()[1];
66359       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
66360       surface.classed("low-zoom", zoom <= lowzoom(lat));
66361       if (!difference2) {
66362         supersurface.call(context.background());
66363         wrapper.call(drawLayers);
66364       }
66365       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
66366         context.loadTiles(projection2);
66367         drawEditable(difference2, extent);
66368       } else {
66369         editOff();
66370       }
66371       _transformStart = projection2.transform();
66372       return map2;
66373     }
66374     var immediateRedraw = function(difference2, extent) {
66375       if (!difference2 && !extent) cancelPendingRedraw();
66376       redraw(difference2, extent);
66377     };
66378     map2.lastPointerEvent = function() {
66379       return _lastPointerEvent;
66380     };
66381     map2.mouse = function(d3_event) {
66382       var event = d3_event || _lastPointerEvent;
66383       if (event) {
66384         var s2;
66385         while (s2 = event.sourceEvent) {
66386           event = s2;
66387         }
66388         return _getMouseCoords(event);
66389       }
66390       return null;
66391     };
66392     map2.mouseCoordinates = function() {
66393       var coord2 = map2.mouse() || pxCenter();
66394       return projection2.invert(coord2);
66395     };
66396     map2.dblclickZoomEnable = function(val) {
66397       if (!arguments.length) return _dblClickZoomEnabled;
66398       _dblClickZoomEnabled = val;
66399       return map2;
66400     };
66401     map2.redrawEnable = function(val) {
66402       if (!arguments.length) return _redrawEnabled;
66403       _redrawEnabled = val;
66404       return map2;
66405     };
66406     map2.isTransformed = function() {
66407       return _isTransformed;
66408     };
66409     function setTransform(t2, duration, force) {
66410       var t3 = projection2.transform();
66411       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
66412       if (duration) {
66413         _selection.transition().duration(duration).on("start", function() {
66414           map2.startEase();
66415         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
66416       } else {
66417         projection2.transform(t2);
66418         _transformStart = t2;
66419         _selection.call(_zoomerPanner.transform, _transformStart);
66420       }
66421       return true;
66422     }
66423     function setCenterZoom(loc2, z2, duration, force) {
66424       var c2 = map2.center();
66425       var z3 = map2.zoom();
66426       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force) return false;
66427       var proj = geoRawMercator().transform(projection2.transform());
66428       var k2 = clamp2(geoZoomToScale(z2, TILESIZE), kMin, kMax);
66429       proj.scale(k2);
66430       var t2 = proj.translate();
66431       var point = proj(loc2);
66432       var center = pxCenter();
66433       t2[0] += center[0] - point[0];
66434       t2[1] += center[1] - point[1];
66435       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
66436     }
66437     map2.pan = function(delta, duration) {
66438       var t2 = projection2.translate();
66439       var k2 = projection2.scale();
66440       t2[0] += delta[0];
66441       t2[1] += delta[1];
66442       if (duration) {
66443         _selection.transition().duration(duration).on("start", function() {
66444           map2.startEase();
66445         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
66446       } else {
66447         projection2.translate(t2);
66448         _transformStart = projection2.transform();
66449         _selection.call(_zoomerPanner.transform, _transformStart);
66450         dispatch14.call("move", this, map2);
66451         immediateRedraw();
66452       }
66453       return map2;
66454     };
66455     map2.dimensions = function(val) {
66456       if (!arguments.length) return _dimensions;
66457       _dimensions = val;
66458       drawLayers.dimensions(_dimensions);
66459       context.background().dimensions(_dimensions);
66460       projection2.clipExtent([[0, 0], _dimensions]);
66461       _getMouseCoords = utilFastMouse(supersurface.node());
66462       scheduleRedraw();
66463       return map2;
66464     };
66465     function zoomIn(delta) {
66466       setCenterZoom(map2.center(), Math.trunc(map2.zoom() + 0.45) + delta, 150, true);
66467     }
66468     function zoomOut(delta) {
66469       setCenterZoom(map2.center(), Math.ceil(map2.zoom() - 0.45) - delta, 150, true);
66470     }
66471     map2.zoomIn = function() {
66472       zoomIn(1);
66473     };
66474     map2.zoomInFurther = function() {
66475       zoomIn(4);
66476     };
66477     map2.canZoomIn = function() {
66478       return map2.zoom() < maxZoom;
66479     };
66480     map2.zoomOut = function() {
66481       zoomOut(1);
66482     };
66483     map2.zoomOutFurther = function() {
66484       zoomOut(4);
66485     };
66486     map2.canZoomOut = function() {
66487       return map2.zoom() > minZoom2;
66488     };
66489     map2.center = function(loc2) {
66490       if (!arguments.length) {
66491         return projection2.invert(pxCenter());
66492       }
66493       if (setCenterZoom(loc2, map2.zoom())) {
66494         dispatch14.call("move", this, map2);
66495       }
66496       scheduleRedraw();
66497       return map2;
66498     };
66499     map2.unobscuredCenterZoomEase = function(loc, zoom) {
66500       var offset = map2.unobscuredOffsetPx();
66501       var proj = geoRawMercator().transform(projection2.transform());
66502       proj.scale(geoZoomToScale(zoom, TILESIZE));
66503       var locPx = proj(loc);
66504       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
66505       var offsetLoc = proj.invert(offsetLocPx);
66506       map2.centerZoomEase(offsetLoc, zoom);
66507     };
66508     map2.unobscuredOffsetPx = function() {
66509       var openPane = context.container().select(".map-panes .map-pane.shown");
66510       if (!openPane.empty()) {
66511         return [openPane.node().offsetWidth / 2, 0];
66512       }
66513       return [0, 0];
66514     };
66515     map2.zoom = function(z2) {
66516       if (!arguments.length) {
66517         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
66518       }
66519       if (z2 < _minzoom) {
66520         surface.interrupt();
66521         dispatch14.call("hitMinZoom", this, map2);
66522         z2 = context.minEditableZoom();
66523       }
66524       if (setCenterZoom(map2.center(), z2)) {
66525         dispatch14.call("move", this, map2);
66526       }
66527       scheduleRedraw();
66528       return map2;
66529     };
66530     map2.centerZoom = function(loc2, z2) {
66531       if (setCenterZoom(loc2, z2)) {
66532         dispatch14.call("move", this, map2);
66533       }
66534       scheduleRedraw();
66535       return map2;
66536     };
66537     map2.zoomTo = function(entities) {
66538       if (!isArray_default(entities)) {
66539         entities = [entities];
66540       }
66541       if (entities.length === 0) return map2;
66542       var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a2, b2) => a2.extend(b2));
66543       if (!isFinite(extent.area())) return map2;
66544       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
66545       return map2.centerZoom(extent.center(), z2);
66546     };
66547     map2.centerEase = function(loc2, duration) {
66548       duration = duration || 250;
66549       setCenterZoom(loc2, map2.zoom(), duration);
66550       return map2;
66551     };
66552     map2.zoomEase = function(z2, duration) {
66553       duration = duration || 250;
66554       setCenterZoom(map2.center(), z2, duration, false);
66555       return map2;
66556     };
66557     map2.centerZoomEase = function(loc2, z2, duration) {
66558       duration = duration || 250;
66559       setCenterZoom(loc2, z2, duration, false);
66560       return map2;
66561     };
66562     map2.transformEase = function(t2, duration) {
66563       duration = duration || 250;
66564       setTransform(
66565         t2,
66566         duration,
66567         false
66568         /* don't force */
66569       );
66570       return map2;
66571     };
66572     map2.zoomToEase = function(obj, duration) {
66573       var extent;
66574       if (Array.isArray(obj)) {
66575         obj.forEach(function(entity) {
66576           var entityExtent = entity.extent(context.graph());
66577           if (!extent) {
66578             extent = entityExtent;
66579           } else {
66580             extent = extent.extend(entityExtent);
66581           }
66582         });
66583       } else {
66584         extent = obj.extent(context.graph());
66585       }
66586       if (!isFinite(extent.area())) return map2;
66587       var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
66588       return map2.centerZoomEase(extent.center(), z2, duration);
66589     };
66590     map2.startEase = function() {
66591       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
66592         map2.cancelEase();
66593       });
66594       return map2;
66595     };
66596     map2.cancelEase = function() {
66597       _selection.interrupt();
66598       return map2;
66599     };
66600     map2.extent = function(val) {
66601       if (!arguments.length) {
66602         return new geoExtent(
66603           projection2.invert([0, _dimensions[1]]),
66604           projection2.invert([_dimensions[0], 0])
66605         );
66606       } else {
66607         var extent = geoExtent(val);
66608         map2.centerZoom(extent.center(), map2.extentZoom(extent));
66609       }
66610     };
66611     map2.trimmedExtent = function(val) {
66612       if (!arguments.length) {
66613         var headerY = 71;
66614         var footerY = 30;
66615         var pad3 = 10;
66616         return new geoExtent(
66617           projection2.invert([pad3, _dimensions[1] - footerY - pad3]),
66618           projection2.invert([_dimensions[0] - pad3, headerY + pad3])
66619         );
66620       } else {
66621         var extent = geoExtent(val);
66622         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
66623       }
66624     };
66625     function calcExtentZoom(extent, dim) {
66626       var tl = projection2([extent[0][0], extent[1][1]]);
66627       var br2 = projection2([extent[1][0], extent[0][1]]);
66628       var hFactor = (br2[0] - tl[0]) / dim[0];
66629       var vFactor = (br2[1] - tl[1]) / dim[1];
66630       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
66631       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
66632       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
66633       return newZoom;
66634     }
66635     map2.extentZoom = function(val) {
66636       return calcExtentZoom(geoExtent(val), _dimensions);
66637     };
66638     map2.trimmedExtentZoom = function(val) {
66639       var trimY = 120;
66640       var trimX = 40;
66641       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
66642       return calcExtentZoom(geoExtent(val), trimmed);
66643     };
66644     map2.withinEditableZoom = function() {
66645       return map2.zoom() >= context.minEditableZoom();
66646     };
66647     map2.isInWideSelection = function() {
66648       return !map2.withinEditableZoom() && context.selectedIDs().length;
66649     };
66650     map2.editableDataEnabled = function(skipZoomCheck) {
66651       var layer = context.layers().layer("osm");
66652       if (!layer || !layer.enabled()) return false;
66653       return skipZoomCheck || map2.withinEditableZoom();
66654     };
66655     map2.notesEditable = function() {
66656       var layer = context.layers().layer("notes");
66657       if (!layer || !layer.enabled()) return false;
66658       return map2.withinEditableZoom();
66659     };
66660     map2.minzoom = function(val) {
66661       if (!arguments.length) return _minzoom;
66662       _minzoom = val;
66663       return map2;
66664     };
66665     map2.toggleHighlightEdited = function() {
66666       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
66667       map2.pan([0, 0]);
66668       dispatch14.call("changeHighlighting", this);
66669     };
66670     map2.areaFillOptions = ["wireframe", "partial", "full"];
66671     map2.activeAreaFill = function(val) {
66672       if (!arguments.length) return corePreferences("area-fill") || "partial";
66673       corePreferences("area-fill", val);
66674       if (val !== "wireframe") {
66675         corePreferences("area-fill-toggle", val);
66676       }
66677       updateAreaFill();
66678       map2.pan([0, 0]);
66679       dispatch14.call("changeAreaFill", this);
66680       return map2;
66681     };
66682     map2.toggleWireframe = function() {
66683       var activeFill = map2.activeAreaFill();
66684       if (activeFill === "wireframe") {
66685         activeFill = corePreferences("area-fill-toggle") || "partial";
66686       } else {
66687         activeFill = "wireframe";
66688       }
66689       map2.activeAreaFill(activeFill);
66690     };
66691     function updateAreaFill() {
66692       var activeFill = map2.activeAreaFill();
66693       map2.areaFillOptions.forEach(function(opt) {
66694         surface.classed("fill-" + opt, Boolean(opt === activeFill));
66695       });
66696     }
66697     map2.layers = () => drawLayers;
66698     map2.doubleUpHandler = function() {
66699       return _doubleUpHandler;
66700     };
66701     return utilRebind(map2, dispatch14, "on");
66702   }
66703   var TILESIZE, minZoom2, maxZoom, kMin, kMax;
66704   var init_map = __esm({
66705     "modules/renderer/map.js"() {
66706       "use strict";
66707       init_throttle();
66708       init_src4();
66709       init_src8();
66710       init_src16();
66711       init_src5();
66712       init_src12();
66713       init_preferences();
66714       init_geo2();
66715       init_browse();
66716       init_svg();
66717       init_util2();
66718       init_bind_once();
66719       init_detect();
66720       init_dimensions();
66721       init_rebind();
66722       init_zoom_pan();
66723       init_double_up();
66724       init_lodash();
66725       TILESIZE = 256;
66726       minZoom2 = 2;
66727       maxZoom = 24;
66728       kMin = geoZoomToScale(minZoom2, TILESIZE);
66729       kMax = geoZoomToScale(maxZoom, TILESIZE);
66730     }
66731   });
66732
66733   // modules/renderer/photos.js
66734   var photos_exports = {};
66735   __export(photos_exports, {
66736     rendererPhotos: () => rendererPhotos
66737   });
66738   function rendererPhotos(context) {
66739     var dispatch14 = dispatch_default("change");
66740     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
66741     var _allPhotoTypes = ["flat", "panoramic"];
66742     var _shownPhotoTypes = _allPhotoTypes.slice();
66743     var _dateFilters = ["fromDate", "toDate"];
66744     var _fromDate;
66745     var _toDate;
66746     var _usernames;
66747     function photos() {
66748     }
66749     function updateStorage() {
66750       var hash2 = utilStringQs(window.location.hash);
66751       var enabled = context.layers().all().filter(function(d2) {
66752         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
66753       }).map(function(d2) {
66754         return d2.id;
66755       });
66756       if (enabled.length) {
66757         hash2.photo_overlay = enabled.join(",");
66758       } else {
66759         delete hash2.photo_overlay;
66760       }
66761       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
66762     }
66763     photos.overlayLayerIDs = function() {
66764       return _layerIDs;
66765     };
66766     photos.allPhotoTypes = function() {
66767       return _allPhotoTypes;
66768     };
66769     photos.dateFilters = function() {
66770       return _dateFilters;
66771     };
66772     photos.dateFilterValue = function(val) {
66773       return val === _dateFilters[0] ? _fromDate : _toDate;
66774     };
66775     photos.setDateFilter = function(type2, val, updateUrl) {
66776       var date = val && new Date(val);
66777       if (date && !isNaN(date)) {
66778         val = date.toISOString().slice(0, 10);
66779       } else {
66780         val = null;
66781       }
66782       if (type2 === _dateFilters[0]) {
66783         _fromDate = val;
66784         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
66785           _toDate = _fromDate;
66786         }
66787       }
66788       if (type2 === _dateFilters[1]) {
66789         _toDate = val;
66790         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
66791           _fromDate = _toDate;
66792         }
66793       }
66794       dispatch14.call("change", this);
66795       if (updateUrl) {
66796         var rangeString;
66797         if (_fromDate || _toDate) {
66798           rangeString = (_fromDate || "") + "_" + (_toDate || "");
66799         }
66800         setUrlFilterValue("photo_dates", rangeString);
66801       }
66802     };
66803     photos.setUsernameFilter = function(val, updateUrl) {
66804       if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
66805       if (val) {
66806         val = val.map((d2) => d2.trim()).filter(Boolean);
66807         if (!val.length) {
66808           val = null;
66809         }
66810       }
66811       _usernames = val;
66812       dispatch14.call("change", this);
66813       if (updateUrl) {
66814         var hashString;
66815         if (_usernames) {
66816           hashString = _usernames.join(",");
66817         }
66818         setUrlFilterValue("photo_username", hashString);
66819       }
66820     };
66821     photos.togglePhotoType = function(val, updateUrl) {
66822       var index = _shownPhotoTypes.indexOf(val);
66823       if (index !== -1) {
66824         _shownPhotoTypes.splice(index, 1);
66825       } else {
66826         _shownPhotoTypes.push(val);
66827       }
66828       if (updateUrl) {
66829         var hashString;
66830         if (_shownPhotoTypes) {
66831           hashString = _shownPhotoTypes.join(",");
66832         }
66833         setUrlFilterValue("photo_type", hashString);
66834       }
66835       dispatch14.call("change", this);
66836       return photos;
66837     };
66838     function setUrlFilterValue(property, val) {
66839       const hash2 = utilStringQs(window.location.hash);
66840       if (val) {
66841         if (hash2[property] === val) return;
66842         hash2[property] = val;
66843       } else {
66844         if (!(property in hash2)) return;
66845         delete hash2[property];
66846       }
66847       window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
66848     }
66849     function showsLayer(id2) {
66850       var layer = context.layers().layer(id2);
66851       return layer && layer.supported() && layer.enabled();
66852     }
66853     photos.shouldFilterDateBySlider = function() {
66854       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("mapilio") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
66855     };
66856     photos.shouldFilterByPhotoType = function() {
66857       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
66858     };
66859     photos.shouldFilterByUsername = function() {
66860       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
66861     };
66862     photos.showsPhotoType = function(val) {
66863       if (!photos.shouldFilterByPhotoType()) return true;
66864       return _shownPhotoTypes.indexOf(val) !== -1;
66865     };
66866     photos.showsFlat = function() {
66867       return photos.showsPhotoType("flat");
66868     };
66869     photos.showsPanoramic = function() {
66870       return photos.showsPhotoType("panoramic");
66871     };
66872     photos.fromDate = function() {
66873       return _fromDate;
66874     };
66875     photos.toDate = function() {
66876       return _toDate;
66877     };
66878     photos.usernames = function() {
66879       return _usernames;
66880     };
66881     photos.init = function() {
66882       var hash2 = utilStringQs(window.location.hash);
66883       var parts;
66884       if (hash2.photo_dates) {
66885         parts = /^(.*)[–_](.*)$/g.exec(hash2.photo_dates.trim());
66886         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
66887         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
66888       }
66889       if (hash2.photo_username) {
66890         this.setUsernameFilter(hash2.photo_username, false);
66891       }
66892       if (hash2.photo_type) {
66893         parts = hash2.photo_type.replace(/;/g, ",").split(",");
66894         _allPhotoTypes.forEach((d2) => {
66895           if (!parts.includes(d2)) this.togglePhotoType(d2, false);
66896         });
66897       }
66898       if (hash2.photo_overlay) {
66899         var hashOverlayIDs = hash2.photo_overlay.replace(/;/g, ",").split(",");
66900         hashOverlayIDs.forEach(function(id2) {
66901           if (id2 === "openstreetcam") id2 = "kartaview";
66902           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
66903           if (layer2 && !layer2.enabled()) layer2.enabled(true);
66904         });
66905       }
66906       if (hash2.photo) {
66907         var photoIds = hash2.photo.replace(/;/g, ",").split(",");
66908         var photoId = photoIds.length && photoIds[0].trim();
66909         var results = /(.*)\/(.*)/g.exec(photoId);
66910         if (results && results.length >= 3) {
66911           var serviceId = results[1];
66912           if (serviceId === "openstreetcam") serviceId = "kartaview";
66913           var photoKey = results[2];
66914           var service = services[serviceId];
66915           if (service && service.ensureViewerLoaded) {
66916             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
66917             if (layer && !layer.enabled()) layer.enabled(true);
66918             var baselineTime = Date.now();
66919             service.on("loadedImages.rendererPhotos", function() {
66920               if (Date.now() - baselineTime > 45e3) {
66921                 service.on("loadedImages.rendererPhotos", null);
66922                 return;
66923               }
66924               if (!service.cachedImage(photoKey)) return;
66925               service.on("loadedImages.rendererPhotos", null);
66926               service.ensureViewerLoaded(context).then(function() {
66927                 service.selectImage(context, photoKey).showViewer(context);
66928               });
66929             });
66930           }
66931         }
66932       }
66933       context.layers().on("change.rendererPhotos", updateStorage);
66934     };
66935     return utilRebind(photos, dispatch14, "on");
66936   }
66937   var init_photos = __esm({
66938     "modules/renderer/photos.js"() {
66939       "use strict";
66940       init_src4();
66941       init_services();
66942       init_rebind();
66943       init_util();
66944     }
66945   });
66946
66947   // modules/renderer/index.js
66948   var renderer_exports = {};
66949   __export(renderer_exports, {
66950     rendererBackground: () => rendererBackground,
66951     rendererBackgroundSource: () => rendererBackgroundSource,
66952     rendererFeatures: () => rendererFeatures,
66953     rendererMap: () => rendererMap,
66954     rendererPhotos: () => rendererPhotos,
66955     rendererTileLayer: () => rendererTileLayer
66956   });
66957   var init_renderer = __esm({
66958     "modules/renderer/index.js"() {
66959       "use strict";
66960       init_background_source();
66961       init_background2();
66962       init_features();
66963       init_map();
66964       init_photos();
66965       init_tile_layer();
66966     }
66967   });
66968
66969   // modules/ui/map_in_map.js
66970   var map_in_map_exports = {};
66971   __export(map_in_map_exports, {
66972     uiMapInMap: () => uiMapInMap
66973   });
66974   function uiMapInMap(context) {
66975     function mapInMap(selection2) {
66976       var backgroundLayer = rendererTileLayer(context).underzoom(2);
66977       var overlayLayers = {};
66978       var projection2 = geoRawMercator();
66979       var dataLayer = svgData(projection2, context).showLabels(false);
66980       var debugLayer = svgDebug(projection2, context);
66981       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
66982       var wrap2 = select_default2(null);
66983       var tiles = select_default2(null);
66984       var viewport = select_default2(null);
66985       var _isTransformed = false;
66986       var _isHidden = true;
66987       var _skipEvents = false;
66988       var _gesture = null;
66989       var _zDiff = 6;
66990       var _dMini;
66991       var _cMini;
66992       var _tStart;
66993       var _tCurr;
66994       var _timeoutID;
66995       function zoomStarted() {
66996         if (_skipEvents) return;
66997         _tStart = _tCurr = projection2.transform();
66998         _gesture = null;
66999       }
67000       function zoomed(d3_event) {
67001         if (_skipEvents) return;
67002         var x2 = d3_event.transform.x;
67003         var y2 = d3_event.transform.y;
67004         var k2 = d3_event.transform.k;
67005         var isZooming = k2 !== _tStart.k;
67006         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
67007         if (!isZooming && !isPanning) {
67008           return;
67009         }
67010         if (!_gesture) {
67011           _gesture = isZooming ? "zoom" : "pan";
67012         }
67013         var tMini = projection2.transform();
67014         var tX, tY, scale;
67015         if (_gesture === "zoom") {
67016           scale = k2 / tMini.k;
67017           tX = (_cMini[0] / scale - _cMini[0]) * scale;
67018           tY = (_cMini[1] / scale - _cMini[1]) * scale;
67019         } else {
67020           k2 = tMini.k;
67021           scale = 1;
67022           tX = x2 - tMini.x;
67023           tY = y2 - tMini.y;
67024         }
67025         utilSetTransform(tiles, tX, tY, scale);
67026         utilSetTransform(viewport, 0, 0, scale);
67027         _isTransformed = true;
67028         _tCurr = identity2.translate(x2, y2).scale(k2);
67029         var zMain = geoScaleToZoom(context.projection.scale());
67030         var zMini = geoScaleToZoom(k2);
67031         _zDiff = zMain - zMini;
67032         queueRedraw();
67033       }
67034       function zoomEnded() {
67035         if (_skipEvents) return;
67036         if (_gesture !== "pan") return;
67037         updateProjection();
67038         _gesture = null;
67039         context.map().center(projection2.invert(_cMini));
67040       }
67041       function updateProjection() {
67042         var loc = context.map().center();
67043         var tMain = context.projection.transform();
67044         var zMain = geoScaleToZoom(tMain.k);
67045         var zMini = Math.max(zMain - _zDiff, 0.5);
67046         var kMini = geoZoomToScale(zMini);
67047         projection2.translate([tMain.x, tMain.y]).scale(kMini);
67048         var point = projection2(loc);
67049         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
67050         var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
67051         var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
67052         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
67053         _tCurr = projection2.transform();
67054         if (_isTransformed) {
67055           utilSetTransform(tiles, 0, 0);
67056           utilSetTransform(viewport, 0, 0);
67057           _isTransformed = false;
67058         }
67059         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
67060         _skipEvents = true;
67061         wrap2.call(zoom.transform, _tCurr);
67062         _skipEvents = false;
67063       }
67064       function redraw() {
67065         clearTimeout(_timeoutID);
67066         if (_isHidden) return;
67067         updateProjection();
67068         var zMini = geoScaleToZoom(projection2.scale());
67069         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
67070         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
67071         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
67072         var background = tiles.selectAll(".map-in-map-background").data([0]);
67073         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
67074         var overlaySources = context.background().overlayLayerSources();
67075         var activeOverlayLayers = [];
67076         for (var i3 = 0; i3 < overlaySources.length; i3++) {
67077           if (overlaySources[i3].validZoom(zMini)) {
67078             if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
67079             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
67080           }
67081         }
67082         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
67083         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
67084         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
67085           return d2.source().name();
67086         });
67087         overlays.exit().remove();
67088         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
67089           select_default2(this).call(layer);
67090         });
67091         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
67092         dataLayers.exit().remove();
67093         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
67094         if (_gesture !== "pan") {
67095           var getPath = path_default(projection2);
67096           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
67097           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
67098           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
67099           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
67100           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
67101             return getPath.area(d2) < 30;
67102           });
67103         }
67104       }
67105       function queueRedraw() {
67106         clearTimeout(_timeoutID);
67107         _timeoutID = setTimeout(function() {
67108           redraw();
67109         }, 750);
67110       }
67111       function toggle(d3_event) {
67112         if (d3_event) d3_event.preventDefault();
67113         _isHidden = !_isHidden;
67114         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
67115         if (_isHidden) {
67116           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
67117             selection2.selectAll(".map-in-map").style("display", "none");
67118           });
67119         } else {
67120           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
67121             redraw();
67122           });
67123         }
67124       }
67125       uiMapInMap.toggle = toggle;
67126       wrap2 = selection2.selectAll(".map-in-map").data([0]);
67127       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
67128       _dMini = [200, 150];
67129       _cMini = geoVecScale(_dMini, 0.5);
67130       context.map().on("drawn.map-in-map", function(drawn) {
67131         if (drawn.full === true) {
67132           redraw();
67133         }
67134       });
67135       redraw();
67136       context.keybinding().on(_t("background.minimap.key"), toggle);
67137     }
67138     return mapInMap;
67139   }
67140   var init_map_in_map = __esm({
67141     "modules/ui/map_in_map.js"() {
67142       "use strict";
67143       init_src2();
67144       init_src5();
67145       init_src12();
67146       init_localizer();
67147       init_geo2();
67148       init_renderer();
67149       init_svg();
67150       init_util();
67151     }
67152   });
67153
67154   // modules/ui/notice.js
67155   var notice_exports = {};
67156   __export(notice_exports, {
67157     uiNotice: () => uiNotice
67158   });
67159   function uiNotice(context) {
67160     return function(selection2) {
67161       var div = selection2.append("div").attr("class", "notice");
67162       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
67163         context.map().zoomEase(context.minEditableZoom());
67164       }).on("wheel", function(d3_event) {
67165         var e22 = new WheelEvent(d3_event.type, d3_event);
67166         context.surface().node().dispatchEvent(e22);
67167       });
67168       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
67169       function disableTooHigh() {
67170         var canEdit = context.map().zoom() >= context.minEditableZoom();
67171         div.style("display", canEdit ? "none" : "block");
67172       }
67173       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
67174       disableTooHigh();
67175     };
67176   }
67177   var init_notice = __esm({
67178     "modules/ui/notice.js"() {
67179       "use strict";
67180       init_debounce();
67181       init_localizer();
67182       init_svg();
67183     }
67184   });
67185
67186   // modules/ui/photoviewer.js
67187   var photoviewer_exports = {};
67188   __export(photoviewer_exports, {
67189     uiPhotoviewer: () => uiPhotoviewer
67190   });
67191   function uiPhotoviewer(context) {
67192     var dispatch14 = dispatch_default("resize");
67193     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
67194     const addPhotoIdButton = /* @__PURE__ */ new Set(["mapillary", "panoramax"]);
67195     function photoviewer(selection2) {
67196       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
67197         for (const service of Object.values(services)) {
67198           if (typeof service.hideViewer === "function") {
67199             service.hideViewer(context);
67200           }
67201         }
67202       }).append("div").call(svgIcon("#iD-icon-close"));
67203       function preventDefault(d3_event) {
67204         d3_event.preventDefault();
67205       }
67206       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
67207         _pointerPrefix + "down",
67208         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
67209       );
67210       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
67211         _pointerPrefix + "down",
67212         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
67213       );
67214       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
67215         _pointerPrefix + "down",
67216         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
67217       );
67218       context.features().on("change.setPhotoFromViewer", function() {
67219         setPhotoTagButton();
67220       });
67221       context.history().on("change.setPhotoFromViewer", function() {
67222         setPhotoTagButton();
67223       });
67224       function setPhotoTagButton() {
67225         const service = getServiceId();
67226         const isActiveForService = addPhotoIdButton.has(service) && services[service].isViewerOpen() && layerEnabled(service) && context.mode().id === "select";
67227         renderAddPhotoIdButton(service, isActiveForService);
67228         function layerEnabled(which) {
67229           const layers = context.layers();
67230           const layer = layers.layer(which);
67231           return layer.enabled();
67232         }
67233         function getServiceId() {
67234           for (const serviceId in services) {
67235             const service2 = services[serviceId];
67236             if (typeof service2.isViewerOpen === "function") {
67237               if (service2.isViewerOpen()) {
67238                 return serviceId;
67239               }
67240             }
67241           }
67242           return false;
67243         }
67244         function renderAddPhotoIdButton(service2, shouldDisplay) {
67245           const button = selection2.selectAll(".set-photo-from-viewer").data(shouldDisplay ? [0] : []);
67246           button.exit().remove();
67247           const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#fas-eye-dropper")).call(
67248             uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
67249           );
67250           buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px").merge(button).on("click", function(e3) {
67251             e3.preventDefault();
67252             e3.stopPropagation();
67253             const activeServiceId = getServiceId();
67254             const image = services[activeServiceId].getActiveImage();
67255             const action = (graph2) => context.selectedIDs().reduce((graph3, entityID) => {
67256               const tags = graph3.entity(entityID).tags;
67257               const action2 = actionChangeTags(entityID, { ...tags, [activeServiceId]: image.id });
67258               return action2(graph3);
67259             }, graph2);
67260             const annotation = _t("operations.change_tags.annotation");
67261             context.perform(action, annotation);
67262             buttonDisable("already_set");
67263           });
67264           if (service2 === "panoramax") {
67265             const panoramaxControls = selection2.select(".panoramax-wrapper .pnlm-zoom-controls.pnlm-controls");
67266             panoramaxControls.style("margin-top", shouldDisplay ? "36px" : "6px");
67267           }
67268           if (!shouldDisplay) return;
67269           const activeImage = services[service2].getActiveImage();
67270           const graph = context.graph();
67271           const entities = context.selectedIDs().map((id2) => graph.hasEntity(id2)).filter(Boolean);
67272           if (entities.map((entity) => entity.tags[service2]).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
67273             buttonDisable("already_set");
67274           } else if (activeImage && entities.map((entity) => entity.extent(context.graph()).center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
67275             buttonDisable("too_far");
67276           } else {
67277             buttonDisable(false);
67278           }
67279         }
67280         function buttonDisable(reason) {
67281           const disabled = reason !== false;
67282           const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
67283           button.attr("disabled", disabled ? "true" : null);
67284           button.classed("disabled", disabled);
67285           button.call(uiTooltip().destroyAny);
67286           if (disabled) {
67287             button.call(
67288               uiTooltip().title(() => _t.append(`inspector.set_photo_from_viewer.disable.${reason}`)).placement("right")
67289             );
67290           } else {
67291             button.call(
67292               uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
67293             );
67294           }
67295           button.select(".tooltip").classed("dark", true).style("width", "300px");
67296         }
67297       }
67298       function buildResizeListener(target, eventName, dispatch15, options2) {
67299         var resizeOnX = !!options2.resizeOnX;
67300         var resizeOnY = !!options2.resizeOnY;
67301         var minHeight = options2.minHeight || 240;
67302         var minWidth = options2.minWidth || 320;
67303         var pointerId;
67304         var startX;
67305         var startY;
67306         var startWidth;
67307         var startHeight;
67308         function startResize(d3_event) {
67309           if (pointerId !== (d3_event.pointerId || "mouse")) return;
67310           d3_event.preventDefault();
67311           d3_event.stopPropagation();
67312           var mapSize = context.map().dimensions();
67313           if (resizeOnX) {
67314             var mapWidth = mapSize[0];
67315             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-left"), 10);
67316             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, mapWidth - viewerMargin * 2);
67317             target.style("width", newWidth + "px");
67318           }
67319           if (resizeOnY) {
67320             const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
67321             const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
67322             var maxHeight = mapSize[1] - menuHeight - viewerMargin * 2;
67323             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
67324             target.style("height", newHeight + "px");
67325           }
67326           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
67327         }
67328         function clamp3(num, min3, max3) {
67329           return Math.max(min3, Math.min(num, max3));
67330         }
67331         function stopResize(d3_event) {
67332           if (pointerId !== (d3_event.pointerId || "mouse")) return;
67333           d3_event.preventDefault();
67334           d3_event.stopPropagation();
67335           select_default2(window).on("." + eventName, null);
67336         }
67337         return function initResize(d3_event) {
67338           d3_event.preventDefault();
67339           d3_event.stopPropagation();
67340           pointerId = d3_event.pointerId || "mouse";
67341           startX = d3_event.clientX;
67342           startY = d3_event.clientY;
67343           var targetRect = target.node().getBoundingClientRect();
67344           startWidth = targetRect.width;
67345           startHeight = targetRect.height;
67346           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
67347           if (_pointerPrefix === "pointer") {
67348             select_default2(window).on("pointercancel." + eventName, stopResize, false);
67349           }
67350         };
67351       }
67352     }
67353     photoviewer.onMapResize = function() {
67354       var photoviewer2 = context.container().select(".photoviewer");
67355       var content = context.container().select(".main-content");
67356       var mapDimensions = utilGetDimensions(content, true);
67357       const menuHeight = utilGetDimensions(select_default2(".top-toolbar"))[1] + utilGetDimensions(select_default2(".map-footer"))[1];
67358       const viewerMargin = parseInt(select_default2(".photoviewer").style("margin-bottom"), 10);
67359       var photoDimensions = utilGetDimensions(photoviewer2, true);
67360       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - menuHeight - viewerMargin * 2) {
67361         var setPhotoDimensions = [
67362           Math.min(photoDimensions[0], mapDimensions[0]),
67363           Math.min(photoDimensions[1], mapDimensions[1] - menuHeight - viewerMargin * 2)
67364         ];
67365         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
67366         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
67367       }
67368     };
67369     function subtractPadding(dimensions, selection2) {
67370       return [
67371         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
67372         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
67373       ];
67374     }
67375     return utilRebind(photoviewer, dispatch14, "on");
67376   }
67377   var init_photoviewer = __esm({
67378     "modules/ui/photoviewer.js"() {
67379       "use strict";
67380       init_src5();
67381       init_localizer();
67382       init_src4();
67383       init_icon();
67384       init_dimensions();
67385       init_util();
67386       init_services();
67387       init_tooltip();
67388       init_actions();
67389       init_geo2();
67390     }
67391   });
67392
67393   // modules/ui/restore.js
67394   var restore_exports = {};
67395   __export(restore_exports, {
67396     uiRestore: () => uiRestore
67397   });
67398   function uiRestore(context) {
67399     return function(selection2) {
67400       if (!context.history().hasRestorableChanges()) return;
67401       let modalSelection = uiModal(selection2, true);
67402       modalSelection.select(".modal").attr("class", "modal fillL");
67403       let introModal = modalSelection.select(".content");
67404       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
67405       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
67406       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
67407       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
67408         context.history().restore();
67409         modalSelection.remove();
67410       });
67411       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
67412       restore.append("div").call(_t.append("restore.restore"));
67413       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
67414         context.history().clearSaved();
67415         modalSelection.remove();
67416       });
67417       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
67418       reset.append("div").call(_t.append("restore.reset"));
67419       restore.node().focus();
67420     };
67421   }
67422   var init_restore = __esm({
67423     "modules/ui/restore.js"() {
67424       "use strict";
67425       init_localizer();
67426       init_modal();
67427     }
67428   });
67429
67430   // modules/ui/scale.js
67431   var scale_exports2 = {};
67432   __export(scale_exports2, {
67433     uiScale: () => uiScale
67434   });
67435   function uiScale(context) {
67436     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
67437     function scaleDefs(loc1, loc2) {
67438       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;
67439       if (isImperial) {
67440         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
67441       } else {
67442         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
67443       }
67444       for (i3 = 0; i3 < buckets.length; i3++) {
67445         val = buckets[i3];
67446         if (dist >= val) {
67447           scale.dist = Math.floor(dist / val) * val;
67448           break;
67449         } else {
67450           scale.dist = +dist.toFixed(2);
67451         }
67452       }
67453       dLon = geoMetersToLon(scale.dist / conversion, lat);
67454       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
67455       scale.text = displayLength(scale.dist / conversion, isImperial);
67456       return scale;
67457     }
67458     function update(selection2) {
67459       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
67460       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
67461       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
67462     }
67463     return function(selection2) {
67464       function switchUnits() {
67465         isImperial = !isImperial;
67466         selection2.call(update);
67467       }
67468       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
67469       scalegroup.append("path").attr("class", "scale-path");
67470       selection2.append("div").attr("class", "scale-text");
67471       selection2.call(update);
67472       context.map().on("move.scale", function() {
67473         update(selection2);
67474       });
67475     };
67476   }
67477   var init_scale2 = __esm({
67478     "modules/ui/scale.js"() {
67479       "use strict";
67480       init_units();
67481       init_geo2();
67482       init_localizer();
67483     }
67484   });
67485
67486   // modules/ui/shortcuts.js
67487   var shortcuts_exports = {};
67488   __export(shortcuts_exports, {
67489     uiShortcuts: () => uiShortcuts
67490   });
67491   function uiShortcuts(context) {
67492     var detected = utilDetect();
67493     var _activeTab = 0;
67494     var _modalSelection;
67495     var _selection = select_default2(null);
67496     var _dataShortcuts;
67497     function shortcutsModal(_modalSelection2) {
67498       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
67499       var content = _modalSelection2.select(".content");
67500       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
67501       _mainFileFetcher.get("shortcuts").then(function(data) {
67502         _dataShortcuts = data;
67503         content.call(render);
67504       }).catch(function() {
67505       });
67506     }
67507     function render(selection2) {
67508       if (!_dataShortcuts) return;
67509       var wrapper = selection2.selectAll(".wrapper").data([0]);
67510       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
67511       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
67512       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
67513       wrapper = wrapper.merge(wrapperEnter);
67514       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
67515       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
67516         d3_event.preventDefault();
67517         var i3 = _dataShortcuts.indexOf(d2);
67518         _activeTab = i3;
67519         render(selection2);
67520       });
67521       tabsEnter.append("span").html(function(d2) {
67522         return _t.html(d2.text);
67523       });
67524       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
67525         return i3 === _activeTab;
67526       });
67527       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
67528       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
67529         return "shortcut-tab shortcut-tab-" + d2.tab;
67530       });
67531       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
67532         return d2.columns;
67533       }).enter().append("table").attr("class", "shortcut-column");
67534       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
67535         return d2.rows;
67536       }).enter().append("tr").attr("class", "shortcut-row");
67537       var sectionRows = rowsEnter.filter(function(d2) {
67538         return !d2.shortcuts;
67539       });
67540       sectionRows.append("td");
67541       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
67542         return _t.html(d2.text);
67543       });
67544       var shortcutRows = rowsEnter.filter(function(d2) {
67545         return d2.shortcuts;
67546       });
67547       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
67548       var modifierKeys = shortcutKeys.filter(function(d2) {
67549         return d2.modifiers;
67550       });
67551       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
67552         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
67553           return ["\u2318"];
67554         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
67555           return [];
67556         } else {
67557           return d2.modifiers;
67558         }
67559       }).enter().each(function() {
67560         var selection3 = select_default2(this);
67561         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
67562           return uiCmd.display(d2);
67563         });
67564         selection3.append("span").text("+");
67565       });
67566       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
67567         var arr = d2.shortcuts;
67568         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
67569           arr = ["Y"];
67570         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
67571           arr = ["F11"];
67572         }
67573         arr = arr.map(function(s2) {
67574           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
67575         });
67576         return utilArrayUniq(arr).map(function(s2) {
67577           return {
67578             shortcut: s2,
67579             separator: d2.separator,
67580             suffix: d2.suffix
67581           };
67582         });
67583       }).enter().each(function(d2, i3, nodes) {
67584         var selection3 = select_default2(this);
67585         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
67586         if (click && click[1]) {
67587           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
67588         } else if (d2.shortcut.toLowerCase() === "long-press") {
67589           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
67590         } else if (d2.shortcut.toLowerCase() === "tap") {
67591           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
67592         } else {
67593           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
67594             return d4.shortcut;
67595           });
67596         }
67597         if (i3 < nodes.length - 1) {
67598           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
67599         } else if (i3 === nodes.length - 1 && d2.suffix) {
67600           selection3.append("span").text(d2.suffix);
67601         }
67602       });
67603       shortcutKeys.filter(function(d2) {
67604         return d2.gesture;
67605       }).each(function() {
67606         var selection3 = select_default2(this);
67607         selection3.append("span").text("+");
67608         selection3.append("span").attr("class", "gesture").html(function(d2) {
67609           return _t.html(d2.gesture);
67610         });
67611       });
67612       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
67613         return d2.text ? _t.html(d2.text) : "\xA0";
67614       });
67615       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
67616         return i3 === _activeTab ? "flex" : "none";
67617       });
67618     }
67619     return function(selection2, show) {
67620       _selection = selection2;
67621       if (show) {
67622         _modalSelection = uiModal(selection2);
67623         _modalSelection.call(shortcutsModal);
67624       } else {
67625         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
67626           if (context.container().selectAll(".modal-shortcuts").size()) {
67627             if (_modalSelection) {
67628               _modalSelection.close();
67629               _modalSelection = null;
67630             }
67631           } else {
67632             _modalSelection = uiModal(_selection);
67633             _modalSelection.call(shortcutsModal);
67634           }
67635         });
67636       }
67637     };
67638   }
67639   var init_shortcuts = __esm({
67640     "modules/ui/shortcuts.js"() {
67641       "use strict";
67642       init_src5();
67643       init_file_fetcher();
67644       init_localizer();
67645       init_icon();
67646       init_cmd();
67647       init_modal();
67648       init_util();
67649       init_detect();
67650     }
67651   });
67652
67653   // modules/ui/data_header.js
67654   var data_header_exports = {};
67655   __export(data_header_exports, {
67656     uiDataHeader: () => uiDataHeader
67657   });
67658   function uiDataHeader() {
67659     var _datum;
67660     function dataHeader(selection2) {
67661       var header = selection2.selectAll(".data-header").data(
67662         _datum ? [_datum] : [],
67663         function(d2) {
67664           return d2.__featurehash__;
67665         }
67666       );
67667       header.exit().remove();
67668       var headerEnter = header.enter().append("div").attr("class", "data-header");
67669       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
67670       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
67671       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
67672     }
67673     dataHeader.datum = function(val) {
67674       if (!arguments.length) return _datum;
67675       _datum = val;
67676       return this;
67677     };
67678     return dataHeader;
67679   }
67680   var init_data_header = __esm({
67681     "modules/ui/data_header.js"() {
67682       "use strict";
67683       init_localizer();
67684       init_icon();
67685     }
67686   });
67687
67688   // modules/ui/disclosure.js
67689   var disclosure_exports = {};
67690   __export(disclosure_exports, {
67691     uiDisclosure: () => uiDisclosure
67692   });
67693   function uiDisclosure(context, key, expandedDefault) {
67694     var dispatch14 = dispatch_default("toggled");
67695     var _expanded;
67696     var _label = utilFunctor("");
67697     var _updatePreference = true;
67698     var _content = function() {
67699     };
67700     var disclosure = function(selection2) {
67701       if (_expanded === void 0 || _expanded === null) {
67702         var preference = corePreferences("disclosure." + key + ".expanded");
67703         _expanded = preference === null ? !!expandedDefault : preference === "true";
67704       }
67705       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
67706       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"));
67707       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
67708       hideToggle = hideToggleEnter.merge(hideToggle);
67709       hideToggle.on("click", toggle).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`)).attr("aria-expanded", _expanded).classed("expanded", _expanded);
67710       const label = _label();
67711       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
67712       if (typeof label !== "function") {
67713         labelSelection.text(_label());
67714       } else {
67715         labelSelection.text("").call(label);
67716       }
67717       hideToggle.selectAll(".hide-toggle-icon").attr(
67718         "xlink:href",
67719         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
67720       );
67721       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
67722       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
67723       if (_expanded) {
67724         wrap2.call(_content);
67725       }
67726       function toggle(d3_event) {
67727         d3_event.preventDefault();
67728         _expanded = !_expanded;
67729         if (_updatePreference) {
67730           corePreferences("disclosure." + key + ".expanded", _expanded);
67731         }
67732         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t(`icons.${_expanded ? "collapse" : "expand"}`));
67733         hideToggle.selectAll(".hide-toggle-icon").attr(
67734           "xlink:href",
67735           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
67736         );
67737         wrap2.call(uiToggle(_expanded));
67738         if (_expanded) {
67739           wrap2.call(_content);
67740         }
67741         dispatch14.call("toggled", this, _expanded);
67742       }
67743     };
67744     disclosure.label = function(val) {
67745       if (!arguments.length) return _label;
67746       _label = utilFunctor(val);
67747       return disclosure;
67748     };
67749     disclosure.expanded = function(val) {
67750       if (!arguments.length) return _expanded;
67751       _expanded = val;
67752       return disclosure;
67753     };
67754     disclosure.updatePreference = function(val) {
67755       if (!arguments.length) return _updatePreference;
67756       _updatePreference = val;
67757       return disclosure;
67758     };
67759     disclosure.content = function(val) {
67760       if (!arguments.length) return _content;
67761       _content = val;
67762       return disclosure;
67763     };
67764     return utilRebind(disclosure, dispatch14, "on");
67765   }
67766   var init_disclosure = __esm({
67767     "modules/ui/disclosure.js"() {
67768       "use strict";
67769       init_src4();
67770       init_preferences();
67771       init_icon();
67772       init_util();
67773       init_rebind();
67774       init_toggle();
67775       init_localizer();
67776     }
67777   });
67778
67779   // modules/ui/section.js
67780   var section_exports = {};
67781   __export(section_exports, {
67782     uiSection: () => uiSection
67783   });
67784   function uiSection(id2, context) {
67785     var _classes = utilFunctor("");
67786     var _shouldDisplay;
67787     var _content;
67788     var _disclosure;
67789     var _label;
67790     var _expandedByDefault = utilFunctor(true);
67791     var _disclosureContent;
67792     var _disclosureExpanded;
67793     var _containerSelection = select_default2(null);
67794     var section = {
67795       id: id2
67796     };
67797     section.classes = function(val) {
67798       if (!arguments.length) return _classes;
67799       _classes = utilFunctor(val);
67800       return section;
67801     };
67802     section.label = function(val) {
67803       if (!arguments.length) return _label;
67804       _label = utilFunctor(val);
67805       return section;
67806     };
67807     section.expandedByDefault = function(val) {
67808       if (!arguments.length) return _expandedByDefault;
67809       _expandedByDefault = utilFunctor(val);
67810       return section;
67811     };
67812     section.shouldDisplay = function(val) {
67813       if (!arguments.length) return _shouldDisplay;
67814       _shouldDisplay = utilFunctor(val);
67815       return section;
67816     };
67817     section.content = function(val) {
67818       if (!arguments.length) return _content;
67819       _content = val;
67820       return section;
67821     };
67822     section.disclosureContent = function(val) {
67823       if (!arguments.length) return _disclosureContent;
67824       _disclosureContent = val;
67825       return section;
67826     };
67827     section.disclosureExpanded = function(val) {
67828       if (!arguments.length) return _disclosureExpanded;
67829       _disclosureExpanded = val;
67830       return section;
67831     };
67832     section.render = function(selection2) {
67833       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
67834       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
67835       _containerSelection = sectionEnter.merge(_containerSelection);
67836       _containerSelection.call(renderContent);
67837     };
67838     section.reRender = function() {
67839       _containerSelection.call(renderContent);
67840     };
67841     section.selection = function() {
67842       return _containerSelection;
67843     };
67844     section.disclosure = function() {
67845       return _disclosure;
67846     };
67847     function renderContent(selection2) {
67848       if (_shouldDisplay) {
67849         var shouldDisplay = _shouldDisplay();
67850         selection2.classed("hide", !shouldDisplay);
67851         if (!shouldDisplay) {
67852           selection2.html("");
67853           return;
67854         }
67855       }
67856       if (_disclosureContent) {
67857         if (!_disclosure) {
67858           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
67859         }
67860         if (_disclosureExpanded !== void 0) {
67861           _disclosure.expanded(_disclosureExpanded);
67862           _disclosureExpanded = void 0;
67863         }
67864         selection2.call(_disclosure);
67865         return;
67866       }
67867       if (_content) {
67868         selection2.call(_content);
67869       }
67870     }
67871     return section;
67872   }
67873   var init_section = __esm({
67874     "modules/ui/section.js"() {
67875       "use strict";
67876       init_src5();
67877       init_disclosure();
67878       init_util();
67879     }
67880   });
67881
67882   // modules/ui/tag_reference.js
67883   var tag_reference_exports = {};
67884   __export(tag_reference_exports, {
67885     uiTagReference: () => uiTagReference
67886   });
67887   function uiTagReference(what) {
67888     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
67889     var tagReference = {};
67890     var _button = select_default2(null);
67891     var _body = select_default2(null);
67892     var _loaded;
67893     var _showing;
67894     function load() {
67895       if (!wikibase) return;
67896       _button.classed("tag-reference-loading", true);
67897       wikibase.getDocs(what, gotDocs);
67898     }
67899     function gotDocs(err, docs) {
67900       _body.html("");
67901       if (!docs || !docs.title) {
67902         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
67903         done();
67904         return;
67905       }
67906       if (docs.imageURL) {
67907         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.title).attr("src", docs.imageURL).on("load", function() {
67908           done();
67909         }).on("error", function() {
67910           select_default2(this).remove();
67911           done();
67912         });
67913       } else {
67914         done();
67915       }
67916       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
67917       if (docs.description) {
67918         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").call(docs.description);
67919       } else {
67920         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
67921       }
67922       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"));
67923       if (docs.wiki) {
67924         _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));
67925       }
67926       if (what.key === "comment") {
67927         _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"));
67928       }
67929     }
67930     function done() {
67931       _loaded = true;
67932       _button.classed("tag-reference-loading", false);
67933       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
67934       _showing = true;
67935       _button.selectAll("svg.icon use").each(function() {
67936         var iconUse = select_default2(this);
67937         if (iconUse.attr("href") === "#iD-icon-info") {
67938           iconUse.attr("href", "#iD-icon-info-filled");
67939         }
67940       });
67941     }
67942     function hide() {
67943       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
67944         _body.classed("expanded", false);
67945       });
67946       _showing = false;
67947       _button.selectAll("svg.icon use").each(function() {
67948         var iconUse = select_default2(this);
67949         if (iconUse.attr("href") === "#iD-icon-info-filled") {
67950           iconUse.attr("href", "#iD-icon-info");
67951         }
67952       });
67953     }
67954     tagReference.button = function(selection2, klass, iconName) {
67955       _button = selection2.selectAll(".tag-reference-button").data([0]);
67956       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
67957       _button.on("click", function(d3_event) {
67958         d3_event.stopPropagation();
67959         d3_event.preventDefault();
67960         this.blur();
67961         if (_showing) {
67962           hide();
67963         } else if (_loaded) {
67964           done();
67965         } else {
67966           load();
67967         }
67968       });
67969     };
67970     tagReference.body = function(selection2) {
67971       var itemID = what.qid || what.key + "-" + (what.value || "");
67972       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
67973         return d2;
67974       });
67975       _body.exit().remove();
67976       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
67977       if (_showing === false) {
67978         hide();
67979       }
67980     };
67981     tagReference.showing = function(val) {
67982       if (!arguments.length) return _showing;
67983       _showing = val;
67984       return tagReference;
67985     };
67986     return tagReference;
67987   }
67988   var init_tag_reference = __esm({
67989     "modules/ui/tag_reference.js"() {
67990       "use strict";
67991       init_src5();
67992       init_localizer();
67993       init_services();
67994       init_icon();
67995     }
67996   });
67997
67998   // modules/ui/sections/raw_tag_editor.js
67999   var raw_tag_editor_exports = {};
68000   __export(raw_tag_editor_exports, {
68001     uiSectionRawTagEditor: () => uiSectionRawTagEditor
68002   });
68003   function uiSectionRawTagEditor(id2, context) {
68004     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
68005       var count = Object.keys(_tags).filter(function(d2) {
68006         return d2;
68007       }).length;
68008       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
68009     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
68010     var taginfo = services.taginfo;
68011     var dispatch14 = dispatch_default("change");
68012     var availableViews = [
68013       { id: "list", icon: "#fas-th-list" },
68014       { id: "text", icon: "#fas-i-cursor" }
68015     ];
68016     let _discardTags = {};
68017     _mainFileFetcher.get("discarded").then((d2) => {
68018       _discardTags = d2;
68019     }).catch(() => {
68020     });
68021     var _tagView = corePreferences("raw-tag-editor-view") || "list";
68022     var _readOnlyTags = [];
68023     var _orderedKeys = [];
68024     var _showBlank = false;
68025     var _pendingChange = null;
68026     var _state;
68027     var _presets;
68028     var _tags;
68029     var _entityIDs;
68030     var _didInteract = false;
68031     function interacted() {
68032       _didInteract = true;
68033     }
68034     function renderDisclosureContent(wrap2) {
68035       _orderedKeys = _orderedKeys.filter(function(key) {
68036         return _tags[key] !== void 0;
68037       });
68038       var all = Object.keys(_tags).sort();
68039       var missingKeys = utilArrayDifference(all, _orderedKeys);
68040       for (var i3 in missingKeys) {
68041         _orderedKeys.push(missingKeys[i3]);
68042       }
68043       var rowData = _orderedKeys.map(function(key, i4) {
68044         return { index: i4, key, value: _tags[key] };
68045       });
68046       if (!rowData.length || _showBlank) {
68047         _showBlank = false;
68048         rowData.push({ index: rowData.length, key: "", value: "" });
68049       }
68050       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
68051       options2.exit().remove();
68052       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
68053       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
68054         return d2.id;
68055       }).enter();
68056       optionEnter.append("button").attr("class", function(d2) {
68057         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
68058       }).attr("aria-selected", function(d2) {
68059         return _tagView === d2.id;
68060       }).attr("role", "tab").attr("title", function(d2) {
68061         return _t("icons." + d2.id);
68062       }).on("click", function(d3_event, d2) {
68063         _tagView = d2.id;
68064         corePreferences("raw-tag-editor-view", d2.id);
68065         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
68066           return datum2 === d2;
68067         }).attr("aria-selected", function(datum2) {
68068           return datum2 === d2;
68069         });
68070         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
68071         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
68072       }).each(function(d2) {
68073         select_default2(this).call(svgIcon(d2.icon));
68074       });
68075       var textData = rowsToText(rowData);
68076       var textarea = wrap2.selectAll(".tag-text").data([0]);
68077       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);
68078       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
68079       var list2 = wrap2.selectAll(".tag-list").data([0]);
68080       list2 = list2.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list2);
68081       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
68082       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);
68083       addRowEnter.append("div").attr("class", "space-value");
68084       addRowEnter.append("div").attr("class", "space-buttons");
68085       var items = list2.selectAll(".tag-row").data(rowData, function(d2) {
68086         return d2.key;
68087       });
68088       items.exit().each(unbind).remove();
68089       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
68090       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
68091       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);
68092       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);
68093       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
68094       items = items.merge(itemsEnter).sort(function(a2, b2) {
68095         return a2.index - b2.index;
68096       });
68097       items.each(function(d2) {
68098         var row = select_default2(this);
68099         var key = row.select("input.key");
68100         var value = row.select("input.value");
68101         if (_entityIDs && taginfo && _state !== "hover") {
68102           bindTypeahead(key, value);
68103         }
68104         var referenceOptions = { key: d2.key };
68105         if (typeof d2.value === "string") {
68106           referenceOptions.value = d2.value;
68107         }
68108         var reference = uiTagReference(referenceOptions, context);
68109         if (_state === "hover") {
68110           reference.showing(false);
68111         }
68112         row.select(".inner-wrap").call(reference.button);
68113         row.call(reference.body);
68114         row.select("button.remove");
68115       });
68116       items.selectAll("input.key").attr("title", function(d2) {
68117         return d2.key;
68118       }).call(utilGetSetValue, function(d2) {
68119         return d2.key;
68120       }).attr("readonly", function(d2) {
68121         return isReadOnly(d2) || null;
68122       });
68123       items.selectAll("input.value").attr("title", function(d2) {
68124         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
68125       }).classed("mixed", function(d2) {
68126         return Array.isArray(d2.value);
68127       }).attr("placeholder", function(d2) {
68128         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
68129       }).call(utilGetSetValue, function(d2) {
68130         return typeof d2.value === "string" ? d2.value : "";
68131       }).attr("readonly", function(d2) {
68132         return isReadOnly(d2) || null;
68133       });
68134       items.selectAll("button.remove").on(
68135         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
68136         // 'click' fires too late - #5878
68137         (d3_event, d2) => {
68138           if (d3_event.button !== 0) return;
68139           removeTag(d3_event, d2);
68140         }
68141       );
68142     }
68143     function isReadOnly(d2) {
68144       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
68145         if (d2.key.match(_readOnlyTags[i3]) !== null) {
68146           return true;
68147         }
68148       }
68149       return false;
68150     }
68151     function setTextareaHeight() {
68152       if (_tagView !== "text") return;
68153       var selection2 = select_default2(this);
68154       var matches = selection2.node().value.match(/\n/g);
68155       var lineCount = 2 + Number(matches && matches.length);
68156       var lineHeight = 20;
68157       selection2.style("height", lineCount * lineHeight + "px");
68158     }
68159     function stringify3(s2) {
68160       const stringified = JSON.stringify(s2).slice(1, -1);
68161       if (stringified !== s2) {
68162         return `"${stringified}"`;
68163       } else {
68164         return s2;
68165       }
68166     }
68167     function unstringify(s2) {
68168       const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
68169       if (isQuoted) {
68170         try {
68171           return JSON.parse(s2);
68172         } catch {
68173           return s2;
68174         }
68175       } else {
68176         return s2;
68177       }
68178     }
68179     function rowsToText(rows) {
68180       var str = rows.filter(function(row) {
68181         return row.key && row.key.trim() !== "";
68182       }).map(function(row) {
68183         var rawVal = row.value;
68184         if (typeof rawVal !== "string") rawVal = "*";
68185         var val = rawVal ? stringify3(rawVal) : "";
68186         return stringify3(row.key) + "=" + val;
68187       }).join("\n");
68188       if (_state !== "hover" && str.length) {
68189         return str + "\n";
68190       }
68191       return str;
68192     }
68193     function textChanged() {
68194       var newText = this.value.trim();
68195       var newTags = {};
68196       newText.split("\n").forEach(function(row) {
68197         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
68198         if (m2 !== null) {
68199           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
68200           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
68201           newTags[k2] = v2;
68202         }
68203       });
68204       var tagDiff = utilTagDiff(_tags, newTags);
68205       _pendingChange = _pendingChange || {};
68206       tagDiff.forEach(function(change) {
68207         if (isReadOnly({ key: change.key })) return;
68208         if (change.newVal === "*" && typeof change.oldVal !== "string") return;
68209         if (change.type === "-") {
68210           _pendingChange[change.key] = void 0;
68211         } else if (change.type === "+") {
68212           _pendingChange[change.key] = change.newVal || "";
68213         }
68214       });
68215       if (Object.keys(_pendingChange).length === 0) {
68216         _pendingChange = null;
68217         section.reRender();
68218         return;
68219       }
68220       scheduleChange();
68221     }
68222     function pushMore(d3_event) {
68223       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
68224         addTag();
68225       }
68226     }
68227     function bindTypeahead(key, value) {
68228       if (isReadOnly(key.datum())) return;
68229       if (Array.isArray(value.datum().value)) {
68230         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
68231           var keyString = utilGetSetValue(key);
68232           if (!_tags[keyString]) return;
68233           var data = _tags[keyString].map(function(tagValue) {
68234             if (!tagValue) {
68235               return {
68236                 value: " ",
68237                 title: _t("inspector.empty"),
68238                 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
68239               };
68240             }
68241             return {
68242               value: tagValue,
68243               title: tagValue
68244             };
68245           });
68246           callback(data);
68247         }));
68248         return;
68249       }
68250       var geometry = context.graph().geometry(_entityIDs[0]);
68251       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
68252         taginfo.keys({
68253           debounce: true,
68254           geometry,
68255           query: value2
68256         }, function(err, data) {
68257           if (!err) {
68258             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => !/_\d$/.test(d2)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
68259             callback(sort(value2, filtered));
68260           }
68261         });
68262       }));
68263       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
68264         taginfo.values({
68265           debounce: true,
68266           key: utilGetSetValue(key),
68267           geometry,
68268           query: value2
68269         }, function(err, data) {
68270           if (!err) {
68271             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
68272             callback(sort(value2, filtered));
68273           }
68274         });
68275       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
68276       function sort(value2, data) {
68277         var sameletter = [];
68278         var other2 = [];
68279         for (var i3 = 0; i3 < data.length; i3++) {
68280           if (data[i3].value.substring(0, value2.length) === value2) {
68281             sameletter.push(data[i3]);
68282           } else {
68283             other2.push(data[i3]);
68284           }
68285         }
68286         return sameletter.concat(other2);
68287       }
68288     }
68289     function unbind() {
68290       var row = select_default2(this);
68291       row.selectAll("input.key").call(uiCombobox.off, context);
68292       row.selectAll("input.value").call(uiCombobox.off, context);
68293     }
68294     function keyChange(d3_event, d2) {
68295       if (select_default2(this).attr("readonly")) return;
68296       var kOld = d2.key;
68297       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
68298       var kNew = context.cleanTagKey(this.value.trim());
68299       if (isReadOnly({ key: kNew })) {
68300         this.value = kOld;
68301         return;
68302       }
68303       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
68304         this.value = kOld;
68305         section.selection().selectAll(".tag-list input.value").each(function(d4) {
68306           if (d4.key === kNew) {
68307             var input = select_default2(this).node();
68308             input.focus();
68309             input.select();
68310           }
68311         });
68312         return;
68313       }
68314       _pendingChange = _pendingChange || {};
68315       if (kOld) {
68316         if (kOld === kNew) return;
68317         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
68318         _pendingChange[kOld] = void 0;
68319       } else {
68320         let row = this.parentNode.parentNode;
68321         let inputVal = select_default2(row).selectAll("input.value");
68322         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
68323         _pendingChange[kNew] = vNew;
68324         utilGetSetValue(inputVal, vNew);
68325       }
68326       var existingKeyIndex = _orderedKeys.indexOf(kOld);
68327       if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
68328       d2.key = kNew;
68329       this.value = kNew;
68330       scheduleChange();
68331     }
68332     function valueChange(d3_event, d2) {
68333       if (isReadOnly(d2)) return;
68334       if (typeof d2.value !== "string" && !this.value) return;
68335       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
68336       _pendingChange = _pendingChange || {};
68337       _pendingChange[d2.key] = context.cleanTagValue(this.value);
68338       scheduleChange();
68339     }
68340     function removeTag(d3_event, d2) {
68341       if (isReadOnly(d2)) return;
68342       if (d2.key === "") {
68343         _showBlank = false;
68344         section.reRender();
68345       } else {
68346         _orderedKeys = _orderedKeys.filter(function(key) {
68347           return key !== d2.key;
68348         });
68349         _pendingChange = _pendingChange || {};
68350         _pendingChange[d2.key] = void 0;
68351         scheduleChange();
68352       }
68353     }
68354     function addTag() {
68355       window.setTimeout(function() {
68356         _showBlank = true;
68357         section.reRender();
68358         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
68359       }, 20);
68360     }
68361     function scheduleChange() {
68362       var entityIDs = _entityIDs;
68363       window.setTimeout(function() {
68364         if (!_pendingChange) return;
68365         dispatch14.call("change", this, entityIDs, _pendingChange);
68366         _pendingChange = null;
68367       }, 10);
68368     }
68369     section.state = function(val) {
68370       if (!arguments.length) return _state;
68371       if (_state !== val) {
68372         _orderedKeys = [];
68373         _state = val;
68374       }
68375       return section;
68376     };
68377     section.presets = function(val) {
68378       if (!arguments.length) return _presets;
68379       _presets = val;
68380       if (_presets && _presets.length && _presets[0].isFallback()) {
68381         section.disclosureExpanded(true);
68382       } else if (!_didInteract) {
68383         section.disclosureExpanded(null);
68384       }
68385       return section;
68386     };
68387     section.tags = function(val) {
68388       if (!arguments.length) return _tags;
68389       _tags = val;
68390       return section;
68391     };
68392     section.entityIDs = function(val) {
68393       if (!arguments.length) return _entityIDs;
68394       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
68395         _entityIDs = val;
68396         _orderedKeys = [];
68397       }
68398       return section;
68399     };
68400     section.readOnlyTags = function(val) {
68401       if (!arguments.length) return _readOnlyTags;
68402       _readOnlyTags = val;
68403       return section;
68404     };
68405     return utilRebind(section, dispatch14, "on");
68406   }
68407   var init_raw_tag_editor = __esm({
68408     "modules/ui/sections/raw_tag_editor.js"() {
68409       "use strict";
68410       init_src4();
68411       init_src5();
68412       init_services();
68413       init_icon();
68414       init_combobox();
68415       init_section();
68416       init_tag_reference();
68417       init_preferences();
68418       init_localizer();
68419       init_array3();
68420       init_util();
68421       init_ui();
68422       init_tags();
68423       init_core();
68424     }
68425   });
68426
68427   // modules/ui/data_editor.js
68428   var data_editor_exports = {};
68429   __export(data_editor_exports, {
68430     uiDataEditor: () => uiDataEditor
68431   });
68432   function uiDataEditor(context) {
68433     var dataHeader = uiDataHeader();
68434     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
68435     var _datum;
68436     function dataEditor(selection2) {
68437       var header = selection2.selectAll(".header").data([0]);
68438       var headerEnter = header.enter().append("div").attr("class", "header fillL");
68439       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
68440         context.enter(modeBrowse(context));
68441       }).call(svgIcon("#iD-icon-close"));
68442       headerEnter.append("h2").call(_t.append("map_data.title"));
68443       var body = selection2.selectAll(".body").data([0]);
68444       body = body.enter().append("div").attr("class", "body").merge(body);
68445       var editor = body.selectAll(".data-editor").data([0]);
68446       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
68447       var rte = body.selectAll(".raw-tag-editor").data([0]);
68448       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
68449         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
68450       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
68451     }
68452     dataEditor.datum = function(val) {
68453       if (!arguments.length) return _datum;
68454       _datum = val;
68455       return this;
68456     };
68457     return dataEditor;
68458   }
68459   var init_data_editor = __esm({
68460     "modules/ui/data_editor.js"() {
68461       "use strict";
68462       init_localizer();
68463       init_browse();
68464       init_icon();
68465       init_data_header();
68466       init_raw_tag_editor();
68467     }
68468   });
68469
68470   // node_modules/@mapbox/sexagesimal/index.js
68471   var require_sexagesimal = __commonJS({
68472     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
68473       module2.exports = element;
68474       module2.exports.pair = pair3;
68475       module2.exports.format = format2;
68476       module2.exports.formatPair = formatPair;
68477       module2.exports.coordToDMS = coordToDMS;
68478       function element(input, dims) {
68479         var result = search(input, dims);
68480         return result === null ? null : result.val;
68481       }
68482       function formatPair(input) {
68483         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
68484       }
68485       function format2(input, dim) {
68486         var dms = coordToDMS(input, dim);
68487         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
68488       }
68489       function coordToDMS(input, dim) {
68490         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
68491         var dir = dirs[input >= 0 ? 0 : 1];
68492         var abs3 = Math.abs(input);
68493         var whole = Math.floor(abs3);
68494         var fraction = abs3 - whole;
68495         var fractionMinutes = fraction * 60;
68496         var minutes = Math.floor(fractionMinutes);
68497         var seconds = Math.floor((fractionMinutes - minutes) * 60);
68498         return {
68499           whole,
68500           minutes,
68501           seconds,
68502           dir
68503         };
68504       }
68505       function search(input, dims) {
68506         if (!dims) dims = "NSEW";
68507         if (typeof input !== "string") return null;
68508         input = input.toUpperCase();
68509         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
68510         var m2 = input.match(regex);
68511         if (!m2) return null;
68512         var matched = m2[0];
68513         var dim;
68514         if (m2[1] && m2[5]) {
68515           dim = m2[1];
68516           matched = matched.slice(0, -1);
68517         } else {
68518           dim = m2[1] || m2[5];
68519         }
68520         if (dim && dims.indexOf(dim) === -1) return null;
68521         var deg = m2[2] ? parseFloat(m2[2]) : 0;
68522         var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
68523         var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
68524         var sign2 = deg < 0 ? -1 : 1;
68525         if (dim === "S" || dim === "W") sign2 *= -1;
68526         return {
68527           val: (Math.abs(deg) + min3 + sec) * sign2,
68528           dim,
68529           matched,
68530           remain: input.slice(matched.length)
68531         };
68532       }
68533       function pair3(input, dims) {
68534         input = input.trim();
68535         var one2 = search(input, dims);
68536         if (!one2) return null;
68537         input = one2.remain.trim();
68538         var two = search(input, dims);
68539         if (!two || two.remain) return null;
68540         if (one2.dim) {
68541           return swapdim(one2.val, two.val, one2.dim);
68542         } else {
68543           return [one2.val, two.val];
68544         }
68545       }
68546       function swapdim(a2, b2, dim) {
68547         if (dim === "N" || dim === "S") return [a2, b2];
68548         if (dim === "W" || dim === "E") return [b2, a2];
68549       }
68550     }
68551   });
68552
68553   // modules/ui/feature_list.js
68554   var feature_list_exports = {};
68555   __export(feature_list_exports, {
68556     uiFeatureList: () => uiFeatureList
68557   });
68558   function uiFeatureList(context) {
68559     var _geocodeResults;
68560     function featureList(selection2) {
68561       var header = selection2.append("div").attr("class", "header fillL");
68562       header.append("h2").call(_t.append("inspector.feature_list"));
68563       var searchWrap = selection2.append("div").attr("class", "search-header");
68564       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68565       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
68566       var listWrap = selection2.append("div").attr("class", "inspector-body");
68567       var list2 = listWrap.append("div").attr("class", "feature-list");
68568       context.on("exit.feature-list", clearSearch);
68569       context.map().on("drawn.feature-list", mapDrawn);
68570       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
68571       function focusSearch(d3_event) {
68572         var mode = context.mode() && context.mode().id;
68573         if (mode !== "browse") return;
68574         d3_event.preventDefault();
68575         search.node().focus();
68576       }
68577       function keydown(d3_event) {
68578         if (d3_event.keyCode === 27) {
68579           search.node().blur();
68580         }
68581       }
68582       function keypress(d3_event) {
68583         var q2 = search.property("value"), items = list2.selectAll(".feature-list-item");
68584         if (d3_event.keyCode === 13 && // ↩ Return
68585         q2.length && items.size()) {
68586           click(d3_event, items.datum());
68587         }
68588       }
68589       function inputevent() {
68590         _geocodeResults = void 0;
68591         drawList();
68592       }
68593       function clearSearch() {
68594         search.property("value", "");
68595         drawList();
68596       }
68597       function mapDrawn(e3) {
68598         if (e3.full) {
68599           drawList();
68600         }
68601       }
68602       function features() {
68603         var graph = context.graph();
68604         var visibleCenter = context.map().extent().center();
68605         var q2 = search.property("value").toLowerCase().trim();
68606         if (!q2) return [];
68607         const locationMatch = sexagesimal.pair(q2.toUpperCase()) || dmsMatcher(q2);
68608         const coordResult = [];
68609         if (locationMatch) {
68610           const latLon = [Number(locationMatch[0]), Number(locationMatch[1])];
68611           const lonLat = [latLon[1], latLon[0]];
68612           const isLatLonValid = latLon[0] >= -90 && latLon[0] <= 90 && latLon[1] >= -180 && latLon[1] <= 180;
68613           let isLonLatValid = lonLat[0] >= -90 && lonLat[0] <= 90 && lonLat[1] >= -180 && lonLat[1] <= 180;
68614           isLonLatValid && (isLonLatValid = !q2.match(/[NSEW]/i));
68615           isLonLatValid && (isLonLatValid = !locationMatch[2]);
68616           isLonLatValid && (isLonLatValid = lonLat[0] !== lonLat[1]);
68617           if (isLatLonValid) {
68618             coordResult.push({
68619               id: latLon[0] + "/" + latLon[1],
68620               geometry: "point",
68621               type: _t("inspector.location"),
68622               name: dmsCoordinatePair([latLon[1], latLon[0]]),
68623               location: latLon,
68624               zoom: locationMatch[2]
68625             });
68626           }
68627           if (isLonLatValid) {
68628             coordResult.push({
68629               id: lonLat[0] + "/" + lonLat[1],
68630               geometry: "point",
68631               type: _t("inspector.location"),
68632               name: dmsCoordinatePair([lonLat[1], lonLat[0]]),
68633               location: lonLat
68634             });
68635           }
68636         }
68637         const idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
68638         const idResult = [];
68639         if (idMatch) {
68640           var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
68641           var elemId = idMatch[2];
68642           idResult.push({
68643             id: elemType + elemId,
68644             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
68645             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
68646             name: elemId
68647           });
68648         }
68649         var allEntities = graph.entities;
68650         const localResults = [];
68651         for (var id2 in allEntities) {
68652           var entity = allEntities[id2];
68653           if (!entity) continue;
68654           var name = utilDisplayName(entity) || "";
68655           if (name.toLowerCase().indexOf(q2) < 0) continue;
68656           var matched = _mainPresetIndex.match(entity, graph);
68657           var type2 = matched && matched.name() || utilDisplayType(entity.id);
68658           var extent = entity.extent(graph);
68659           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
68660           localResults.push({
68661             id: entity.id,
68662             entity,
68663             geometry: entity.geometry(graph),
68664             type: type2,
68665             name,
68666             distance
68667           });
68668           if (localResults.length > 100) break;
68669         }
68670         localResults.sort((a2, b2) => a2.distance - b2.distance);
68671         const geocodeResults = [];
68672         (_geocodeResults || []).forEach(function(d2) {
68673           if (d2.osm_type && d2.osm_id) {
68674             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
68675             var tags = {};
68676             tags[d2.class] = d2.type;
68677             var attrs = { id: id3, type: d2.osm_type, tags };
68678             if (d2.osm_type === "way") {
68679               attrs.nodes = ["a", "a"];
68680             }
68681             var tempEntity = osmEntity(attrs);
68682             var tempGraph = coreGraph([tempEntity]);
68683             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
68684             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
68685             geocodeResults.push({
68686               id: tempEntity.id,
68687               geometry: tempEntity.geometry(tempGraph),
68688               type: type3,
68689               name: d2.display_name,
68690               extent: new geoExtent(
68691                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
68692                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
68693               )
68694             });
68695           }
68696         });
68697         const extraResults = [];
68698         if (q2.match(/^[0-9]+$/)) {
68699           extraResults.push({
68700             id: "n" + q2,
68701             geometry: "point",
68702             type: _t("inspector.node"),
68703             name: q2
68704           });
68705           extraResults.push({
68706             id: "w" + q2,
68707             geometry: "line",
68708             type: _t("inspector.way"),
68709             name: q2
68710           });
68711           extraResults.push({
68712             id: "r" + q2,
68713             geometry: "relation",
68714             type: _t("inspector.relation"),
68715             name: q2
68716           });
68717           extraResults.push({
68718             id: "note" + q2,
68719             geometry: "note",
68720             type: _t("note.note"),
68721             name: q2
68722           });
68723         }
68724         return [...idResult, ...localResults, ...coordResult, ...geocodeResults, ...extraResults];
68725       }
68726       function drawList() {
68727         var value = search.property("value");
68728         var results = features();
68729         list2.classed("filtered", value.length);
68730         var resultsIndicator = list2.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
68731         resultsIndicator.append("span").attr("class", "entity-name");
68732         list2.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
68733         if (services.geocoder) {
68734           list2.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
68735         }
68736         list2.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
68737         list2.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
68738         var items = list2.selectAll(".feature-list-item").data(results, function(d2) {
68739           return d2.id;
68740         });
68741         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("pointerenter", mouseover).on("pointerleave", mouseout).on("focus", mouseover).on("blur", mouseout).on("click", click);
68742         var label = enter.append("div").attr("class", "label");
68743         label.each(function(d2) {
68744           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
68745         });
68746         label.append("span").attr("class", "entity-type").text(function(d2) {
68747           return d2.type;
68748         });
68749         label.append("span").attr("class", "entity-name").classed("has-colour", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour && isColourValid(d2.entity.tags.colour)).style("border-color", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour).text(function(d2) {
68750           return d2.name;
68751         });
68752         enter.style("opacity", 0).transition().style("opacity", 1);
68753         items.exit().each((d2) => mouseout(void 0, d2)).remove();
68754         items.merge(enter).order();
68755       }
68756       function mouseover(d3_event, d2) {
68757         if (d2.location !== void 0) return;
68758         utilHighlightEntities([d2.id], true, context);
68759       }
68760       function mouseout(d3_event, d2) {
68761         if (d2.location !== void 0) return;
68762         utilHighlightEntities([d2.id], false, context);
68763       }
68764       function click(d3_event, d2) {
68765         d3_event.preventDefault();
68766         if (d2.location) {
68767           context.map().centerZoomEase([d2.location[1], d2.location[0]], d2.zoom || 19);
68768         } else if (d2.entity) {
68769           utilHighlightEntities([d2.id], false, context);
68770           context.enter(modeSelect(context, [d2.entity.id]));
68771           context.map().zoomToEase(d2.entity);
68772         } else if (d2.geometry === "note") {
68773           const noteId = d2.id.replace(/\D/g, "");
68774           context.moveToNote(noteId);
68775         } else {
68776           context.zoomToEntity(d2.id);
68777         }
68778       }
68779       function geocoderSearch() {
68780         services.geocoder.search(search.property("value"), function(err, resp) {
68781           _geocodeResults = resp || [];
68782           drawList();
68783         });
68784       }
68785     }
68786     return featureList;
68787   }
68788   var sexagesimal;
68789   var init_feature_list = __esm({
68790     "modules/ui/feature_list.js"() {
68791       "use strict";
68792       init_src5();
68793       sexagesimal = __toESM(require_sexagesimal());
68794       init_presets();
68795       init_localizer();
68796       init_units();
68797       init_graph();
68798       init_geo();
68799       init_geo2();
68800       init_select5();
68801       init_entity();
68802       init_tags();
68803       init_services();
68804       init_icon();
68805       init_cmd();
68806       init_util();
68807     }
68808   });
68809
68810   // modules/ui/sections/entity_issues.js
68811   var entity_issues_exports = {};
68812   __export(entity_issues_exports, {
68813     uiSectionEntityIssues: () => uiSectionEntityIssues
68814   });
68815   function uiSectionEntityIssues(context) {
68816     var preference = corePreferences("entity-issues.reference.expanded");
68817     var _expanded = preference === null ? true : preference === "true";
68818     var _entityIDs = [];
68819     var _issues = [];
68820     var _activeIssueID;
68821     var section = uiSection("entity-issues", context).shouldDisplay(function() {
68822       return _issues.length > 0;
68823     }).label(function() {
68824       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
68825     }).disclosureContent(renderDisclosureContent);
68826     context.validator().on("validated.entity_issues", function() {
68827       reloadIssues();
68828       section.reRender();
68829     }).on("focusedIssue.entity_issues", function(issue) {
68830       makeActiveIssue(issue.id);
68831     });
68832     function reloadIssues() {
68833       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
68834     }
68835     function makeActiveIssue(issueID) {
68836       _activeIssueID = issueID;
68837       section.selection().selectAll(".issue-container").classed("active", function(d2) {
68838         return d2.id === _activeIssueID;
68839       });
68840     }
68841     function renderDisclosureContent(selection2) {
68842       selection2.classed("grouped-items-area", true);
68843       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
68844       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
68845         return d2.key;
68846       });
68847       containers.exit().remove();
68848       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
68849       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
68850         return "issue severity-" + d2.severity;
68851       }).on("mouseover.highlight", function(d3_event, d2) {
68852         var ids = d2.entityIds.filter(function(e3) {
68853           return _entityIDs.indexOf(e3) === -1;
68854         });
68855         utilHighlightEntities(ids, true, context);
68856       }).on("mouseout.highlight", function(d3_event, d2) {
68857         var ids = d2.entityIds.filter(function(e3) {
68858           return _entityIDs.indexOf(e3) === -1;
68859         });
68860         utilHighlightEntities(ids, false, context);
68861       });
68862       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
68863       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
68864         makeActiveIssue(d2.id);
68865         var extent = d2.extent(context.graph());
68866         if (extent) {
68867           var setZoom = Math.max(context.map().zoom(), 19);
68868           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
68869         }
68870       });
68871       textEnter.each(function(d2) {
68872         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
68873         select_default2(this).call(svgIcon(iconName, "issue-icon"));
68874       });
68875       textEnter.append("span").attr("class", "issue-message");
68876       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
68877       infoButton.on("click", function(d3_event) {
68878         d3_event.stopPropagation();
68879         d3_event.preventDefault();
68880         this.blur();
68881         var container = select_default2(this.parentNode.parentNode.parentNode);
68882         var info = container.selectAll(".issue-info");
68883         var isExpanded = info.classed("expanded");
68884         _expanded = !isExpanded;
68885         corePreferences("entity-issues.reference.expanded", _expanded);
68886         if (isExpanded) {
68887           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
68888             info.classed("expanded", false);
68889           });
68890         } else {
68891           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
68892             info.style("max-height", null);
68893           });
68894         }
68895       });
68896       itemsEnter.append("ul").attr("class", "issue-fix-list");
68897       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
68898         if (typeof d2.reference === "function") {
68899           select_default2(this).call(d2.reference);
68900         } else {
68901           select_default2(this).call(_t.append("inspector.no_documentation_key"));
68902         }
68903       });
68904       containers = containers.merge(containersEnter).classed("active", function(d2) {
68905         return d2.id === _activeIssueID;
68906       });
68907       containers.selectAll(".issue-message").text("").each(function(d2) {
68908         return d2.message(context)(select_default2(this));
68909       });
68910       var fixLists = containers.selectAll(".issue-fix-list");
68911       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
68912         return d2.fixes ? d2.fixes(context) : [];
68913       }, function(fix) {
68914         return fix.id;
68915       });
68916       fixes.exit().remove();
68917       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
68918       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
68919         if (select_default2(this).attr("disabled") || !d2.onClick) return;
68920         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
68921         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
68922         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
68923         new Promise(function(resolve, reject) {
68924           d2.onClick(context, resolve, reject);
68925           if (d2.onClick.length <= 1) {
68926             resolve();
68927           }
68928         }).then(function() {
68929           context.validator().validate();
68930         });
68931       }).on("mouseover.highlight", function(d3_event, d2) {
68932         utilHighlightEntities(d2.entityIds, true, context);
68933       }).on("mouseout.highlight", function(d3_event, d2) {
68934         utilHighlightEntities(d2.entityIds, false, context);
68935       });
68936       buttons.each(function(d2) {
68937         var iconName = d2.icon || "iD-icon-wrench";
68938         if (iconName.startsWith("maki")) {
68939           iconName += "-15";
68940         }
68941         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
68942       });
68943       buttons.append("span").attr("class", "fix-message").each(function(d2) {
68944         return d2.title(select_default2(this));
68945       });
68946       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
68947         return d2.onClick;
68948       }).attr("disabled", function(d2) {
68949         return d2.onClick ? null : "true";
68950       }).attr("title", function(d2) {
68951         if (d2.disabledReason) {
68952           return d2.disabledReason;
68953         }
68954         return null;
68955       });
68956     }
68957     section.entityIDs = function(val) {
68958       if (!arguments.length) return _entityIDs;
68959       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
68960         _entityIDs = val;
68961         _activeIssueID = null;
68962         reloadIssues();
68963       }
68964       return section;
68965     };
68966     return section;
68967   }
68968   var init_entity_issues = __esm({
68969     "modules/ui/sections/entity_issues.js"() {
68970       "use strict";
68971       init_src5();
68972       init_preferences();
68973       init_icon();
68974       init_array3();
68975       init_localizer();
68976       init_util();
68977       init_section();
68978     }
68979   });
68980
68981   // modules/ui/preset_icon.js
68982   var preset_icon_exports = {};
68983   __export(preset_icon_exports, {
68984     uiPresetIcon: () => uiPresetIcon
68985   });
68986   function uiPresetIcon() {
68987     let _preset;
68988     let _geometry;
68989     function presetIcon(selection2) {
68990       selection2.each(render);
68991     }
68992     function getIcon(p2, geom) {
68993       if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
68994       if (p2.icon) return p2.icon;
68995       if (geom === "line") return "iD-other-line";
68996       if (geom === "vertex") return "temaki-vertex";
68997       return "maki-marker-stroked";
68998     }
68999     function renderPointBorder(container, drawPoint) {
69000       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
69001       pointBorder.exit().remove();
69002       let pointBorderEnter = pointBorder.enter();
69003       const w2 = 40;
69004       const h2 = 40;
69005       pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
69006       pointBorder = pointBorderEnter.merge(pointBorder);
69007     }
69008     function renderCategoryBorder(container, category) {
69009       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
69010       categoryBorder.exit().remove();
69011       let categoryBorderEnter = categoryBorder.enter();
69012       const d2 = 60;
69013       let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d2).attr("height", d2).attr("viewBox", `0 0 ${d2} ${d2}`);
69014       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");
69015       categoryBorder = categoryBorderEnter.merge(categoryBorder);
69016       if (category) {
69017         categoryBorder.selectAll("path").attr("class", `area ${category.id}`);
69018       }
69019     }
69020     function renderCircleFill(container, drawVertex) {
69021       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
69022       vertexFill.exit().remove();
69023       let vertexFillEnter = vertexFill.enter();
69024       const w2 = 60;
69025       const h2 = 60;
69026       const d2 = 40;
69027       vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`).append("circle").attr("cx", w2 / 2).attr("cy", h2 / 2).attr("r", d2 / 2);
69028       vertexFill = vertexFillEnter.merge(vertexFill);
69029     }
69030     function renderSquareFill(container, drawArea, tagClasses) {
69031       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
69032       fill.exit().remove();
69033       let fillEnter = fill.enter();
69034       const d2 = 60;
69035       const w2 = d2;
69036       const h2 = d2;
69037       const l2 = d2 * 2 / 3;
69038       const c1 = (w2 - l2) / 2;
69039       const c2 = c1 + l2;
69040       fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
69041       ["fill", "stroke"].forEach((klass) => {
69042         fillEnter.append("path").attr("d", `M${c1} ${c1} L${c1} ${c2} L${c2} ${c2} L${c2} ${c1} Z`).attr("class", `area ${klass}`);
69043       });
69044       const rVertex = 2.5;
69045       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
69046         fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
69047       });
69048       const rMidpoint = 1.25;
69049       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point) => {
69050         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
69051       });
69052       fill = fillEnter.merge(fill);
69053       fill.selectAll("path.stroke").attr("class", `area stroke ${tagClasses}`);
69054       fill.selectAll("path.fill").attr("class", `area fill ${tagClasses}`);
69055     }
69056     function renderLine(container, drawLine, tagClasses) {
69057       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
69058       line.exit().remove();
69059       let lineEnter = line.enter();
69060       const d2 = 60;
69061       const w2 = d2;
69062       const h2 = d2;
69063       const y2 = Math.round(d2 * 0.72);
69064       const l2 = Math.round(d2 * 0.6);
69065       const r2 = 2.5;
69066       const x12 = (w2 - l2) / 2;
69067       const x2 = x12 + l2;
69068       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
69069       ["casing", "stroke"].forEach((klass) => {
69070         lineEnter.append("path").attr("d", `M${x12} ${y2} L${x2} ${y2}`).attr("class", `line ${klass}`);
69071       });
69072       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
69073         lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
69074       });
69075       line = lineEnter.merge(line);
69076       line.selectAll("path.stroke").attr("class", `line stroke ${tagClasses}`);
69077       line.selectAll("path.casing").attr("class", `line casing ${tagClasses}`);
69078     }
69079     function renderRoute(container, drawRoute, p2) {
69080       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
69081       route.exit().remove();
69082       let routeEnter = route.enter();
69083       const d2 = 60;
69084       const w2 = d2;
69085       const h2 = d2;
69086       const y12 = Math.round(d2 * 0.8);
69087       const y2 = Math.round(d2 * 0.68);
69088       const l2 = Math.round(d2 * 0.6);
69089       const r2 = 2;
69090       const x12 = (w2 - l2) / 2;
69091       const x2 = x12 + l2 / 3;
69092       const x3 = x2 + l2 / 3;
69093       const x4 = x3 + l2 / 3;
69094       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", `0 0 ${w2} ${h2}`);
69095       ["casing", "stroke"].forEach((klass) => {
69096         routeEnter.append("path").attr("d", `M${x12} ${y12} L${x2} ${y2}`).attr("class", `segment0 line ${klass}`);
69097         routeEnter.append("path").attr("d", `M${x2} ${y2} L${x3} ${y12}`).attr("class", `segment1 line ${klass}`);
69098         routeEnter.append("path").attr("d", `M${x3} ${y12} L${x4} ${y2}`).attr("class", `segment2 line ${klass}`);
69099       });
69100       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
69101         routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
69102       });
69103       route = routeEnter.merge(route);
69104       if (drawRoute) {
69105         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
69106         const segmentPresetIDs = routeSegments[routeType];
69107         for (let i3 in segmentPresetIDs) {
69108           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
69109           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
69110           route.selectAll(`path.stroke.segment${i3}`).attr("class", `segment${i3} line stroke ${segmentTagClasses}`);
69111           route.selectAll(`path.casing.segment${i3}`).attr("class", `segment${i3} line casing ${segmentTagClasses}`);
69112         }
69113       }
69114     }
69115     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
69116       const isMaki = picon && /^maki-/.test(picon);
69117       const isTemaki = picon && /^temaki-/.test(picon);
69118       const isFa = picon && /^fa[srb]-/.test(picon);
69119       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
69120       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
69121       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
69122       icon2.exit().remove();
69123       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
69124       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
69125       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
69126       icon2.selectAll("use").attr("href", "#" + picon);
69127     }
69128     function renderImageIcon(container, imageURL) {
69129       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
69130       imageIcon.exit().remove();
69131       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);
69132       imageIcon.attr("src", imageURL);
69133     }
69134     const routeSegments = {
69135       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
69136       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
69137       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
69138       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
69139       ferry: ["route/ferry", "route/ferry", "route/ferry"],
69140       foot: ["highway/footway", "highway/footway", "highway/footway"],
69141       hiking: ["highway/path", "highway/path", "highway/path"],
69142       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
69143       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
69144       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
69145       mtb: ["highway/path", "highway/track", "highway/bridleway"],
69146       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
69147       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
69148       power: ["power/line", "power/line", "power/line"],
69149       road: ["highway/secondary", "highway/primary", "highway/trunk"],
69150       subway: ["railway/subway", "railway/subway", "railway/subway"],
69151       train: ["railway/rail", "railway/rail", "railway/rail"],
69152       tram: ["railway/tram", "railway/tram", "railway/tram"],
69153       railway: ["railway/rail", "railway/rail", "railway/rail"],
69154       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
69155     };
69156     function render() {
69157       let p2 = _preset.apply(this, arguments);
69158       let geom = _geometry ? _geometry.apply(this, arguments) : null;
69159       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
69160         geom = "route";
69161       }
69162       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69163       const isFallback = p2.isFallback && p2.isFallback();
69164       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
69165       const picon = getIcon(p2, geom);
69166       const isCategory = !p2.setTags;
69167       const drawPoint = false;
69168       const drawVertex = picon !== null && geom === "vertex";
69169       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
69170       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
69171       const drawRoute = picon && geom === "route";
69172       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
69173       let tags = !isCategory ? p2.setTags({}, geom) : {};
69174       for (let k2 in tags) {
69175         if (tags[k2] === "*") {
69176           tags[k2] = "yes";
69177         }
69178       }
69179       let tagClasses = svgTagClasses().getClassesString(tags, "");
69180       let selection2 = select_default2(this);
69181       let container = selection2.selectAll(".preset-icon-container").data([0]);
69182       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
69183       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
69184       renderCategoryBorder(container, isCategory && p2);
69185       renderPointBorder(container, drawPoint);
69186       renderCircleFill(container, drawVertex);
69187       renderSquareFill(container, drawArea, tagClasses);
69188       renderLine(container, drawLine, tagClasses);
69189       renderRoute(container, drawRoute, p2);
69190       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
69191       renderImageIcon(container, imageURL);
69192     }
69193     presetIcon.preset = function(val) {
69194       if (!arguments.length) return _preset;
69195       _preset = utilFunctor(val);
69196       return presetIcon;
69197     };
69198     presetIcon.geometry = function(val) {
69199       if (!arguments.length) return _geometry;
69200       _geometry = utilFunctor(val);
69201       return presetIcon;
69202     };
69203     return presetIcon;
69204   }
69205   var init_preset_icon = __esm({
69206     "modules/ui/preset_icon.js"() {
69207       "use strict";
69208       init_src5();
69209       init_presets();
69210       init_preferences();
69211       init_svg();
69212       init_util();
69213     }
69214   });
69215
69216   // modules/ui/sections/feature_type.js
69217   var feature_type_exports = {};
69218   __export(feature_type_exports, {
69219     uiSectionFeatureType: () => uiSectionFeatureType
69220   });
69221   function uiSectionFeatureType(context) {
69222     var dispatch14 = dispatch_default("choose");
69223     var _entityIDs = [];
69224     var _presets = [];
69225     var _tagReference;
69226     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
69227     function renderDisclosureContent(selection2) {
69228       selection2.classed("preset-list-item", true);
69229       selection2.classed("mixed-types", _presets.length > 1);
69230       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
69231       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
69232         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
69233       );
69234       presetButton.append("div").attr("class", "preset-icon-container");
69235       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
69236       presetButtonWrap.append("div").attr("class", "accessory-buttons");
69237       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
69238       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
69239       if (_tagReference) {
69240         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
69241         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
69242       }
69243       selection2.selectAll(".preset-reset").on("click", function() {
69244         dispatch14.call("choose", this, _presets);
69245       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
69246         d3_event.preventDefault();
69247         d3_event.stopPropagation();
69248       });
69249       var geometries = entityGeometries();
69250       selection2.select(".preset-list-item button").call(
69251         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
69252       );
69253       var names = _presets.length === 1 ? [
69254         _presets[0].nameLabel(),
69255         _presets[0].subtitleLabel()
69256       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
69257       var label = selection2.select(".label-inner");
69258       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
69259       nameparts.exit().remove();
69260       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
69261         d2(select_default2(this));
69262       });
69263     }
69264     section.entityIDs = function(val) {
69265       if (!arguments.length) return _entityIDs;
69266       _entityIDs = val;
69267       return section;
69268     };
69269     section.presets = function(val) {
69270       if (!arguments.length) return _presets;
69271       if (!utilArrayIdentical(val, _presets)) {
69272         _presets = val;
69273         if (_presets.length === 1) {
69274           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
69275         }
69276       }
69277       return section;
69278     };
69279     function entityGeometries() {
69280       var counts = {};
69281       for (var i3 in _entityIDs) {
69282         var geometry = context.graph().geometry(_entityIDs[i3]);
69283         if (!counts[geometry]) counts[geometry] = 0;
69284         counts[geometry] += 1;
69285       }
69286       return Object.keys(counts).sort(function(geom1, geom2) {
69287         return counts[geom2] - counts[geom1];
69288       });
69289     }
69290     return utilRebind(section, dispatch14, "on");
69291   }
69292   var init_feature_type = __esm({
69293     "modules/ui/sections/feature_type.js"() {
69294       "use strict";
69295       init_src4();
69296       init_src5();
69297       init_presets();
69298       init_array3();
69299       init_localizer();
69300       init_tooltip();
69301       init_util();
69302       init_preset_icon();
69303       init_section();
69304       init_tag_reference();
69305     }
69306   });
69307
69308   // modules/ui/form_fields.js
69309   var form_fields_exports = {};
69310   __export(form_fields_exports, {
69311     uiFormFields: () => uiFormFields
69312   });
69313   function uiFormFields(context) {
69314     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
69315     var _fieldsArr = [];
69316     var _lastPlaceholder = "";
69317     var _state = "";
69318     var _klass = "";
69319     function formFields(selection2) {
69320       var allowedFields = _fieldsArr.filter(function(field) {
69321         return field.isAllowed();
69322       });
69323       var shown = allowedFields.filter(function(field) {
69324         return field.isShown();
69325       });
69326       var notShown = allowedFields.filter(function(field) {
69327         return !field.isShown();
69328       }).sort(function(a2, b2) {
69329         return a2.universal === b2.universal ? 0 : a2.universal ? 1 : -1;
69330       });
69331       var container = selection2.selectAll(".form-fields-container").data([0]);
69332       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
69333       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
69334         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
69335       });
69336       fields.exit().remove();
69337       var enter = fields.enter().append("div").attr("class", function(d2) {
69338         return "wrap-form-field wrap-form-field-" + d2.safeid;
69339       });
69340       fields = fields.merge(enter);
69341       fields.order().each(function(d2) {
69342         select_default2(this).call(d2.render);
69343       });
69344       var titles = [];
69345       var moreFields = notShown.map(function(field) {
69346         var title = field.title();
69347         titles.push(title);
69348         var terms = field.terms();
69349         if (field.key) terms.push(field.key);
69350         if (field.keys) terms = terms.concat(field.keys);
69351         return {
69352           display: field.label(),
69353           value: title,
69354           title,
69355           field,
69356           terms
69357         };
69358       });
69359       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
69360       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
69361       more.exit().remove();
69362       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
69363       moreEnter.append("span").call(_t.append("inspector.add_fields"));
69364       more = moreEnter.merge(more);
69365       var input = more.selectAll(".value").data([0]);
69366       input.exit().remove();
69367       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
69368       input.call(utilGetSetValue, "").call(
69369         moreCombo.data(moreFields).on("accept", function(d2) {
69370           if (!d2) return;
69371           var field = d2.field;
69372           field.show();
69373           selection2.call(formFields);
69374           field.focus();
69375         })
69376       );
69377       if (_lastPlaceholder !== placeholder) {
69378         input.attr("placeholder", placeholder);
69379         _lastPlaceholder = placeholder;
69380       }
69381     }
69382     formFields.fieldsArr = function(val) {
69383       if (!arguments.length) return _fieldsArr;
69384       _fieldsArr = val || [];
69385       return formFields;
69386     };
69387     formFields.state = function(val) {
69388       if (!arguments.length) return _state;
69389       _state = val;
69390       return formFields;
69391     };
69392     formFields.klass = function(val) {
69393       if (!arguments.length) return _klass;
69394       _klass = val;
69395       return formFields;
69396     };
69397     return formFields;
69398   }
69399   var init_form_fields = __esm({
69400     "modules/ui/form_fields.js"() {
69401       "use strict";
69402       init_src5();
69403       init_localizer();
69404       init_combobox();
69405       init_util();
69406     }
69407   });
69408
69409   // modules/ui/sections/preset_fields.js
69410   var preset_fields_exports = {};
69411   __export(preset_fields_exports, {
69412     uiSectionPresetFields: () => uiSectionPresetFields
69413   });
69414   function uiSectionPresetFields(context) {
69415     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
69416     var dispatch14 = dispatch_default("change", "revert");
69417     var formFields = uiFormFields(context);
69418     var _state;
69419     var _fieldsArr;
69420     var _presets = [];
69421     var _tags;
69422     var _entityIDs;
69423     function renderDisclosureContent(selection2) {
69424       if (!_fieldsArr) {
69425         var graph = context.graph();
69426         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
69427           geoms[graph.entity(entityID).geometry(graph)] = true;
69428           return geoms;
69429         }, {}));
69430         const loc = _entityIDs.reduce(function(extent, entityID) {
69431           var entity = context.graph().entity(entityID);
69432           return extent.extend(entity.extent(context.graph()));
69433         }, geoExtent()).center();
69434         var presetsManager = _mainPresetIndex;
69435         var allFields = [];
69436         var allMoreFields = [];
69437         var sharedTotalFields;
69438         _presets.forEach(function(preset) {
69439           var fields = preset.fields(loc);
69440           var moreFields = preset.moreFields(loc);
69441           allFields = utilArrayUnion(allFields, fields);
69442           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
69443           if (!sharedTotalFields) {
69444             sharedTotalFields = utilArrayUnion(fields, moreFields);
69445           } else {
69446             sharedTotalFields = sharedTotalFields.filter(function(field) {
69447               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
69448             });
69449           }
69450         });
69451         var sharedFields = allFields.filter(function(field) {
69452           return sharedTotalFields.indexOf(field) !== -1;
69453         });
69454         var sharedMoreFields = allMoreFields.filter(function(field) {
69455           return sharedTotalFields.indexOf(field) !== -1;
69456         });
69457         _fieldsArr = [];
69458         sharedFields.forEach(function(field) {
69459           if (field.matchAllGeometry(geometries)) {
69460             _fieldsArr.push(
69461               uiField(context, field, _entityIDs)
69462             );
69463           }
69464         });
69465         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
69466         if (singularEntity && singularEntity.type === "node" && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
69467           _fieldsArr.push(
69468             uiField(context, presetsManager.field("restrictions"), _entityIDs)
69469           );
69470         }
69471         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
69472         additionalFields.sort(function(field1, field2) {
69473           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
69474         });
69475         additionalFields.forEach(function(field) {
69476           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
69477             _fieldsArr.push(
69478               uiField(context, field, _entityIDs, { show: false })
69479             );
69480           }
69481         });
69482         _fieldsArr.forEach(function(field) {
69483           field.on("change", function(t2, onInput) {
69484             dispatch14.call("change", field, _entityIDs, t2, onInput);
69485           }).on("revert", function(keys2) {
69486             dispatch14.call("revert", field, keys2);
69487           });
69488         });
69489       }
69490       _fieldsArr.forEach(function(field) {
69491         field.state(_state).tags(_tags);
69492       });
69493       selection2.call(
69494         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
69495       );
69496     }
69497     section.presets = function(val) {
69498       if (!arguments.length) return _presets;
69499       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
69500         _presets = val;
69501         _fieldsArr = null;
69502       }
69503       return section;
69504     };
69505     section.state = function(val) {
69506       if (!arguments.length) return _state;
69507       _state = val;
69508       return section;
69509     };
69510     section.tags = function(val) {
69511       if (!arguments.length) return _tags;
69512       _tags = val;
69513       return section;
69514     };
69515     section.entityIDs = function(val) {
69516       if (!arguments.length) return _entityIDs;
69517       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
69518         _entityIDs = val;
69519         _fieldsArr = null;
69520       }
69521       return section;
69522     };
69523     return utilRebind(section, dispatch14, "on");
69524   }
69525   var init_preset_fields = __esm({
69526     "modules/ui/sections/preset_fields.js"() {
69527       "use strict";
69528       init_src4();
69529       init_presets();
69530       init_localizer();
69531       init_array3();
69532       init_util();
69533       init_extent();
69534       init_field2();
69535       init_form_fields();
69536       init_section();
69537     }
69538   });
69539
69540   // modules/ui/sections/raw_member_editor.js
69541   var raw_member_editor_exports = {};
69542   __export(raw_member_editor_exports, {
69543     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor
69544   });
69545   function uiSectionRawMemberEditor(context) {
69546     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
69547       if (!_entityIDs || _entityIDs.length !== 1) return false;
69548       var entity = context.hasEntity(_entityIDs[0]);
69549       return entity && entity.type === "relation";
69550     }).label(function() {
69551       var entity = context.hasEntity(_entityIDs[0]);
69552       if (!entity) return "";
69553       var gt2 = entity.members.length > _maxMembers ? ">" : "";
69554       var count = gt2 + entity.members.slice(0, _maxMembers).length;
69555       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
69556     }).disclosureContent(renderDisclosureContent);
69557     var taginfo = services.taginfo;
69558     var _entityIDs;
69559     var _maxMembers = 1e3;
69560     function downloadMember(d3_event, d2) {
69561       d3_event.preventDefault();
69562       select_default2(this).classed("loading", true);
69563       context.loadEntity(d2.id, function() {
69564         section.reRender();
69565       });
69566     }
69567     function zoomToMember(d3_event, d2) {
69568       d3_event.preventDefault();
69569       var entity = context.entity(d2.id);
69570       context.map().zoomToEase(entity);
69571       utilHighlightEntities([d2.id], true, context);
69572     }
69573     function selectMember(d3_event, d2) {
69574       d3_event.preventDefault();
69575       utilHighlightEntities([d2.id], false, context);
69576       var entity = context.entity(d2.id);
69577       var mapExtent = context.map().extent();
69578       if (!entity.intersects(mapExtent, context.graph())) {
69579         context.map().zoomToEase(entity);
69580       }
69581       context.enter(modeSelect(context, [d2.id]));
69582     }
69583     function changeRole(d3_event, d2) {
69584       var oldRole = d2.role;
69585       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
69586       if (oldRole !== newRole) {
69587         var member = { id: d2.id, type: d2.type, role: newRole };
69588         context.perform(
69589           actionChangeMember(d2.relation.id, member, d2.index),
69590           _t("operations.change_role.annotation", {
69591             n: 1
69592           })
69593         );
69594         context.validator().validate();
69595       }
69596     }
69597     function deleteMember(d3_event, d2) {
69598       utilHighlightEntities([d2.id], false, context);
69599       context.perform(
69600         actionDeleteMember(d2.relation.id, d2.index),
69601         _t("operations.delete_member.annotation", {
69602           n: 1
69603         })
69604       );
69605       if (!context.hasEntity(d2.relation.id)) {
69606         context.enter(modeBrowse(context));
69607       } else {
69608         context.validator().validate();
69609       }
69610     }
69611     function renderDisclosureContent(selection2) {
69612       var entityID = _entityIDs[0];
69613       var memberships = [];
69614       var entity = context.entity(entityID);
69615       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
69616         memberships.push({
69617           index,
69618           id: member.id,
69619           type: member.type,
69620           role: member.role,
69621           relation: entity,
69622           member: context.hasEntity(member.id),
69623           domId: utilUniqueDomId(entityID + "-member-" + index)
69624         });
69625       });
69626       var list2 = selection2.selectAll(".member-list").data([0]);
69627       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
69628       var items = list2.selectAll("li").data(memberships, function(d2) {
69629         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
69630       });
69631       items.exit().each(unbind).remove();
69632       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
69633         return !d2.member;
69634       });
69635       itemsEnter.each(function(d2) {
69636         var item = select_default2(this);
69637         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
69638         if (d2.member) {
69639           item.on("mouseover", function() {
69640             utilHighlightEntities([d2.id], true, context);
69641           }).on("mouseout", function() {
69642             utilHighlightEntities([d2.id], false, context);
69643           });
69644           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
69645           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
69646             var matched = _mainPresetIndex.match(d4.member, context.graph());
69647             return matched && matched.name() || utilDisplayType(d4.member.id);
69648           });
69649           labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d4) => d4.member.type === "relation" && d4.member.tags.colour && isColourValid(d4.member.tags.colour)).style("border-color", (d4) => d4.member.type === "relation" && d4.member.tags.colour).text(function(d4) {
69650             return utilDisplayName(d4.member);
69651           });
69652           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
69653           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
69654         } else {
69655           var labelText = label.append("span").attr("class", "label-text");
69656           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
69657           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
69658           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
69659         }
69660       });
69661       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
69662       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
69663         return d2.domId;
69664       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
69665       if (taginfo) {
69666         wrapEnter.each(bindTypeahead);
69667       }
69668       items = items.merge(itemsEnter).order();
69669       items.select("input.member-role").property("value", function(d2) {
69670         return d2.role;
69671       }).on("blur", changeRole).on("change", changeRole);
69672       items.select("button.member-delete").on("click", deleteMember);
69673       var dragOrigin, targetIndex;
69674       items.call(
69675         drag_default().on("start", function(d3_event) {
69676           dragOrigin = {
69677             x: d3_event.x,
69678             y: d3_event.y
69679           };
69680           targetIndex = null;
69681         }).on("drag", function(d3_event) {
69682           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
69683           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
69684           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
69685           var index = items.nodes().indexOf(this);
69686           select_default2(this).classed("dragging", true);
69687           targetIndex = null;
69688           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
69689             var node = select_default2(this).node();
69690             if (index === index2) {
69691               return "translate(" + x2 + "px, " + y2 + "px)";
69692             } else if (index2 > index && d3_event.y > node.offsetTop) {
69693               if (targetIndex === null || index2 > targetIndex) {
69694                 targetIndex = index2;
69695               }
69696               return "translateY(-100%)";
69697             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
69698               if (targetIndex === null || index2 < targetIndex) {
69699                 targetIndex = index2;
69700               }
69701               return "translateY(100%)";
69702             }
69703             return null;
69704           });
69705         }).on("end", function(d3_event, d2) {
69706           if (!select_default2(this).classed("dragging")) return;
69707           var index = items.nodes().indexOf(this);
69708           select_default2(this).classed("dragging", false);
69709           selection2.selectAll("li.member-row").style("transform", null);
69710           if (targetIndex !== null) {
69711             context.perform(
69712               actionMoveMember(d2.relation.id, index, targetIndex),
69713               _t("operations.reorder_members.annotation")
69714             );
69715             context.validator().validate();
69716           }
69717         })
69718       );
69719       function bindTypeahead(d2) {
69720         var row = select_default2(this);
69721         var role = row.selectAll("input.member-role");
69722         var origValue = role.property("value");
69723         function sort(value, data) {
69724           var sameletter = [];
69725           var other2 = [];
69726           for (var i3 = 0; i3 < data.length; i3++) {
69727             if (data[i3].value.substring(0, value.length) === value) {
69728               sameletter.push(data[i3]);
69729             } else {
69730               other2.push(data[i3]);
69731             }
69732           }
69733           return sameletter.concat(other2);
69734         }
69735         role.call(
69736           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
69737             var geometry;
69738             if (d2.member) {
69739               geometry = context.graph().geometry(d2.member.id);
69740             } else if (d2.type === "relation") {
69741               geometry = "relation";
69742             } else if (d2.type === "way") {
69743               geometry = "line";
69744             } else {
69745               geometry = "point";
69746             }
69747             var rtype = entity.tags.type;
69748             taginfo.roles({
69749               debounce: true,
69750               rtype: rtype || "",
69751               geometry,
69752               query: role2
69753             }, function(err, data) {
69754               if (!err) callback(sort(role2, data));
69755             });
69756           }).on("cancel", function() {
69757             role.property("value", origValue);
69758           })
69759         );
69760       }
69761       function unbind() {
69762         var row = select_default2(this);
69763         row.selectAll("input.member-role").call(uiCombobox.off, context);
69764       }
69765     }
69766     section.entityIDs = function(val) {
69767       if (!arguments.length) return _entityIDs;
69768       _entityIDs = val;
69769       return section;
69770     };
69771     return section;
69772   }
69773   var init_raw_member_editor = __esm({
69774     "modules/ui/sections/raw_member_editor.js"() {
69775       "use strict";
69776       init_src6();
69777       init_src5();
69778       init_presets();
69779       init_localizer();
69780       init_change_member();
69781       init_delete_member();
69782       init_move_member();
69783       init_browse();
69784       init_select5();
69785       init_osm();
69786       init_tags();
69787       init_icon();
69788       init_services();
69789       init_combobox();
69790       init_section();
69791       init_util();
69792     }
69793   });
69794
69795   // modules/ui/sections/raw_membership_editor.js
69796   var raw_membership_editor_exports = {};
69797   __export(raw_membership_editor_exports, {
69798     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor
69799   });
69800   function uiSectionRawMembershipEditor(context) {
69801     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
69802       return _entityIDs && _entityIDs.length;
69803     }).label(function() {
69804       var parents = getSharedParentRelations();
69805       var gt2 = parents.length > _maxMemberships ? ">" : "";
69806       var count = gt2 + parents.slice(0, _maxMemberships).length;
69807       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
69808     }).disclosureContent(renderDisclosureContent);
69809     var taginfo = services.taginfo;
69810     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
69811       if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
69812     }).itemsMouseLeave(function(d3_event, d2) {
69813       if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
69814     });
69815     var _inChange = false;
69816     var _entityIDs = [];
69817     var _showBlank;
69818     var _maxMemberships = 1e3;
69819     const recentlyAdded = /* @__PURE__ */ new Set();
69820     function getSharedParentRelations() {
69821       var parents = [];
69822       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
69823         var entity = context.graph().hasEntity(_entityIDs[i3]);
69824         if (!entity) continue;
69825         if (i3 === 0) {
69826           parents = context.graph().parentRelations(entity);
69827         } else {
69828           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
69829         }
69830         if (!parents.length) break;
69831       }
69832       return parents;
69833     }
69834     function getMemberships() {
69835       var memberships = [];
69836       var relations = getSharedParentRelations().slice(0, _maxMemberships);
69837       var isMultiselect = _entityIDs.length > 1;
69838       var i3, relation, membership, index, member, indexedMember;
69839       for (i3 = 0; i3 < relations.length; i3++) {
69840         relation = relations[i3];
69841         membership = {
69842           relation,
69843           members: [],
69844           hash: osmEntity.key(relation)
69845         };
69846         for (index = 0; index < relation.members.length; index++) {
69847           member = relation.members[index];
69848           if (_entityIDs.indexOf(member.id) !== -1) {
69849             indexedMember = Object.assign({}, member, { index });
69850             membership.members.push(indexedMember);
69851             membership.hash += "," + index.toString();
69852             if (!isMultiselect) {
69853               memberships.push(membership);
69854               membership = {
69855                 relation,
69856                 members: [],
69857                 hash: osmEntity.key(relation)
69858               };
69859             }
69860           }
69861         }
69862         if (membership.members.length) memberships.push(membership);
69863       }
69864       memberships.forEach(function(membership2) {
69865         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
69866         var roles = [];
69867         membership2.members.forEach(function(member2) {
69868           if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
69869         });
69870         membership2.role = roles.length === 1 ? roles[0] : roles;
69871       });
69872       const existingRelations = memberships.filter((membership2) => !recentlyAdded.has(membership2.relation.id)).map((membership2) => ({
69873         ...membership2,
69874         // We only sort relations that were not added just now.
69875         // Sorting uses the same label as shown in the UI.
69876         // If the label is not unique, the relation ID ensures
69877         // that the sort order is still stable.
69878         _sortKey: [
69879           baseDisplayValue(membership2.relation),
69880           membership2.relation.id
69881         ].join("-")
69882       })).sort((a2, b2) => {
69883         return a2._sortKey.localeCompare(
69884           b2._sortKey,
69885           _mainLocalizer.localeCodes(),
69886           { numeric: true }
69887         );
69888       });
69889       const newlyAddedRelations = memberships.filter((membership2) => recentlyAdded.has(membership2.relation.id));
69890       return [
69891         // the sorted relations come first
69892         ...existingRelations,
69893         // then the ones that were just added from this panel
69894         ...newlyAddedRelations
69895       ];
69896     }
69897     function selectRelation(d3_event, d2) {
69898       d3_event.preventDefault();
69899       utilHighlightEntities([d2.relation.id], false, context);
69900       context.enter(modeSelect(context, [d2.relation.id]));
69901     }
69902     function zoomToRelation(d3_event, d2) {
69903       d3_event.preventDefault();
69904       var entity = context.entity(d2.relation.id);
69905       context.map().zoomToEase(entity);
69906       utilHighlightEntities([d2.relation.id], true, context);
69907     }
69908     function changeRole(d3_event, d2) {
69909       if (d2 === 0) return;
69910       if (_inChange) return;
69911       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
69912       if (!newRole.trim() && typeof d2.role !== "string") return;
69913       var membersToUpdate = d2.members.filter(function(member) {
69914         return member.role !== newRole;
69915       });
69916       if (membersToUpdate.length) {
69917         _inChange = true;
69918         context.perform(
69919           function actionChangeMemberRoles(graph) {
69920             membersToUpdate.forEach(function(member) {
69921               var newMember = Object.assign({}, member, { role: newRole });
69922               delete newMember.index;
69923               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
69924             });
69925             return graph;
69926           },
69927           _t("operations.change_role.annotation", {
69928             n: membersToUpdate.length
69929           })
69930         );
69931         context.validator().validate();
69932       }
69933       _inChange = false;
69934     }
69935     function addMembership(d2, role) {
69936       _showBlank = false;
69937       function actionAddMembers(relationId, ids, role2) {
69938         return function(graph) {
69939           for (var i3 in ids) {
69940             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
69941             graph = actionAddMember(relationId, member)(graph);
69942           }
69943           return graph;
69944         };
69945       }
69946       if (d2.relation) {
69947         recentlyAdded.add(d2.relation.id);
69948         context.perform(
69949           actionAddMembers(d2.relation.id, _entityIDs, role),
69950           _t("operations.add_member.annotation", {
69951             n: _entityIDs.length
69952           })
69953         );
69954         context.validator().validate();
69955       } else {
69956         var relation = osmRelation();
69957         context.perform(
69958           actionAddEntity(relation),
69959           actionAddMembers(relation.id, _entityIDs, role),
69960           _t("operations.add.annotation.relation")
69961         );
69962         context.enter(modeSelect(context, [relation.id]).newFeature(true));
69963       }
69964     }
69965     function downloadMembers(d3_event, d2) {
69966       d3_event.preventDefault();
69967       const button = select_default2(this);
69968       button.classed("loading", true);
69969       context.loadEntity(d2.relation.id, function() {
69970         section.reRender();
69971       });
69972     }
69973     function deleteMembership(d3_event, d2) {
69974       this.blur();
69975       if (d2 === 0) return;
69976       utilHighlightEntities([d2.relation.id], false, context);
69977       var indexes = d2.members.map(function(member) {
69978         return member.index;
69979       });
69980       context.perform(
69981         actionDeleteMembers(d2.relation.id, indexes),
69982         _t("operations.delete_member.annotation", {
69983           n: _entityIDs.length
69984         })
69985       );
69986       context.validator().validate();
69987     }
69988     function fetchNearbyRelations(q2, callback) {
69989       var newRelation = {
69990         relation: null,
69991         value: _t("inspector.new_relation"),
69992         display: _t.append("inspector.new_relation")
69993       };
69994       var entityID = _entityIDs[0];
69995       var result = [];
69996       var graph = context.graph();
69997       function baseDisplayLabel(entity) {
69998         var matched = _mainPresetIndex.match(entity, graph);
69999         var presetName = matched && matched.name() || _t("inspector.relation");
70000         var entityName = utilDisplayName(entity) || "";
70001         return (selection2) => {
70002           selection2.append("b").text(presetName + " ");
70003           selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
70004         };
70005       }
70006       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
70007       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
70008         result.push({
70009           relation: explicitRelation,
70010           value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
70011           display: baseDisplayLabel(explicitRelation)
70012         });
70013       } else {
70014         context.history().intersects(context.map().extent()).forEach(function(entity) {
70015           if (entity.type !== "relation" || entity.id === entityID) return;
70016           var value = baseDisplayValue(entity);
70017           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1) return;
70018           result.push({
70019             relation: entity,
70020             value,
70021             display: baseDisplayLabel(entity)
70022           });
70023         });
70024         result.sort(function(a2, b2) {
70025           return osmRelation.creationOrder(a2.relation, b2.relation);
70026         });
70027         Object.values(utilArrayGroupBy(result, "value")).filter((v2) => v2.length > 1).flat().forEach((obj) => obj.value += " " + obj.relation.id);
70028       }
70029       result.forEach(function(obj) {
70030         obj.title = obj.value;
70031       });
70032       result.unshift(newRelation);
70033       callback(result);
70034     }
70035     function baseDisplayValue(entity) {
70036       const graph = context.graph();
70037       var matched = _mainPresetIndex.match(entity, graph);
70038       var presetName = matched && matched.name() || _t("inspector.relation");
70039       var entityName = utilDisplayName(entity) || "";
70040       return presetName + " " + entityName;
70041     }
70042     function renderDisclosureContent(selection2) {
70043       var memberships = getMemberships();
70044       var list2 = selection2.selectAll(".member-list").data([0]);
70045       list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
70046       var items = list2.selectAll("li.member-row-normal").data(memberships, function(d2) {
70047         return d2.hash;
70048       });
70049       items.exit().each(unbind).remove();
70050       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
70051       itemsEnter.on("mouseover", function(d3_event, d2) {
70052         utilHighlightEntities([d2.relation.id], true, context);
70053       }).on("mouseout", function(d3_event, d2) {
70054         utilHighlightEntities([d2.relation.id], false, context);
70055       });
70056       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
70057         return d2.domId;
70058       });
70059       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
70060       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
70061         var matched = _mainPresetIndex.match(d2.relation, context.graph());
70062         return matched && matched.name() || _t.html("inspector.relation");
70063       });
70064       labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d2) => d2.relation.tags.colour && isColourValid(d2.relation.tags.colour)).style("border-color", (d2) => d2.relation.tags.colour).text(function(d2) {
70065         const matched = _mainPresetIndex.match(d2.relation, context.graph());
70066         return utilDisplayName(d2.relation, matched.suggestion);
70067       });
70068       labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
70069       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
70070       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
70071       items = items.merge(itemsEnter);
70072       items.selectAll("button.members-download").classed("hide", (d2) => {
70073         const graph = context.graph();
70074         return d2.relation.members.every((m2) => graph.hasEntity(m2.id));
70075       });
70076       const dupeLabels = new WeakSet(Object.values(
70077         utilArrayGroupBy(items.selectAll(".label-text").nodes(), "textContent")
70078       ).filter((v2) => v2.length > 1).flat());
70079       items.select(".label-text").each(function() {
70080         const label = select_default2(this);
70081         const entityName = label.select(".member-entity-name");
70082         if (dupeLabels.has(this)) {
70083           label.attr("title", (d2) => `${entityName.text()} ${d2.relation.id}`);
70084         } else {
70085           label.attr("title", () => entityName.text());
70086         }
70087       });
70088       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
70089       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
70090         return d2.domId;
70091       }).property("type", "text").property("value", function(d2) {
70092         return typeof d2.role === "string" ? d2.role : "";
70093       }).attr("title", function(d2) {
70094         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
70095       }).attr("placeholder", function(d2) {
70096         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
70097       }).classed("mixed", function(d2) {
70098         return Array.isArray(d2.role);
70099       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
70100       if (taginfo) {
70101         wrapEnter.each(bindTypeahead);
70102       }
70103       var newMembership = list2.selectAll(".member-row-new").data(_showBlank ? [0] : []);
70104       newMembership.exit().remove();
70105       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
70106       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
70107       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
70108       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
70109         list2.selectAll(".member-row-new").remove();
70110       });
70111       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
70112       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
70113       newMembership = newMembership.merge(newMembershipEnter);
70114       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
70115         nearbyCombo.on("accept", function(d2) {
70116           this.blur();
70117           acceptEntity.call(this, d2);
70118         }).on("cancel", cancelEntity)
70119       );
70120       var addRow = selection2.selectAll(".add-row").data([0]);
70121       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
70122       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
70123       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
70124       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
70125       addRowEnter.append("div").attr("class", "space-value");
70126       addRowEnter.append("div").attr("class", "space-buttons");
70127       addRow = addRow.merge(addRowEnter);
70128       addRow.select(".add-relation").on("click", function() {
70129         _showBlank = true;
70130         section.reRender();
70131         list2.selectAll(".member-entity-input").node().focus();
70132       });
70133       function acceptEntity(d2) {
70134         if (!d2) {
70135           cancelEntity();
70136           return;
70137         }
70138         if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
70139         var role = context.cleanRelationRole(list2.selectAll(".member-row-new .member-role").property("value"));
70140         addMembership(d2, role);
70141       }
70142       function cancelEntity() {
70143         var input = newMembership.selectAll(".member-entity-input");
70144         input.property("value", "");
70145         context.surface().selectAll(".highlighted").classed("highlighted", false);
70146       }
70147       function bindTypeahead(d2) {
70148         var row = select_default2(this);
70149         var role = row.selectAll("input.member-role");
70150         var origValue = role.property("value");
70151         function sort(value, data) {
70152           var sameletter = [];
70153           var other2 = [];
70154           for (var i3 = 0; i3 < data.length; i3++) {
70155             if (data[i3].value.substring(0, value.length) === value) {
70156               sameletter.push(data[i3]);
70157             } else {
70158               other2.push(data[i3]);
70159             }
70160           }
70161           return sameletter.concat(other2);
70162         }
70163         role.call(
70164           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
70165             var rtype = d2.relation.tags.type;
70166             taginfo.roles({
70167               debounce: true,
70168               rtype: rtype || "",
70169               geometry: context.graph().geometry(_entityIDs[0]),
70170               query: role2
70171             }, function(err, data) {
70172               if (!err) callback(sort(role2, data));
70173             });
70174           }).on("cancel", function() {
70175             role.property("value", origValue);
70176           })
70177         );
70178       }
70179       function unbind() {
70180         var row = select_default2(this);
70181         row.selectAll("input.member-role").call(uiCombobox.off, context);
70182       }
70183     }
70184     section.entityIDs = function(val) {
70185       if (!arguments.length) return _entityIDs;
70186       const didChange = _entityIDs.join(",") !== val.join(",");
70187       _entityIDs = val;
70188       _showBlank = false;
70189       if (didChange) {
70190         recentlyAdded.clear();
70191       }
70192       return section;
70193     };
70194     return section;
70195   }
70196   var init_raw_membership_editor = __esm({
70197     "modules/ui/sections/raw_membership_editor.js"() {
70198       "use strict";
70199       init_src5();
70200       init_presets();
70201       init_localizer();
70202       init_add_entity();
70203       init_add_member();
70204       init_change_member();
70205       init_delete_members();
70206       init_select5();
70207       init_osm();
70208       init_tags();
70209       init_services();
70210       init_icon();
70211       init_combobox();
70212       init_section();
70213       init_tooltip();
70214       init_array3();
70215       init_util();
70216     }
70217   });
70218
70219   // modules/ui/sections/selection_list.js
70220   var selection_list_exports = {};
70221   __export(selection_list_exports, {
70222     uiSectionSelectionList: () => uiSectionSelectionList
70223   });
70224   function uiSectionSelectionList(context) {
70225     var _selectedIDs = [];
70226     var section = uiSection("selected-features", context).shouldDisplay(function() {
70227       return _selectedIDs.length > 1;
70228     }).label(function() {
70229       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
70230     }).disclosureContent(renderDisclosureContent);
70231     context.history().on("change.selectionList", function(difference2) {
70232       if (difference2) {
70233         section.reRender();
70234       }
70235     });
70236     section.entityIDs = function(val) {
70237       if (!arguments.length) return _selectedIDs;
70238       _selectedIDs = val;
70239       return section;
70240     };
70241     function selectEntity(d3_event, entity) {
70242       context.enter(modeSelect(context, [entity.id]));
70243     }
70244     function deselectEntity(d3_event, entity) {
70245       var selectedIDs = _selectedIDs.slice();
70246       var index = selectedIDs.indexOf(entity.id);
70247       if (index > -1) {
70248         selectedIDs.splice(index, 1);
70249         context.enter(modeSelect(context, selectedIDs));
70250       }
70251     }
70252     function renderDisclosureContent(selection2) {
70253       var list2 = selection2.selectAll(".feature-list").data([0]);
70254       list2 = list2.enter().append("ul").attr("class", "feature-list").merge(list2);
70255       var entities = _selectedIDs.map(function(id2) {
70256         return context.hasEntity(id2);
70257       }).filter(Boolean);
70258       var items = list2.selectAll(".feature-list-item").data(entities, osmEntity.key);
70259       items.exit().remove();
70260       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
70261         select_default2(this).on("mouseover", function() {
70262           utilHighlightEntities([d2.id], true, context);
70263         }).on("mouseout", function() {
70264           utilHighlightEntities([d2.id], false, context);
70265         });
70266       });
70267       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
70268       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
70269       label.append("span").attr("class", "entity-type");
70270       label.append("span").attr("class", "entity-name");
70271       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
70272       items = items.merge(enter);
70273       items.selectAll(".entity-geom-icon use").attr("href", function() {
70274         var entity = this.parentNode.parentNode.__data__;
70275         return "#iD-icon-" + entity.geometry(context.graph());
70276       });
70277       items.selectAll(".entity-type").text(function(entity) {
70278         return _mainPresetIndex.match(entity, context.graph()).name();
70279       });
70280       items.selectAll(".entity-name").text(function(d2) {
70281         var entity = context.entity(d2.id);
70282         return utilDisplayName(entity);
70283       });
70284     }
70285     return section;
70286   }
70287   var init_selection_list = __esm({
70288     "modules/ui/sections/selection_list.js"() {
70289       "use strict";
70290       init_src5();
70291       init_presets();
70292       init_select5();
70293       init_osm();
70294       init_icon();
70295       init_section();
70296       init_localizer();
70297       init_util();
70298     }
70299   });
70300
70301   // modules/ui/entity_editor.js
70302   var entity_editor_exports = {};
70303   __export(entity_editor_exports, {
70304     uiEntityEditor: () => uiEntityEditor
70305   });
70306   function uiEntityEditor(context) {
70307     var dispatch14 = dispatch_default("choose");
70308     var _state = "select";
70309     var _coalesceChanges = false;
70310     var _modified = false;
70311     var _base;
70312     var _entityIDs;
70313     var _activePresets = [];
70314     var _newFeature;
70315     var _sections;
70316     function entityEditor(selection2) {
70317       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
70318       var header = selection2.selectAll(".header").data([0]);
70319       var headerEnter = header.enter().append("div").attr("class", "header fillL");
70320       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
70321       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon(`#iD-icon-${direction}`));
70322       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70323         context.enter(modeBrowse(context));
70324       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
70325       headerEnter.append("h2");
70326       header = header.merge(headerEnter);
70327       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
70328       header.selectAll(".preset-reset").on("click", function() {
70329         dispatch14.call("choose", this, _activePresets);
70330       });
70331       var body = selection2.selectAll(".inspector-body").data([0]);
70332       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
70333       body = body.merge(bodyEnter);
70334       if (!_sections) {
70335         _sections = [
70336           uiSectionSelectionList(context),
70337           uiSectionFeatureType(context).on("choose", function(presets) {
70338             dispatch14.call("choose", this, presets);
70339           }),
70340           uiSectionEntityIssues(context),
70341           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
70342           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
70343           uiSectionRawMemberEditor(context),
70344           uiSectionRawMembershipEditor(context)
70345         ];
70346       }
70347       _sections.forEach(function(section) {
70348         if (section.entityIDs) {
70349           section.entityIDs(_entityIDs);
70350         }
70351         if (section.presets) {
70352           section.presets(_activePresets);
70353         }
70354         if (section.tags) {
70355           section.tags(combinedTags);
70356         }
70357         if (section.state) {
70358           section.state(_state);
70359         }
70360         body.call(section.render);
70361       });
70362       context.history().on("change.entity-editor", historyChanged);
70363       function historyChanged(difference2) {
70364         if (selection2.selectAll(".entity-editor").empty()) return;
70365         if (_state === "hide") return;
70366         var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
70367         if (!significant) return;
70368         _entityIDs = _entityIDs.filter(context.hasEntity);
70369         if (!_entityIDs.length) return;
70370         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
70371         loadActivePresets();
70372         var graph = context.graph();
70373         entityEditor.modified(_base !== graph);
70374         entityEditor(selection2);
70375         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
70376           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
70377         }
70378       }
70379     }
70380     function changeTags(entityIDs, changed, onInput) {
70381       var actions = [];
70382       for (var i3 in entityIDs) {
70383         var entityID = entityIDs[i3];
70384         var entity = context.entity(entityID);
70385         var tags = Object.assign({}, entity.tags);
70386         if (typeof changed === "function") {
70387           tags = changed(tags);
70388         } else {
70389           for (var k2 in changed) {
70390             if (!k2) continue;
70391             var v2 = changed[k2];
70392             if (typeof v2 === "object") {
70393               tags[k2] = tags[v2.oldKey];
70394             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70395               tags[k2] = v2;
70396             }
70397           }
70398         }
70399         if (!onInput) {
70400           tags = utilCleanTags(tags);
70401         }
70402         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
70403           actions.push(actionChangeTags(entityID, tags));
70404         }
70405       }
70406       if (actions.length) {
70407         var combinedAction = function(graph) {
70408           actions.forEach(function(action) {
70409             graph = action(graph);
70410           });
70411           return graph;
70412         };
70413         var annotation = _t("operations.change_tags.annotation");
70414         if (_coalesceChanges) {
70415           context.overwrite(combinedAction, annotation);
70416         } else {
70417           context.perform(combinedAction, annotation);
70418           _coalesceChanges = !!onInput;
70419         }
70420       }
70421       if (!onInput) {
70422         context.validator().validate();
70423       }
70424     }
70425     function revertTags(keys2) {
70426       var actions = [];
70427       for (var i3 in _entityIDs) {
70428         var entityID = _entityIDs[i3];
70429         var original = context.graph().base().entities[entityID];
70430         var changed = {};
70431         for (var j2 in keys2) {
70432           var key = keys2[j2];
70433           changed[key] = original ? original.tags[key] : void 0;
70434         }
70435         var entity = context.entity(entityID);
70436         var tags = Object.assign({}, entity.tags);
70437         for (var k2 in changed) {
70438           if (!k2) continue;
70439           var v2 = changed[k2];
70440           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70441             tags[k2] = v2;
70442           }
70443         }
70444         tags = utilCleanTags(tags);
70445         if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
70446           actions.push(actionChangeTags(entityID, tags));
70447         }
70448       }
70449       if (actions.length) {
70450         var combinedAction = function(graph) {
70451           actions.forEach(function(action) {
70452             graph = action(graph);
70453           });
70454           return graph;
70455         };
70456         var annotation = _t("operations.change_tags.annotation");
70457         if (_coalesceChanges) {
70458           context.overwrite(combinedAction, annotation);
70459         } else {
70460           context.perform(combinedAction, annotation);
70461           _coalesceChanges = false;
70462         }
70463       }
70464       context.validator().validate();
70465     }
70466     entityEditor.modified = function(val) {
70467       if (!arguments.length) return _modified;
70468       _modified = val;
70469       return entityEditor;
70470     };
70471     entityEditor.state = function(val) {
70472       if (!arguments.length) return _state;
70473       _state = val;
70474       return entityEditor;
70475     };
70476     entityEditor.entityIDs = function(val) {
70477       if (!arguments.length) return _entityIDs;
70478       _base = context.graph();
70479       _coalesceChanges = false;
70480       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
70481       _entityIDs = val;
70482       loadActivePresets(true);
70483       return entityEditor.modified(false);
70484     };
70485     entityEditor.newFeature = function(val) {
70486       if (!arguments.length) return _newFeature;
70487       _newFeature = val;
70488       return entityEditor;
70489     };
70490     function loadActivePresets(isForNewSelection) {
70491       var graph = context.graph();
70492       var counts = {};
70493       for (var i3 in _entityIDs) {
70494         var entity = graph.hasEntity(_entityIDs[i3]);
70495         if (!entity) return;
70496         var match = _mainPresetIndex.match(entity, graph);
70497         if (!counts[match.id]) counts[match.id] = 0;
70498         counts[match.id] += 1;
70499       }
70500       var matches = Object.keys(counts).sort(function(p1, p2) {
70501         return counts[p2] - counts[p1];
70502       }).map(function(pID) {
70503         return _mainPresetIndex.item(pID);
70504       });
70505       if (!isForNewSelection) {
70506         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
70507         if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
70508       }
70509       entityEditor.presets(matches);
70510     }
70511     entityEditor.presets = function(val) {
70512       if (!arguments.length) return _activePresets;
70513       if (!utilArrayIdentical(val, _activePresets)) {
70514         _activePresets = val;
70515       }
70516       return entityEditor;
70517     };
70518     return utilRebind(entityEditor, dispatch14, "on");
70519   }
70520   var import_fast_deep_equal9;
70521   var init_entity_editor = __esm({
70522     "modules/ui/entity_editor.js"() {
70523       "use strict";
70524       init_src4();
70525       import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
70526       init_presets();
70527       init_localizer();
70528       init_change_tags();
70529       init_browse();
70530       init_icon();
70531       init_array3();
70532       init_util();
70533       init_entity_issues();
70534       init_feature_type();
70535       init_preset_fields();
70536       init_raw_member_editor();
70537       init_raw_membership_editor();
70538       init_raw_tag_editor();
70539       init_selection_list();
70540     }
70541   });
70542
70543   // modules/ui/preset_list.js
70544   var preset_list_exports = {};
70545   __export(preset_list_exports, {
70546     uiPresetList: () => uiPresetList
70547   });
70548   function uiPresetList(context) {
70549     var dispatch14 = dispatch_default("cancel", "choose");
70550     var _entityIDs;
70551     var _currLoc;
70552     var _currentPresets;
70553     var _autofocus = false;
70554     function presetList(selection2) {
70555       if (!_entityIDs) return;
70556       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
70557       selection2.html("");
70558       var messagewrap = selection2.append("div").attr("class", "header fillL");
70559       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
70560       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
70561         dispatch14.call("cancel", this);
70562       }).call(svgIcon("#iD-icon-close"));
70563       function initialKeydown(d3_event) {
70564         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
70565           d3_event.preventDefault();
70566           d3_event.stopPropagation();
70567           operationDelete(context, _entityIDs)();
70568         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
70569           d3_event.preventDefault();
70570           d3_event.stopPropagation();
70571           context.undo();
70572         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
70573           select_default2(this).on("keydown", keydown);
70574           keydown.call(this, d3_event);
70575         }
70576       }
70577       function keydown(d3_event) {
70578         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
70579         search.node().selectionStart === search.property("value").length) {
70580           d3_event.preventDefault();
70581           d3_event.stopPropagation();
70582           var buttons = list2.selectAll(".preset-list-button");
70583           if (!buttons.empty()) buttons.nodes()[0].focus();
70584         }
70585       }
70586       function keypress(d3_event) {
70587         var value = search.property("value");
70588         if (d3_event.keyCode === 13 && // ↩ Return
70589         value.length) {
70590           list2.selectAll(".preset-list-item:first-child").each(function(d2) {
70591             d2.choose.call(this);
70592           });
70593         }
70594       }
70595       function inputevent() {
70596         var value = search.property("value");
70597         list2.classed("filtered", value.length);
70598         var results, messageText;
70599         if (value.length) {
70600           results = presets.search(value, entityGeometries()[0], _currLoc);
70601           messageText = _t.html("inspector.results", {
70602             n: results.collection.length,
70603             search: value
70604           });
70605         } else {
70606           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
70607           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
70608           messageText = _t.html("inspector.choose");
70609         }
70610         list2.call(drawList, results);
70611         message.html(messageText);
70612       }
70613       var searchWrap = selection2.append("div").attr("class", "search-header");
70614       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
70615       var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search_feature_type")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
70616       if (_autofocus) {
70617         search.node().focus();
70618         setTimeout(function() {
70619           search.node().focus();
70620         }, 0);
70621       }
70622       var listWrap = selection2.append("div").attr("class", "inspector-body");
70623       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
70624       var list2 = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
70625       context.features().on("change.preset-list", updateForFeatureHiddenState);
70626     }
70627     function drawList(list2, presets) {
70628       presets = presets.matchAllGeometry(entityGeometries());
70629       var collection = presets.collection.reduce(function(collection2, preset) {
70630         if (!preset) return collection2;
70631         if (preset.members) {
70632           if (preset.members.collection.filter(function(preset2) {
70633             return preset2.addable();
70634           }).length > 1) {
70635             collection2.push(CategoryItem(preset));
70636           }
70637         } else if (preset.addable()) {
70638           collection2.push(PresetItem(preset));
70639         }
70640         return collection2;
70641       }, []);
70642       var items = list2.selectAll(".preset-list-item").data(collection, function(d2) {
70643         return d2.preset.id;
70644       });
70645       items.order();
70646       items.exit().remove();
70647       items.enter().append("div").attr("class", function(item) {
70648         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
70649       }).classed("current", function(item) {
70650         return _currentPresets.indexOf(item.preset) !== -1;
70651       }).each(function(item) {
70652         select_default2(this).call(item);
70653       }).style("opacity", 0).transition().style("opacity", 1);
70654       updateForFeatureHiddenState();
70655     }
70656     function itemKeydown(d3_event) {
70657       var item = select_default2(this.closest(".preset-list-item"));
70658       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
70659       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
70660         d3_event.preventDefault();
70661         d3_event.stopPropagation();
70662         var nextItem = select_default2(item.node().nextElementSibling);
70663         if (nextItem.empty()) {
70664           if (!parentItem.empty()) {
70665             nextItem = select_default2(parentItem.node().nextElementSibling);
70666           }
70667         } else if (select_default2(this).classed("expanded")) {
70668           nextItem = item.select(".subgrid .preset-list-item:first-child");
70669         }
70670         if (!nextItem.empty()) {
70671           nextItem.select(".preset-list-button").node().focus();
70672         }
70673       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
70674         d3_event.preventDefault();
70675         d3_event.stopPropagation();
70676         var previousItem = select_default2(item.node().previousElementSibling);
70677         if (previousItem.empty()) {
70678           if (!parentItem.empty()) {
70679             previousItem = parentItem;
70680           }
70681         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
70682           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
70683         }
70684         if (!previousItem.empty()) {
70685           previousItem.select(".preset-list-button").node().focus();
70686         } else {
70687           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
70688           search.node().focus();
70689         }
70690       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
70691         d3_event.preventDefault();
70692         d3_event.stopPropagation();
70693         if (!parentItem.empty()) {
70694           parentItem.select(".preset-list-button").node().focus();
70695         }
70696       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
70697         d3_event.preventDefault();
70698         d3_event.stopPropagation();
70699         item.datum().choose.call(select_default2(this).node());
70700       }
70701     }
70702     function CategoryItem(preset) {
70703       var box, sublist, shown = false;
70704       function item(selection2) {
70705         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
70706         function click() {
70707           var isExpanded = select_default2(this).classed("expanded");
70708           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
70709           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
70710           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
70711           item.choose();
70712         }
70713         var geometries = entityGeometries();
70714         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) {
70715           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
70716             d3_event.preventDefault();
70717             d3_event.stopPropagation();
70718             if (!select_default2(this).classed("expanded")) {
70719               click.call(this, d3_event);
70720             }
70721           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
70722             d3_event.preventDefault();
70723             d3_event.stopPropagation();
70724             if (select_default2(this).classed("expanded")) {
70725               click.call(this, d3_event);
70726             }
70727           } else {
70728             itemKeydown.call(this, d3_event);
70729           }
70730         });
70731         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
70732         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");
70733         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
70734         box.append("div").attr("class", "arrow");
70735         sublist = box.append("div").attr("class", "preset-list fillL3");
70736       }
70737       item.choose = function() {
70738         if (!box || !sublist) return;
70739         if (shown) {
70740           shown = false;
70741           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
70742         } else {
70743           shown = true;
70744           var members = preset.members.matchAllGeometry(entityGeometries());
70745           sublist.call(drawList, members);
70746           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
70747         }
70748       };
70749       item.preset = preset;
70750       return item;
70751     }
70752     function PresetItem(preset) {
70753       function item(selection2) {
70754         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
70755         var geometries = entityGeometries();
70756         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);
70757         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
70758         var nameparts = [
70759           preset.nameLabel(),
70760           preset.subtitleLabel()
70761         ].filter(Boolean);
70762         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
70763           d2(select_default2(this));
70764         });
70765         wrap2.call(item.reference.button);
70766         selection2.call(item.reference.body);
70767       }
70768       item.choose = function() {
70769         if (select_default2(this).classed("disabled")) return;
70770         if (!context.inIntro()) {
70771           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
70772         }
70773         context.perform(
70774           function(graph) {
70775             for (var i3 in _entityIDs) {
70776               var entityID = _entityIDs[i3];
70777               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
70778               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
70779             }
70780             return graph;
70781           },
70782           _t("operations.change_tags.annotation")
70783         );
70784         context.validator().validate();
70785         dispatch14.call("choose", this, preset);
70786       };
70787       item.help = function(d3_event) {
70788         d3_event.stopPropagation();
70789         item.reference.toggle();
70790       };
70791       item.preset = preset;
70792       item.reference = uiTagReference(preset.reference(), context);
70793       return item;
70794     }
70795     function updateForFeatureHiddenState() {
70796       if (!_entityIDs.every(context.hasEntity)) return;
70797       var geometries = entityGeometries();
70798       var button = context.container().selectAll(".preset-list .preset-list-button");
70799       button.call(uiTooltip().destroyAny);
70800       button.each(function(item, index) {
70801         var hiddenPresetFeaturesId;
70802         for (var i3 in geometries) {
70803           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
70804           if (hiddenPresetFeaturesId) break;
70805         }
70806         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
70807         select_default2(this).classed("disabled", isHiddenPreset);
70808         if (isHiddenPreset) {
70809           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
70810           select_default2(this).call(
70811             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
70812               features: _t("feature." + hiddenPresetFeaturesId + ".description")
70813             })).placement(index < 2 ? "bottom" : "top")
70814           );
70815         }
70816       });
70817     }
70818     presetList.autofocus = function(val) {
70819       if (!arguments.length) return _autofocus;
70820       _autofocus = val;
70821       return presetList;
70822     };
70823     presetList.entityIDs = function(val) {
70824       if (!arguments.length) return _entityIDs;
70825       _entityIDs = val;
70826       _currLoc = null;
70827       if (_entityIDs && _entityIDs.length) {
70828         const extent = _entityIDs.reduce(function(extent2, entityID) {
70829           var entity = context.graph().entity(entityID);
70830           return extent2.extend(entity.extent(context.graph()));
70831         }, geoExtent());
70832         _currLoc = extent.center();
70833         var presets = _entityIDs.map(function(entityID) {
70834           return _mainPresetIndex.match(context.entity(entityID), context.graph());
70835         });
70836         presetList.presets(presets);
70837       }
70838       return presetList;
70839     };
70840     presetList.presets = function(val) {
70841       if (!arguments.length) return _currentPresets;
70842       _currentPresets = val;
70843       return presetList;
70844     };
70845     function entityGeometries() {
70846       var counts = {};
70847       for (var i3 in _entityIDs) {
70848         var entityID = _entityIDs[i3];
70849         var entity = context.entity(entityID);
70850         var geometry = entity.geometry(context.graph());
70851         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
70852           geometry = "point";
70853         }
70854         if (!counts[geometry]) counts[geometry] = 0;
70855         counts[geometry] += 1;
70856       }
70857       return Object.keys(counts).sort(function(geom1, geom2) {
70858         return counts[geom2] - counts[geom1];
70859       });
70860     }
70861     return utilRebind(presetList, dispatch14, "on");
70862   }
70863   var init_preset_list = __esm({
70864     "modules/ui/preset_list.js"() {
70865       "use strict";
70866       init_src4();
70867       init_src5();
70868       init_debounce();
70869       init_presets();
70870       init_localizer();
70871       init_change_preset();
70872       init_delete();
70873       init_svg();
70874       init_tooltip();
70875       init_extent();
70876       init_preset_icon();
70877       init_tag_reference();
70878       init_util();
70879     }
70880   });
70881
70882   // modules/ui/inspector.js
70883   var inspector_exports = {};
70884   __export(inspector_exports, {
70885     uiInspector: () => uiInspector
70886   });
70887   function uiInspector(context) {
70888     var presetList = uiPresetList(context);
70889     var entityEditor = uiEntityEditor(context);
70890     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
70891     var _state = "select";
70892     var _entityIDs;
70893     var _newFeature = false;
70894     function inspector(selection2) {
70895       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
70896         inspector.setPreset();
70897       });
70898       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
70899       wrap2 = selection2.selectAll(".panewrap").data([0]);
70900       var enter = wrap2.enter().append("div").attr("class", "panewrap");
70901       enter.append("div").attr("class", "preset-list-pane pane");
70902       enter.append("div").attr("class", "entity-editor-pane pane");
70903       wrap2 = wrap2.merge(enter);
70904       presetPane = wrap2.selectAll(".preset-list-pane");
70905       editorPane = wrap2.selectAll(".entity-editor-pane");
70906       function shouldDefaultToPresetList() {
70907         if (_state !== "select") return false;
70908         if (_entityIDs.length !== 1) return false;
70909         var entityID = _entityIDs[0];
70910         var entity = context.hasEntity(entityID);
70911         if (!entity) return false;
70912         if (entity.hasNonGeometryTags()) return false;
70913         if (_newFeature) return true;
70914         if (entity.geometry(context.graph()) !== "vertex") return false;
70915         if (context.graph().parentRelations(entity).length) return false;
70916         if (context.validator().getEntityIssues(entityID).length) return false;
70917         if (entity.type === "node" && entity.isHighwayIntersection(context.graph())) return false;
70918         return true;
70919       }
70920       if (shouldDefaultToPresetList()) {
70921         wrap2.style("right", "-100%");
70922         editorPane.classed("hide", true);
70923         presetPane.classed("hide", false).call(presetList);
70924       } else {
70925         wrap2.style("right", "0%");
70926         presetPane.classed("hide", true);
70927         editorPane.classed("hide", false).call(entityEditor);
70928       }
70929       var footer = selection2.selectAll(".footer").data([0]);
70930       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
70931       footer.call(
70932         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
70933       );
70934     }
70935     inspector.showList = function(presets) {
70936       presetPane.classed("hide", false);
70937       wrap2.transition().styleTween("right", function() {
70938         return value_default("0%", "-100%");
70939       }).on("end", function() {
70940         editorPane.classed("hide", true);
70941       });
70942       if (presets) {
70943         presetList.presets(presets);
70944       }
70945       presetPane.call(presetList.autofocus(true));
70946     };
70947     inspector.setPreset = function(preset) {
70948       if (preset && preset.id === "type/multipolygon") {
70949         presetPane.call(presetList.autofocus(true));
70950       } else {
70951         editorPane.classed("hide", false);
70952         wrap2.transition().styleTween("right", function() {
70953           return value_default("-100%", "0%");
70954         }).on("end", function() {
70955           presetPane.classed("hide", true);
70956         });
70957         if (preset) {
70958           entityEditor.presets([preset]);
70959         }
70960         editorPane.call(entityEditor);
70961       }
70962     };
70963     inspector.state = function(val) {
70964       if (!arguments.length) return _state;
70965       _state = val;
70966       entityEditor.state(_state);
70967       context.container().selectAll(".field-help-body").remove();
70968       return inspector;
70969     };
70970     inspector.entityIDs = function(val) {
70971       if (!arguments.length) return _entityIDs;
70972       _entityIDs = val;
70973       return inspector;
70974     };
70975     inspector.newFeature = function(val) {
70976       if (!arguments.length) return _newFeature;
70977       _newFeature = val;
70978       return inspector;
70979     };
70980     return inspector;
70981   }
70982   var init_inspector = __esm({
70983     "modules/ui/inspector.js"() {
70984       "use strict";
70985       init_src8();
70986       init_src5();
70987       init_entity_editor();
70988       init_preset_list();
70989       init_view_on_osm();
70990     }
70991   });
70992
70993   // modules/ui/keepRight_details.js
70994   var keepRight_details_exports = {};
70995   __export(keepRight_details_exports, {
70996     uiKeepRightDetails: () => uiKeepRightDetails
70997   });
70998   function uiKeepRightDetails(context) {
70999     let _qaItem;
71000     function issueDetail(d2) {
71001       const { itemType, parentIssueType } = d2;
71002       const unknown = { html: _t.html("inspector.unknown") };
71003       let replacements = d2.replacements || {};
71004       replacements.default = unknown;
71005       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
71006         return _t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements);
71007       } else {
71008         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements);
71009       }
71010     }
71011     function keepRightDetails(selection2) {
71012       const details = selection2.selectAll(".error-details").data(
71013         _qaItem ? [_qaItem] : [],
71014         (d2) => `${d2.id}-${d2.status || 0}`
71015       );
71016       details.exit().remove();
71017       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
71018       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
71019       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
71020       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
71021       let relatedEntities = [];
71022       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
71023         const link3 = select_default2(this);
71024         const isObjectLink = link3.classed("error_object_link");
71025         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
71026         const entity = context.hasEntity(entityID);
71027         relatedEntities.push(entityID);
71028         link3.on("mouseenter", () => {
71029           utilHighlightEntities([entityID], true, context);
71030         }).on("mouseleave", () => {
71031           utilHighlightEntities([entityID], false, context);
71032         }).on("click", (d3_event) => {
71033           d3_event.preventDefault();
71034           utilHighlightEntities([entityID], false, context);
71035           const osmlayer = context.layers().layer("osm");
71036           if (!osmlayer.enabled()) {
71037             osmlayer.enabled(true);
71038           }
71039           context.map().centerZoomEase(_qaItem.loc, 20);
71040           if (entity) {
71041             context.enter(modeSelect(context, [entityID]));
71042           } else {
71043             context.loadEntity(entityID, (err, result) => {
71044               if (err) return;
71045               const entity2 = result.data.find((e3) => e3.id === entityID);
71046               if (entity2) context.enter(modeSelect(context, [entityID]));
71047             });
71048           }
71049         });
71050         if (entity) {
71051           let name = utilDisplayName(entity);
71052           if (!name && !isObjectLink) {
71053             const preset = _mainPresetIndex.match(entity, context.graph());
71054             name = preset && !preset.isFallback() && preset.name();
71055           }
71056           if (name) {
71057             this.innerText = name;
71058           }
71059         }
71060       });
71061       context.features().forceVisible(relatedEntities);
71062       context.map().pan([0, 0]);
71063     }
71064     keepRightDetails.issue = function(val) {
71065       if (!arguments.length) return _qaItem;
71066       _qaItem = val;
71067       return keepRightDetails;
71068     };
71069     return keepRightDetails;
71070   }
71071   var init_keepRight_details = __esm({
71072     "modules/ui/keepRight_details.js"() {
71073       "use strict";
71074       init_src5();
71075       init_presets();
71076       init_select5();
71077       init_localizer();
71078       init_util();
71079     }
71080   });
71081
71082   // modules/ui/keepRight_header.js
71083   var keepRight_header_exports = {};
71084   __export(keepRight_header_exports, {
71085     uiKeepRightHeader: () => uiKeepRightHeader
71086   });
71087   function uiKeepRightHeader() {
71088     let _qaItem;
71089     function issueTitle(d2) {
71090       const { itemType, parentIssueType } = d2;
71091       const unknown = _t.html("inspector.unknown");
71092       let replacements = d2.replacements || {};
71093       replacements.default = { html: unknown };
71094       if (_mainLocalizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) {
71095         return _t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements);
71096       } else {
71097         return _t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements);
71098       }
71099     }
71100     function keepRightHeader(selection2) {
71101       const header = selection2.selectAll(".qa-header").data(
71102         _qaItem ? [_qaItem] : [],
71103         (d2) => `${d2.id}-${d2.status || 0}`
71104       );
71105       header.exit().remove();
71106       const headerEnter = header.enter().append("div").attr("class", "qa-header");
71107       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
71108       iconEnter.append("div").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.parentIssueType}`).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
71109       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
71110     }
71111     keepRightHeader.issue = function(val) {
71112       if (!arguments.length) return _qaItem;
71113       _qaItem = val;
71114       return keepRightHeader;
71115     };
71116     return keepRightHeader;
71117   }
71118   var init_keepRight_header = __esm({
71119     "modules/ui/keepRight_header.js"() {
71120       "use strict";
71121       init_icon();
71122       init_localizer();
71123     }
71124   });
71125
71126   // modules/ui/view_on_keepRight.js
71127   var view_on_keepRight_exports = {};
71128   __export(view_on_keepRight_exports, {
71129     uiViewOnKeepRight: () => uiViewOnKeepRight
71130   });
71131   function uiViewOnKeepRight() {
71132     let _qaItem;
71133     function viewOnKeepRight(selection2) {
71134       let url;
71135       if (services.keepRight && _qaItem instanceof QAItem) {
71136         url = services.keepRight.issueURL(_qaItem);
71137       }
71138       const link3 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
71139       link3.exit().remove();
71140       const linkEnter = link3.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
71141       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
71142     }
71143     viewOnKeepRight.what = function(val) {
71144       if (!arguments.length) return _qaItem;
71145       _qaItem = val;
71146       return viewOnKeepRight;
71147     };
71148     return viewOnKeepRight;
71149   }
71150   var init_view_on_keepRight = __esm({
71151     "modules/ui/view_on_keepRight.js"() {
71152       "use strict";
71153       init_localizer();
71154       init_services();
71155       init_icon();
71156       init_osm();
71157     }
71158   });
71159
71160   // modules/ui/keepRight_editor.js
71161   var keepRight_editor_exports = {};
71162   __export(keepRight_editor_exports, {
71163     uiKeepRightEditor: () => uiKeepRightEditor
71164   });
71165   function uiKeepRightEditor(context) {
71166     const dispatch14 = dispatch_default("change");
71167     const qaDetails = uiKeepRightDetails(context);
71168     const qaHeader = uiKeepRightHeader(context);
71169     let _qaItem;
71170     function keepRightEditor(selection2) {
71171       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
71172       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
71173       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
71174       let body = selection2.selectAll(".body").data([0]);
71175       body = body.enter().append("div").attr("class", "body").merge(body);
71176       const editor = body.selectAll(".qa-editor").data([0]);
71177       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
71178       const footer = selection2.selectAll(".footer").data([0]);
71179       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
71180     }
71181     function keepRightSaveSection(selection2) {
71182       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71183       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
71184       let saveSection = selection2.selectAll(".qa-save").data(
71185         isShown ? [_qaItem] : [],
71186         (d2) => `${d2.id}-${d2.status || 0}`
71187       );
71188       saveSection.exit().remove();
71189       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
71190       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
71191       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);
71192       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
71193       function changeInput() {
71194         const input = select_default2(this);
71195         let val = input.property("value").trim();
71196         if (val === _qaItem.comment) {
71197           val = void 0;
71198         }
71199         _qaItem = _qaItem.update({ newComment: val });
71200         const qaService = services.keepRight;
71201         if (qaService) {
71202           qaService.replaceItem(_qaItem);
71203         }
71204         saveSection.call(qaSaveButtons);
71205       }
71206     }
71207     function qaSaveButtons(selection2) {
71208       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71209       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
71210       buttonSection.exit().remove();
71211       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71212       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
71213       buttonEnter.append("button").attr("class", "button close-button action");
71214       buttonEnter.append("button").attr("class", "button ignore-button action");
71215       buttonSection = buttonSection.merge(buttonEnter);
71216       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
71217         this.blur();
71218         const qaService = services.keepRight;
71219         if (qaService) {
71220           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71221         }
71222       });
71223       buttonSection.select(".close-button").html((d2) => {
71224         const andComment = d2.newComment ? "_comment" : "";
71225         return _t.html(`QA.keepRight.close${andComment}`);
71226       }).on("click.close", function(d3_event, d2) {
71227         this.blur();
71228         const qaService = services.keepRight;
71229         if (qaService) {
71230           d2.newStatus = "ignore_t";
71231           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71232         }
71233       });
71234       buttonSection.select(".ignore-button").html((d2) => {
71235         const andComment = d2.newComment ? "_comment" : "";
71236         return _t.html(`QA.keepRight.ignore${andComment}`);
71237       }).on("click.ignore", function(d3_event, d2) {
71238         this.blur();
71239         const qaService = services.keepRight;
71240         if (qaService) {
71241           d2.newStatus = "ignore";
71242           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71243         }
71244       });
71245     }
71246     keepRightEditor.error = function(val) {
71247       if (!arguments.length) return _qaItem;
71248       _qaItem = val;
71249       return keepRightEditor;
71250     };
71251     return utilRebind(keepRightEditor, dispatch14, "on");
71252   }
71253   var init_keepRight_editor = __esm({
71254     "modules/ui/keepRight_editor.js"() {
71255       "use strict";
71256       init_src4();
71257       init_src5();
71258       init_localizer();
71259       init_services();
71260       init_browse();
71261       init_icon();
71262       init_keepRight_details();
71263       init_keepRight_header();
71264       init_view_on_keepRight();
71265       init_util();
71266     }
71267   });
71268
71269   // modules/ui/osmose_details.js
71270   var osmose_details_exports = {};
71271   __export(osmose_details_exports, {
71272     uiOsmoseDetails: () => uiOsmoseDetails
71273   });
71274   function uiOsmoseDetails(context) {
71275     let _qaItem;
71276     function issueString(d2, type2) {
71277       if (!d2) return "";
71278       const s2 = services.osmose.getStrings(d2.itemType);
71279       return type2 in s2 ? s2[type2] : "";
71280     }
71281     function osmoseDetails(selection2) {
71282       const details = selection2.selectAll(".error-details").data(
71283         _qaItem ? [_qaItem] : [],
71284         (d2) => `${d2.id}-${d2.status || 0}`
71285       );
71286       details.exit().remove();
71287       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
71288       if (issueString(_qaItem, "detail")) {
71289         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71290         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
71291         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71292       }
71293       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
71294       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
71295       if (issueString(_qaItem, "fix")) {
71296         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71297         div.append("h4").call(_t.append("QA.osmose.fix_title"));
71298         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71299       }
71300       if (issueString(_qaItem, "trap")) {
71301         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
71302         div.append("h4").call(_t.append("QA.osmose.trap_title"));
71303         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71304       }
71305       const thisItem = _qaItem;
71306       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
71307         if (!d2.elems || d2.elems.length === 0) return;
71308         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(`.qaItem.osmose.hover.itemId-${thisItem.id}`).empty()) return;
71309         if (d2.detail) {
71310           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
71311           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
71312         }
71313         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
71314         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() {
71315           const link3 = select_default2(this);
71316           const entityID = this.textContent;
71317           const entity = context.hasEntity(entityID);
71318           link3.on("mouseenter", () => {
71319             utilHighlightEntities([entityID], true, context);
71320           }).on("mouseleave", () => {
71321             utilHighlightEntities([entityID], false, context);
71322           }).on("click", (d3_event) => {
71323             d3_event.preventDefault();
71324             utilHighlightEntities([entityID], false, context);
71325             const osmlayer = context.layers().layer("osm");
71326             if (!osmlayer.enabled()) {
71327               osmlayer.enabled(true);
71328             }
71329             context.map().centerZoom(d2.loc, 20);
71330             if (entity) {
71331               context.enter(modeSelect(context, [entityID]));
71332             } else {
71333               context.loadEntity(entityID, (err, result) => {
71334                 if (err) return;
71335                 const entity2 = result.data.find((e3) => e3.id === entityID);
71336                 if (entity2) context.enter(modeSelect(context, [entityID]));
71337               });
71338             }
71339           });
71340           if (entity) {
71341             let name = utilDisplayName(entity);
71342             if (!name) {
71343               const preset = _mainPresetIndex.match(entity, context.graph());
71344               name = preset && !preset.isFallback() && preset.name();
71345             }
71346             if (name) {
71347               this.innerText = name;
71348             }
71349           }
71350         });
71351         context.features().forceVisible(d2.elems);
71352         context.map().pan([0, 0]);
71353       }).catch((err) => {
71354         console.log(err);
71355       });
71356     }
71357     osmoseDetails.issue = function(val) {
71358       if (!arguments.length) return _qaItem;
71359       _qaItem = val;
71360       return osmoseDetails;
71361     };
71362     return osmoseDetails;
71363   }
71364   var init_osmose_details = __esm({
71365     "modules/ui/osmose_details.js"() {
71366       "use strict";
71367       init_src5();
71368       init_presets();
71369       init_select5();
71370       init_localizer();
71371       init_services();
71372       init_util();
71373     }
71374   });
71375
71376   // modules/ui/osmose_header.js
71377   var osmose_header_exports = {};
71378   __export(osmose_header_exports, {
71379     uiOsmoseHeader: () => uiOsmoseHeader
71380   });
71381   function uiOsmoseHeader() {
71382     let _qaItem;
71383     function issueTitle(d2) {
71384       const unknown = _t("inspector.unknown");
71385       if (!d2) return unknown;
71386       const s2 = services.osmose.getStrings(d2.itemType);
71387       return "title" in s2 ? s2.title : unknown;
71388     }
71389     function osmoseHeader(selection2) {
71390       const header = selection2.selectAll(".qa-header").data(
71391         _qaItem ? [_qaItem] : [],
71392         (d2) => `${d2.id}-${d2.status || 0}`
71393       );
71394       header.exit().remove();
71395       const headerEnter = header.enter().append("div").attr("class", "qa-header");
71396       const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => `preset-icon-28 qaItem ${d2.service} itemId-${d2.id} itemType-${d2.itemType}`);
71397       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");
71398       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 : "");
71399       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
71400     }
71401     osmoseHeader.issue = function(val) {
71402       if (!arguments.length) return _qaItem;
71403       _qaItem = val;
71404       return osmoseHeader;
71405     };
71406     return osmoseHeader;
71407   }
71408   var init_osmose_header = __esm({
71409     "modules/ui/osmose_header.js"() {
71410       "use strict";
71411       init_services();
71412       init_localizer();
71413     }
71414   });
71415
71416   // modules/ui/view_on_osmose.js
71417   var view_on_osmose_exports = {};
71418   __export(view_on_osmose_exports, {
71419     uiViewOnOsmose: () => uiViewOnOsmose
71420   });
71421   function uiViewOnOsmose() {
71422     let _qaItem;
71423     function viewOnOsmose(selection2) {
71424       let url;
71425       if (services.osmose && _qaItem instanceof QAItem) {
71426         url = services.osmose.itemURL(_qaItem);
71427       }
71428       const link3 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
71429       link3.exit().remove();
71430       const linkEnter = link3.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
71431       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
71432     }
71433     viewOnOsmose.what = function(val) {
71434       if (!arguments.length) return _qaItem;
71435       _qaItem = val;
71436       return viewOnOsmose;
71437     };
71438     return viewOnOsmose;
71439   }
71440   var init_view_on_osmose = __esm({
71441     "modules/ui/view_on_osmose.js"() {
71442       "use strict";
71443       init_localizer();
71444       init_services();
71445       init_icon();
71446       init_osm();
71447     }
71448   });
71449
71450   // modules/ui/osmose_editor.js
71451   var osmose_editor_exports = {};
71452   __export(osmose_editor_exports, {
71453     uiOsmoseEditor: () => uiOsmoseEditor
71454   });
71455   function uiOsmoseEditor(context) {
71456     const dispatch14 = dispatch_default("change");
71457     const qaDetails = uiOsmoseDetails(context);
71458     const qaHeader = uiOsmoseHeader(context);
71459     let _qaItem;
71460     function osmoseEditor(selection2) {
71461       const header = selection2.selectAll(".header").data([0]);
71462       const headerEnter = header.enter().append("div").attr("class", "header fillL");
71463       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
71464       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
71465       let body = selection2.selectAll(".body").data([0]);
71466       body = body.enter().append("div").attr("class", "body").merge(body);
71467       let editor = body.selectAll(".qa-editor").data([0]);
71468       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
71469       const footer = selection2.selectAll(".footer").data([0]);
71470       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
71471     }
71472     function osmoseSaveSection(selection2) {
71473       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71474       const isShown = _qaItem && isSelected;
71475       let saveSection = selection2.selectAll(".qa-save").data(
71476         isShown ? [_qaItem] : [],
71477         (d2) => `${d2.id}-${d2.status || 0}`
71478       );
71479       saveSection.exit().remove();
71480       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
71481       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
71482     }
71483     function qaSaveButtons(selection2) {
71484       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71485       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
71486       buttonSection.exit().remove();
71487       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71488       buttonEnter.append("button").attr("class", "button close-button action");
71489       buttonEnter.append("button").attr("class", "button ignore-button action");
71490       buttonSection = buttonSection.merge(buttonEnter);
71491       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
71492         this.blur();
71493         const qaService = services.osmose;
71494         if (qaService) {
71495           d2.newStatus = "done";
71496           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71497         }
71498       });
71499       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
71500         this.blur();
71501         const qaService = services.osmose;
71502         if (qaService) {
71503           d2.newStatus = "false";
71504           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
71505         }
71506       });
71507     }
71508     osmoseEditor.error = function(val) {
71509       if (!arguments.length) return _qaItem;
71510       _qaItem = val;
71511       return osmoseEditor;
71512     };
71513     return utilRebind(osmoseEditor, dispatch14, "on");
71514   }
71515   var init_osmose_editor = __esm({
71516     "modules/ui/osmose_editor.js"() {
71517       "use strict";
71518       init_src4();
71519       init_localizer();
71520       init_services();
71521       init_browse();
71522       init_icon();
71523       init_osmose_details();
71524       init_osmose_header();
71525       init_view_on_osmose();
71526       init_util();
71527     }
71528   });
71529
71530   // modules/ui/sidebar.js
71531   var sidebar_exports = {};
71532   __export(sidebar_exports, {
71533     uiSidebar: () => uiSidebar
71534   });
71535   function uiSidebar(context) {
71536     var inspector = uiInspector(context);
71537     var dataEditor = uiDataEditor(context);
71538     var noteEditor = uiNoteEditor(context);
71539     var keepRightEditor = uiKeepRightEditor(context);
71540     var osmoseEditor = uiOsmoseEditor(context);
71541     var _current;
71542     var _wasData = false;
71543     var _wasNote = false;
71544     var _wasQaItem = false;
71545     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
71546     function sidebar(selection2) {
71547       var container = context.container();
71548       var minWidth = 240;
71549       var sidebarWidth;
71550       var containerWidth;
71551       var dragOffset;
71552       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
71553       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
71554       var downPointerId, lastClientX, containerLocGetter;
71555       function pointerdown(d3_event) {
71556         if (downPointerId) return;
71557         if ("button" in d3_event && d3_event.button !== 0) return;
71558         downPointerId = d3_event.pointerId || "mouse";
71559         lastClientX = d3_event.clientX;
71560         containerLocGetter = utilFastMouse(container.node());
71561         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
71562         sidebarWidth = selection2.node().getBoundingClientRect().width;
71563         containerWidth = container.node().getBoundingClientRect().width;
71564         var widthPct = sidebarWidth / containerWidth * 100;
71565         selection2.style("width", widthPct + "%").style("max-width", "85%");
71566         resizer.classed("dragging", true);
71567         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
71568           d3_event2.preventDefault();
71569         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
71570       }
71571       function pointermove(d3_event) {
71572         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
71573         d3_event.preventDefault();
71574         var dx = d3_event.clientX - lastClientX;
71575         lastClientX = d3_event.clientX;
71576         var isRTL = _mainLocalizer.textDirection() === "rtl";
71577         var scaleX = isRTL ? 0 : 1;
71578         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71579         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
71580         sidebarWidth = isRTL ? containerWidth - x2 : x2;
71581         var isCollapsed = selection2.classed("collapsed");
71582         var shouldCollapse = sidebarWidth < minWidth;
71583         selection2.classed("collapsed", shouldCollapse);
71584         if (shouldCollapse) {
71585           if (!isCollapsed) {
71586             selection2.style(xMarginProperty, "-400px").style("width", "400px");
71587             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
71588           }
71589         } else {
71590           var widthPct = sidebarWidth / containerWidth * 100;
71591           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71592           if (isCollapsed) {
71593             context.ui().onResize([-sidebarWidth * scaleX, 0]);
71594           } else {
71595             context.ui().onResize([-dx * scaleX, 0]);
71596           }
71597         }
71598       }
71599       function pointerup(d3_event) {
71600         if (downPointerId !== (d3_event.pointerId || "mouse")) return;
71601         downPointerId = null;
71602         resizer.classed("dragging", false);
71603         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
71604       }
71605       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
71606       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
71607       var hoverModeSelect = function(targets) {
71608         context.container().selectAll(".feature-list-item button").classed("hover", false);
71609         if (context.selectedIDs().length > 1 && targets && targets.length) {
71610           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
71611             return targets.indexOf(node) !== -1;
71612           });
71613           if (!elements.empty()) {
71614             elements.classed("hover", true);
71615           }
71616         }
71617       };
71618       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
71619       function hover(targets) {
71620         var datum2 = targets && targets.length && targets[0];
71621         if (datum2 && datum2.__featurehash__) {
71622           _wasData = true;
71623           sidebar.show(dataEditor.datum(datum2));
71624           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71625         } else if (datum2 instanceof osmNote) {
71626           if (context.mode().id === "drag-note") return;
71627           _wasNote = true;
71628           var osm = services.osm;
71629           if (osm) {
71630             datum2 = osm.getNote(datum2.id);
71631           }
71632           sidebar.show(noteEditor.note(datum2));
71633           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71634         } else if (datum2 instanceof QAItem) {
71635           _wasQaItem = true;
71636           var errService = services[datum2.service];
71637           if (errService) {
71638             datum2 = errService.getError(datum2.id);
71639           }
71640           var errEditor;
71641           if (datum2.service === "keepRight") {
71642             errEditor = keepRightEditor;
71643           } else {
71644             errEditor = osmoseEditor;
71645           }
71646           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
71647             return d2.id === datum2.id;
71648           });
71649           sidebar.show(errEditor.error(datum2));
71650           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71651         } else if (!_current && datum2 instanceof osmEntity) {
71652           featureListWrap.classed("inspector-hidden", true);
71653           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
71654           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
71655             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
71656             inspectorWrap.call(inspector);
71657           }
71658         } else if (!_current) {
71659           featureListWrap.classed("inspector-hidden", false);
71660           inspectorWrap.classed("inspector-hidden", true);
71661           inspector.state("hide");
71662         } else if (_wasData || _wasNote || _wasQaItem) {
71663           _wasNote = false;
71664           _wasData = false;
71665           _wasQaItem = false;
71666           context.container().selectAll(".note").classed("hover", false);
71667           context.container().selectAll(".qaItem").classed("hover", false);
71668           sidebar.hide();
71669         }
71670       }
71671       sidebar.hover = throttle_default(hover, 200);
71672       sidebar.intersects = function(extent) {
71673         var rect = selection2.node().getBoundingClientRect();
71674         return extent.intersects([
71675           context.projection.invert([0, rect.height]),
71676           context.projection.invert([rect.width, 0])
71677         ]);
71678       };
71679       sidebar.select = function(ids, newFeature) {
71680         sidebar.hide();
71681         if (ids && ids.length) {
71682           var entity = ids.length === 1 && context.entity(ids[0]);
71683           if (entity && newFeature && selection2.classed("collapsed")) {
71684             var extent = entity.extent(context.graph());
71685             sidebar.expand(sidebar.intersects(extent));
71686           }
71687           featureListWrap.classed("inspector-hidden", true);
71688           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
71689           inspector.state("select").entityIDs(ids).newFeature(newFeature);
71690           inspectorWrap.call(inspector);
71691         } else {
71692           inspector.state("hide");
71693         }
71694       };
71695       sidebar.showPresetList = function() {
71696         inspector.showList();
71697       };
71698       sidebar.show = function(component, element) {
71699         featureListWrap.classed("inspector-hidden", true);
71700         inspectorWrap.classed("inspector-hidden", true);
71701         if (_current) _current.remove();
71702         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
71703       };
71704       sidebar.hide = function() {
71705         featureListWrap.classed("inspector-hidden", false);
71706         inspectorWrap.classed("inspector-hidden", true);
71707         if (_current) _current.remove();
71708         _current = null;
71709       };
71710       sidebar.expand = function(moveMap) {
71711         if (selection2.classed("collapsed")) {
71712           sidebar.toggle(moveMap);
71713         }
71714       };
71715       sidebar.collapse = function(moveMap) {
71716         if (!selection2.classed("collapsed")) {
71717           sidebar.toggle(moveMap);
71718         }
71719       };
71720       sidebar.toggle = function(moveMap) {
71721         if (context.inIntro()) return;
71722         var isCollapsed = selection2.classed("collapsed");
71723         var isCollapsing = !isCollapsed;
71724         var isRTL = _mainLocalizer.textDirection() === "rtl";
71725         var scaleX = isRTL ? 0 : 1;
71726         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71727         sidebarWidth = selection2.node().getBoundingClientRect().width;
71728         selection2.style("width", sidebarWidth + "px");
71729         var startMargin, endMargin, lastMargin;
71730         if (isCollapsing) {
71731           startMargin = lastMargin = 0;
71732           endMargin = -sidebarWidth;
71733         } else {
71734           startMargin = lastMargin = -sidebarWidth;
71735           endMargin = 0;
71736         }
71737         if (!isCollapsing) {
71738           selection2.classed("collapsed", isCollapsing);
71739         }
71740         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
71741           var i3 = number_default(startMargin, endMargin);
71742           return function(t2) {
71743             var dx = lastMargin - Math.round(i3(t2));
71744             lastMargin = lastMargin - dx;
71745             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
71746           };
71747         }).on("end", function() {
71748           if (isCollapsing) {
71749             selection2.classed("collapsed", isCollapsing);
71750           }
71751           if (!isCollapsing) {
71752             var containerWidth2 = container.node().getBoundingClientRect().width;
71753             var widthPct = sidebarWidth / containerWidth2 * 100;
71754             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71755           }
71756         });
71757       };
71758       resizer.on("dblclick", function(d3_event) {
71759         d3_event.preventDefault();
71760         if (d3_event.sourceEvent) {
71761           d3_event.sourceEvent.preventDefault();
71762         }
71763         sidebar.toggle();
71764       });
71765       context.map().on("crossEditableZoom.sidebar", function(within) {
71766         if (!within && !selection2.select(".inspector-hover").empty()) {
71767           hover([]);
71768         }
71769       });
71770     }
71771     sidebar.showPresetList = function() {
71772     };
71773     sidebar.hover = function() {
71774     };
71775     sidebar.hover.cancel = function() {
71776     };
71777     sidebar.intersects = function() {
71778     };
71779     sidebar.select = function() {
71780     };
71781     sidebar.show = function() {
71782     };
71783     sidebar.hide = function() {
71784     };
71785     sidebar.expand = function() {
71786     };
71787     sidebar.collapse = function() {
71788     };
71789     sidebar.toggle = function() {
71790     };
71791     return sidebar;
71792   }
71793   var init_sidebar = __esm({
71794     "modules/ui/sidebar.js"() {
71795       "use strict";
71796       init_throttle();
71797       init_src8();
71798       init_src5();
71799       init_array3();
71800       init_util();
71801       init_osm();
71802       init_services();
71803       init_data_editor();
71804       init_feature_list();
71805       init_inspector();
71806       init_keepRight_editor();
71807       init_osmose_editor();
71808       init_note_editor();
71809       init_localizer();
71810     }
71811   });
71812
71813   // modules/ui/source_switch.js
71814   var source_switch_exports = {};
71815   __export(source_switch_exports, {
71816     uiSourceSwitch: () => uiSourceSwitch
71817   });
71818   function uiSourceSwitch(context) {
71819     var keys2;
71820     function click(d3_event) {
71821       d3_event.preventDefault();
71822       var osm = context.connection();
71823       if (!osm) return;
71824       if (context.inIntro()) return;
71825       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
71826       var isLive = select_default2(this).classed("live");
71827       isLive = !isLive;
71828       context.enter(modeBrowse(context));
71829       context.history().clearSaved();
71830       context.flush();
71831       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
71832       osm.switch(isLive ? keys2[0] : keys2[1]);
71833     }
71834     var sourceSwitch = function(selection2) {
71835       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
71836     };
71837     sourceSwitch.keys = function(_2) {
71838       if (!arguments.length) return keys2;
71839       keys2 = _2;
71840       return sourceSwitch;
71841     };
71842     return sourceSwitch;
71843   }
71844   var init_source_switch = __esm({
71845     "modules/ui/source_switch.js"() {
71846       "use strict";
71847       init_src5();
71848       init_localizer();
71849       init_browse();
71850     }
71851   });
71852
71853   // modules/ui/spinner.js
71854   var spinner_exports = {};
71855   __export(spinner_exports, {
71856     uiSpinner: () => uiSpinner
71857   });
71858   function uiSpinner(context) {
71859     var osm = context.connection();
71860     return function(selection2) {
71861       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
71862       if (osm) {
71863         osm.on("loading.spinner", function() {
71864           img.transition().style("opacity", 1);
71865         }).on("loaded.spinner", function() {
71866           img.transition().style("opacity", 0);
71867         });
71868       }
71869     };
71870   }
71871   var init_spinner = __esm({
71872     "modules/ui/spinner.js"() {
71873       "use strict";
71874     }
71875   });
71876
71877   // modules/ui/sections/privacy.js
71878   var privacy_exports = {};
71879   __export(privacy_exports, {
71880     uiSectionPrivacy: () => uiSectionPrivacy
71881   });
71882   function uiSectionPrivacy(context) {
71883     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
71884     function renderDisclosureContent(selection2) {
71885       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
71886       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(
71887         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
71888       );
71889       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
71890         d3_event.preventDefault();
71891         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
71892       });
71893       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
71894       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
71895       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"));
71896     }
71897     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
71898     return section;
71899   }
71900   var init_privacy = __esm({
71901     "modules/ui/sections/privacy.js"() {
71902       "use strict";
71903       init_preferences();
71904       init_localizer();
71905       init_tooltip();
71906       init_icon();
71907       init_section();
71908     }
71909   });
71910
71911   // modules/ui/splash.js
71912   var splash_exports = {};
71913   __export(splash_exports, {
71914     uiSplash: () => uiSplash
71915   });
71916   function uiSplash(context) {
71917     return (selection2) => {
71918       if (context.history().hasRestorableChanges()) return;
71919       let updateMessage = "";
71920       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
71921       let showSplash = !corePreferences("sawSplash");
71922       if (sawPrivacyVersion && sawPrivacyVersion !== context.privacyVersion) {
71923         updateMessage = _t("splash.privacy_update");
71924         showSplash = true;
71925       }
71926       if (!showSplash) return;
71927       corePreferences("sawSplash", true);
71928       corePreferences("sawPrivacyVersion", context.privacyVersion);
71929       _mainFileFetcher.get("intro_graph");
71930       let modalSelection = uiModal(selection2);
71931       modalSelection.select(".modal").attr("class", "modal-splash modal");
71932       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
71933       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
71934       let modalSection = introModal.append("div").attr("class", "modal-section");
71935       modalSection.append("p").html(_t.html("splash.text", {
71936         version: context.version,
71937         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
71938         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
71939       }));
71940       modalSection.append("p").html(_t.html("splash.privacy", {
71941         updateMessage,
71942         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
71943       }));
71944       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
71945       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
71946       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
71947         context.container().call(uiIntro(context));
71948         modalSelection.close();
71949       });
71950       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
71951       walkthrough.append("div").call(_t.append("splash.walkthrough"));
71952       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
71953       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
71954       startEditing.append("div").call(_t.append("splash.start"));
71955       modalSelection.select("button.close").attr("class", "hide");
71956     };
71957   }
71958   var init_splash = __esm({
71959     "modules/ui/splash.js"() {
71960       "use strict";
71961       init_preferences();
71962       init_file_fetcher();
71963       init_localizer();
71964       init_intro2();
71965       init_modal();
71966       init_privacy();
71967     }
71968   });
71969
71970   // modules/ui/status.js
71971   var status_exports = {};
71972   __export(status_exports, {
71973     uiStatus: () => uiStatus
71974   });
71975   function uiStatus(context) {
71976     var osm = context.connection();
71977     return function(selection2) {
71978       if (!osm) return;
71979       function update(err, apiStatus) {
71980         selection2.html("");
71981         if (err) {
71982           if (apiStatus === "connectionSwitched") {
71983             return;
71984           } else if (apiStatus === "rateLimited") {
71985             if (!osm.authenticated()) {
71986               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) {
71987                 d3_event.preventDefault();
71988                 osm.authenticate();
71989               });
71990             } else {
71991               selection2.call(_t.append("osm_api_status.message.rateLimited"));
71992             }
71993           } else {
71994             var throttledRetry = throttle_default(function() {
71995               context.loadTiles(context.projection);
71996               osm.reloadApiStatus();
71997             }, 2e3);
71998             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) {
71999               d3_event.preventDefault();
72000               throttledRetry();
72001             });
72002           }
72003         } else if (apiStatus === "readonly") {
72004           selection2.call(_t.append("osm_api_status.message.readonly"));
72005         } else if (apiStatus === "offline") {
72006           selection2.call(_t.append("osm_api_status.message.offline"));
72007         }
72008         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
72009       }
72010       osm.on("apiStatusChange.uiStatus", update);
72011       context.history().on("storage_error", () => {
72012         selection2.selectAll("span.local-storage-full").remove();
72013         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
72014         selection2.classed("error", true);
72015       });
72016       window.setInterval(function() {
72017         osm.reloadApiStatus();
72018       }, 9e4);
72019       osm.reloadApiStatus();
72020     };
72021   }
72022   var init_status = __esm({
72023     "modules/ui/status.js"() {
72024       "use strict";
72025       init_throttle();
72026       init_localizer();
72027       init_icon();
72028     }
72029   });
72030
72031   // modules/ui/tools/modes.js
72032   var modes_exports = {};
72033   __export(modes_exports, {
72034     uiToolDrawModes: () => uiToolDrawModes
72035   });
72036   function uiToolDrawModes(context) {
72037     var tool = {
72038       id: "old_modes",
72039       label: _t.append("toolbar.add_feature")
72040     };
72041     var modes = [
72042       modeAddPoint(context, {
72043         title: _t.append("modes.add_point.title"),
72044         button: "point",
72045         description: _t.append("modes.add_point.description"),
72046         preset: _mainPresetIndex.item("point"),
72047         key: "1"
72048       }),
72049       modeAddLine(context, {
72050         title: _t.append("modes.add_line.title"),
72051         button: "line",
72052         description: _t.append("modes.add_line.description"),
72053         preset: _mainPresetIndex.item("line"),
72054         key: "2"
72055       }),
72056       modeAddArea(context, {
72057         title: _t.append("modes.add_area.title"),
72058         button: "area",
72059         description: _t.append("modes.add_area.description"),
72060         preset: _mainPresetIndex.item("area"),
72061         key: "3"
72062       })
72063     ];
72064     function enabled(_mode) {
72065       return osmEditable();
72066     }
72067     function osmEditable() {
72068       return context.editable();
72069     }
72070     modes.forEach(function(mode) {
72071       context.keybinding().on(mode.key, function() {
72072         if (!enabled(mode)) return;
72073         if (mode.id === context.mode().id) {
72074           context.enter(modeBrowse(context));
72075         } else {
72076           context.enter(mode);
72077         }
72078       });
72079     });
72080     tool.render = function(selection2) {
72081       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
72082       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72083       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
72084       context.on("enter.modes", update);
72085       update();
72086       function update() {
72087         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
72088           return d2.id;
72089         });
72090         buttons.exit().remove();
72091         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
72092           return d2.id + " add-button bar-button";
72093         }).on("click.mode-buttons", function(d3_event, d2) {
72094           if (!enabled(d2)) return;
72095           var currMode = context.mode().id;
72096           if (/^draw/.test(currMode)) return;
72097           if (d2.id === currMode) {
72098             context.enter(modeBrowse(context));
72099           } else {
72100             context.enter(d2);
72101           }
72102         }).call(
72103           uiTooltip().placement("bottom").title(function(d2) {
72104             return d2.description;
72105           }).keys(function(d2) {
72106             return [d2.key];
72107           }).scrollContainer(context.container().select(".top-toolbar"))
72108         );
72109         buttonsEnter.each(function(d2) {
72110           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
72111         });
72112         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
72113           mode.title(select_default2(this));
72114         });
72115         if (buttons.enter().size() || buttons.exit().size()) {
72116           context.ui().checkOverflow(".top-toolbar", true);
72117         }
72118         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
72119           return !enabled(d2);
72120         }).classed("disabled", function(d2) {
72121           return !enabled(d2);
72122         }).attr("aria-pressed", function(d2) {
72123           return context.mode() && context.mode().button === d2.button;
72124         }).classed("active", function(d2) {
72125           return context.mode() && context.mode().button === d2.button;
72126         });
72127       }
72128     };
72129     return tool;
72130   }
72131   var init_modes = __esm({
72132     "modules/ui/tools/modes.js"() {
72133       "use strict";
72134       init_debounce();
72135       init_src5();
72136       init_modes2();
72137       init_presets();
72138       init_localizer();
72139       init_svg();
72140       init_tooltip();
72141     }
72142   });
72143
72144   // modules/ui/tools/notes.js
72145   var notes_exports2 = {};
72146   __export(notes_exports2, {
72147     uiToolNotes: () => uiToolNotes
72148   });
72149   function uiToolNotes(context) {
72150     var tool = {
72151       id: "notes",
72152       label: _t.append("modes.add_note.label")
72153     };
72154     var mode = modeAddNote(context);
72155     function enabled() {
72156       return notesEnabled() && notesEditable();
72157     }
72158     function notesEnabled() {
72159       var noteLayer = context.layers().layer("notes");
72160       return noteLayer && noteLayer.enabled();
72161     }
72162     function notesEditable() {
72163       var mode2 = context.mode();
72164       return context.map().notesEditable() && mode2 && mode2.id !== "save";
72165     }
72166     context.keybinding().on(mode.key, function() {
72167       if (!enabled()) return;
72168       if (mode.id === context.mode().id) {
72169         context.enter(modeBrowse(context));
72170       } else {
72171         context.enter(mode);
72172       }
72173     });
72174     tool.render = function(selection2) {
72175       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72176       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
72177       context.on("enter.notes", update);
72178       update();
72179       function update() {
72180         var showNotes = notesEnabled();
72181         var data = showNotes ? [mode] : [];
72182         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
72183           return d2.id;
72184         });
72185         buttons.exit().remove();
72186         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
72187           return d2.id + " add-button bar-button";
72188         }).on("click.notes", function(d3_event, d2) {
72189           if (!enabled()) return;
72190           var currMode = context.mode().id;
72191           if (/^draw/.test(currMode)) return;
72192           if (d2.id === currMode) {
72193             context.enter(modeBrowse(context));
72194           } else {
72195             context.enter(d2);
72196           }
72197         }).call(
72198           uiTooltip().placement("bottom").title(function(d2) {
72199             return d2.description;
72200           }).keys(function(d2) {
72201             return [d2.key];
72202           }).scrollContainer(context.container().select(".top-toolbar"))
72203         );
72204         buttonsEnter.each(function(d2) {
72205           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
72206         });
72207         if (buttons.enter().size() || buttons.exit().size()) {
72208           context.ui().checkOverflow(".top-toolbar", true);
72209         }
72210         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
72211           return !enabled();
72212         }).attr("aria-disabled", function() {
72213           return !enabled();
72214         }).classed("active", function(d2) {
72215           return context.mode() && context.mode().button === d2.button;
72216         }).attr("aria-pressed", function(d2) {
72217           return context.mode() && context.mode().button === d2.button;
72218         });
72219       }
72220     };
72221     tool.uninstall = function() {
72222       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
72223       context.map().on("move.notes", null).on("drawn.notes", null);
72224     };
72225     return tool;
72226   }
72227   var init_notes2 = __esm({
72228     "modules/ui/tools/notes.js"() {
72229       "use strict";
72230       init_debounce();
72231       init_src5();
72232       init_modes2();
72233       init_localizer();
72234       init_svg();
72235       init_tooltip();
72236     }
72237   });
72238
72239   // modules/ui/tools/save.js
72240   var save_exports = {};
72241   __export(save_exports, {
72242     uiToolSave: () => uiToolSave
72243   });
72244   function uiToolSave(context) {
72245     var tool = {
72246       id: "save",
72247       label: _t.append("save.title")
72248     };
72249     var button = null;
72250     var tooltipBehavior = null;
72251     var history = context.history();
72252     var key = uiCmd("\u2318S");
72253     var _numChanges = 0;
72254     function isSaving() {
72255       var mode = context.mode();
72256       return mode && mode.id === "save";
72257     }
72258     function isDisabled() {
72259       return _numChanges === 0 || isSaving();
72260     }
72261     function save(d3_event) {
72262       d3_event.preventDefault();
72263       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
72264         context.enter(modeSave(context));
72265       }
72266     }
72267     function bgColor(numChanges) {
72268       var step;
72269       if (numChanges === 0) {
72270         return null;
72271       } else if (numChanges <= 50) {
72272         step = numChanges / 50;
72273         return rgb_default("#fff", "#ff8")(step);
72274       } else {
72275         step = Math.min((numChanges - 50) / 50, 1);
72276         return rgb_default("#ff8", "#f88")(step);
72277       }
72278     }
72279     function updateCount() {
72280       var val = history.difference().summary().length;
72281       if (val === _numChanges) return;
72282       _numChanges = val;
72283       if (tooltipBehavior) {
72284         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
72285       }
72286       if (button) {
72287         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
72288         button.select("span.count").text(_numChanges);
72289       }
72290     }
72291     tool.render = function(selection2) {
72292       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
72293       var lastPointerUpType;
72294       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
72295         lastPointerUpType = d3_event.pointerType;
72296       }).on("click", function(d3_event) {
72297         save(d3_event);
72298         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72299           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
72300         }
72301         lastPointerUpType = null;
72302       }).call(tooltipBehavior);
72303       button.call(svgIcon("#iD-icon-save"));
72304       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
72305       updateCount();
72306       context.keybinding().on(key, save, true);
72307       context.history().on("change.save", updateCount);
72308       context.on("enter.save", function() {
72309         if (button) {
72310           button.classed("disabled", isDisabled());
72311           if (isSaving()) {
72312             button.call(tooltipBehavior.hide);
72313           }
72314         }
72315       });
72316     };
72317     tool.uninstall = function() {
72318       context.keybinding().off(key, true);
72319       context.history().on("change.save", null);
72320       context.on("enter.save", null);
72321       button = null;
72322       tooltipBehavior = null;
72323     };
72324     return tool;
72325   }
72326   var init_save = __esm({
72327     "modules/ui/tools/save.js"() {
72328       "use strict";
72329       init_src8();
72330       init_localizer();
72331       init_modes2();
72332       init_svg();
72333       init_cmd();
72334       init_tooltip();
72335     }
72336   });
72337
72338   // modules/ui/tools/sidebar_toggle.js
72339   var sidebar_toggle_exports = {};
72340   __export(sidebar_toggle_exports, {
72341     uiToolSidebarToggle: () => uiToolSidebarToggle
72342   });
72343   function uiToolSidebarToggle(context) {
72344     var tool = {
72345       id: "sidebar_toggle",
72346       label: _t.append("toolbar.inspect")
72347     };
72348     tool.render = function(selection2) {
72349       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
72350         context.ui().sidebar.toggle();
72351       }).call(
72352         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
72353       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
72354     };
72355     return tool;
72356   }
72357   var init_sidebar_toggle = __esm({
72358     "modules/ui/tools/sidebar_toggle.js"() {
72359       "use strict";
72360       init_localizer();
72361       init_svg();
72362       init_tooltip();
72363     }
72364   });
72365
72366   // modules/ui/tools/undo_redo.js
72367   var undo_redo_exports = {};
72368   __export(undo_redo_exports, {
72369     uiToolUndoRedo: () => uiToolUndoRedo
72370   });
72371   function uiToolUndoRedo(context) {
72372     var tool = {
72373       id: "undo_redo",
72374       label: _t.append("toolbar.undo_redo")
72375     };
72376     var commands = [{
72377       id: "undo",
72378       cmd: uiCmd("\u2318Z"),
72379       action: function() {
72380         context.undo();
72381       },
72382       annotation: function() {
72383         return context.history().undoAnnotation();
72384       },
72385       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
72386     }, {
72387       id: "redo",
72388       cmd: uiCmd("\u2318\u21E7Z"),
72389       action: function() {
72390         context.redo();
72391       },
72392       annotation: function() {
72393         return context.history().redoAnnotation();
72394       },
72395       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
72396     }];
72397     function editable() {
72398       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
72399         true
72400         /* ignore min zoom */
72401       );
72402     }
72403     tool.render = function(selection2) {
72404       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
72405         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
72406       }).keys(function(d2) {
72407         return [d2.cmd];
72408       }).scrollContainer(context.container().select(".top-toolbar"));
72409       var lastPointerUpType;
72410       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
72411         return "disabled " + d2.id + "-button bar-button";
72412       }).on("pointerup", function(d3_event) {
72413         lastPointerUpType = d3_event.pointerType;
72414       }).on("click", function(d3_event, d2) {
72415         d3_event.preventDefault();
72416         var annotation = d2.annotation();
72417         if (editable() && annotation) {
72418           d2.action();
72419         }
72420         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72421           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
72422           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
72423         }
72424         lastPointerUpType = null;
72425       }).call(tooltipBehavior);
72426       buttons.each(function(d2) {
72427         select_default2(this).call(svgIcon("#" + d2.icon));
72428       });
72429       context.keybinding().on(commands[0].cmd, function(d3_event) {
72430         d3_event.preventDefault();
72431         if (editable()) commands[0].action();
72432       }).on(commands[1].cmd, function(d3_event) {
72433         d3_event.preventDefault();
72434         if (editable()) commands[1].action();
72435       });
72436       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72437       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
72438       context.history().on("change.undo_redo", function(difference2) {
72439         if (difference2) update();
72440       });
72441       context.on("enter.undo_redo", update);
72442       function update() {
72443         buttons.classed("disabled", function(d2) {
72444           return !editable() || !d2.annotation();
72445         }).each(function() {
72446           var selection3 = select_default2(this);
72447           if (!selection3.select(".tooltip.in").empty()) {
72448             selection3.call(tooltipBehavior.updateContent);
72449           }
72450         });
72451       }
72452     };
72453     tool.uninstall = function() {
72454       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
72455       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
72456       context.history().on("change.undo_redo", null);
72457       context.on("enter.undo_redo", null);
72458     };
72459     return tool;
72460   }
72461   var init_undo_redo = __esm({
72462     "modules/ui/tools/undo_redo.js"() {
72463       "use strict";
72464       init_debounce();
72465       init_src5();
72466       init_localizer();
72467       init_svg();
72468       init_cmd();
72469       init_tooltip();
72470     }
72471   });
72472
72473   // modules/ui/tools/index.js
72474   var tools_exports = {};
72475   __export(tools_exports, {
72476     uiToolDrawModes: () => uiToolDrawModes,
72477     uiToolNotes: () => uiToolNotes,
72478     uiToolSave: () => uiToolSave,
72479     uiToolSidebarToggle: () => uiToolSidebarToggle,
72480     uiToolUndoRedo: () => uiToolUndoRedo
72481   });
72482   var init_tools = __esm({
72483     "modules/ui/tools/index.js"() {
72484       "use strict";
72485       init_modes();
72486       init_notes2();
72487       init_save();
72488       init_sidebar_toggle();
72489       init_undo_redo();
72490     }
72491   });
72492
72493   // modules/ui/top_toolbar.js
72494   var top_toolbar_exports = {};
72495   __export(top_toolbar_exports, {
72496     uiTopToolbar: () => uiTopToolbar
72497   });
72498   function uiTopToolbar(context) {
72499     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
72500     function notesEnabled() {
72501       var noteLayer = context.layers().layer("notes");
72502       return noteLayer && noteLayer.enabled();
72503     }
72504     function topToolbar(bar) {
72505       bar.on("wheel.topToolbar", function(d3_event) {
72506         if (!d3_event.deltaX) {
72507           bar.node().scrollLeft += d3_event.deltaY;
72508         }
72509       });
72510       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72511       context.layers().on("change.topToolbar", debouncedUpdate);
72512       update();
72513       function update() {
72514         var tools = [
72515           sidebarToggle,
72516           "spacer",
72517           modes
72518         ];
72519         tools.push("spacer");
72520         if (notesEnabled()) {
72521           tools = tools.concat([notes, "spacer"]);
72522         }
72523         tools = tools.concat([undoRedo, save]);
72524         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
72525           return d2.id || d2;
72526         });
72527         toolbarItems.exit().each(function(d2) {
72528           if (d2.uninstall) {
72529             d2.uninstall();
72530           }
72531         }).remove();
72532         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
72533           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
72534           if (d2.klass) classes += " " + d2.klass;
72535           return classes;
72536         });
72537         var actionableItems = itemsEnter.filter(function(d2) {
72538           return d2 !== "spacer";
72539         });
72540         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
72541           select_default2(this).call(d2.render, bar);
72542         });
72543         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
72544           d2.label(select_default2(this));
72545         });
72546       }
72547     }
72548     return topToolbar;
72549   }
72550   var init_top_toolbar = __esm({
72551     "modules/ui/top_toolbar.js"() {
72552       "use strict";
72553       init_src5();
72554       init_debounce();
72555       init_tools();
72556     }
72557   });
72558
72559   // modules/ui/version.js
72560   var version_exports = {};
72561   __export(version_exports, {
72562     uiVersion: () => uiVersion
72563   });
72564   function uiVersion(context) {
72565     var currVersion = context.version;
72566     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
72567     if (sawVersion === null && matchedVersion !== null) {
72568       if (corePreferences("sawVersion")) {
72569         isNewUser = false;
72570         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
72571       } else {
72572         isNewUser = true;
72573         isNewVersion = true;
72574       }
72575       corePreferences("sawVersion", currVersion);
72576       sawVersion = currVersion;
72577     }
72578     return function(selection2) {
72579       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
72580       if (isNewVersion && !isNewUser) {
72581         selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", `https://github.com/openstreetmap/iD/releases/tag/v${currVersion}`).call(svgIcon("#maki-gift")).call(
72582           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
72583         );
72584       }
72585     };
72586   }
72587   var sawVersion, isNewVersion, isNewUser;
72588   var init_version = __esm({
72589     "modules/ui/version.js"() {
72590       "use strict";
72591       init_preferences();
72592       init_localizer();
72593       init_icon();
72594       init_tooltip();
72595       sawVersion = null;
72596       isNewVersion = false;
72597       isNewUser = false;
72598     }
72599   });
72600
72601   // modules/ui/zoom.js
72602   var zoom_exports = {};
72603   __export(zoom_exports, {
72604     uiZoom: () => uiZoom
72605   });
72606   function uiZoom(context) {
72607     var zooms = [{
72608       id: "zoom-in",
72609       icon: "iD-icon-plus",
72610       title: _t.append("zoom.in"),
72611       action: zoomIn,
72612       disabled: function() {
72613         return !context.map().canZoomIn();
72614       },
72615       disabledTitle: _t.append("zoom.disabled.in"),
72616       key: "+"
72617     }, {
72618       id: "zoom-out",
72619       icon: "iD-icon-minus",
72620       title: _t.append("zoom.out"),
72621       action: zoomOut,
72622       disabled: function() {
72623         return !context.map().canZoomOut();
72624       },
72625       disabledTitle: _t.append("zoom.disabled.out"),
72626       key: "-"
72627     }];
72628     function zoomIn(d3_event) {
72629       if (d3_event.shiftKey) return;
72630       d3_event.preventDefault();
72631       context.map().zoomIn();
72632     }
72633     function zoomOut(d3_event) {
72634       if (d3_event.shiftKey) return;
72635       d3_event.preventDefault();
72636       context.map().zoomOut();
72637     }
72638     function zoomInFurther(d3_event) {
72639       if (d3_event.shiftKey) return;
72640       d3_event.preventDefault();
72641       context.map().zoomInFurther();
72642     }
72643     function zoomOutFurther(d3_event) {
72644       if (d3_event.shiftKey) return;
72645       d3_event.preventDefault();
72646       context.map().zoomOutFurther();
72647     }
72648     return function(selection2) {
72649       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
72650         if (d2.disabled()) {
72651           return d2.disabledTitle;
72652         }
72653         return d2.title;
72654       }).keys(function(d2) {
72655         return [d2.key];
72656       });
72657       var lastPointerUpType;
72658       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
72659         return d2.id;
72660       }).on("pointerup.editor", function(d3_event) {
72661         lastPointerUpType = d3_event.pointerType;
72662       }).on("click.editor", function(d3_event, d2) {
72663         if (!d2.disabled()) {
72664           d2.action(d3_event);
72665         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
72666           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
72667         }
72668         lastPointerUpType = null;
72669       }).call(tooltipBehavior);
72670       buttons.each(function(d2) {
72671         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
72672       });
72673       utilKeybinding.plusKeys.forEach(function(key) {
72674         context.keybinding().on([key], zoomIn);
72675         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
72676       });
72677       utilKeybinding.minusKeys.forEach(function(key) {
72678         context.keybinding().on([key], zoomOut);
72679         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
72680       });
72681       function updateButtonStates() {
72682         buttons.classed("disabled", function(d2) {
72683           return d2.disabled();
72684         }).each(function() {
72685           var selection3 = select_default2(this);
72686           if (!selection3.select(".tooltip.in").empty()) {
72687             selection3.call(tooltipBehavior.updateContent);
72688           }
72689         });
72690       }
72691       updateButtonStates();
72692       context.map().on("move.uiZoom", updateButtonStates);
72693     };
72694   }
72695   var init_zoom3 = __esm({
72696     "modules/ui/zoom.js"() {
72697       "use strict";
72698       init_src5();
72699       init_localizer();
72700       init_icon();
72701       init_cmd();
72702       init_tooltip();
72703       init_keybinding();
72704     }
72705   });
72706
72707   // modules/ui/zoom_to_selection.js
72708   var zoom_to_selection_exports = {};
72709   __export(zoom_to_selection_exports, {
72710     uiZoomToSelection: () => uiZoomToSelection
72711   });
72712   function uiZoomToSelection(context) {
72713     function isDisabled() {
72714       var mode = context.mode();
72715       return !mode || !mode.zoomToSelected;
72716     }
72717     var _lastPointerUpType;
72718     function pointerup(d3_event) {
72719       _lastPointerUpType = d3_event.pointerType;
72720     }
72721     function click(d3_event) {
72722       d3_event.preventDefault();
72723       if (isDisabled()) {
72724         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
72725           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
72726         }
72727       } else {
72728         var mode = context.mode();
72729         if (mode && mode.zoomToSelected) {
72730           mode.zoomToSelected();
72731         }
72732       }
72733       _lastPointerUpType = null;
72734     }
72735     return function(selection2) {
72736       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
72737         if (isDisabled()) {
72738           return _t.append("inspector.zoom_to.no_selection");
72739         }
72740         return _t.append("inspector.zoom_to.title");
72741       }).keys([_t("inspector.zoom_to.key")]);
72742       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
72743       function setEnabledState() {
72744         button.classed("disabled", isDisabled());
72745         if (!button.select(".tooltip.in").empty()) {
72746           button.call(tooltipBehavior.updateContent);
72747         }
72748       }
72749       context.on("enter.uiZoomToSelection", setEnabledState);
72750       setEnabledState();
72751     };
72752   }
72753   var init_zoom_to_selection = __esm({
72754     "modules/ui/zoom_to_selection.js"() {
72755       "use strict";
72756       init_localizer();
72757       init_tooltip();
72758       init_icon();
72759     }
72760   });
72761
72762   // modules/ui/pane.js
72763   var pane_exports = {};
72764   __export(pane_exports, {
72765     uiPane: () => uiPane
72766   });
72767   function uiPane(id2, context) {
72768     var _key;
72769     var _label = "";
72770     var _description = "";
72771     var _iconName = "";
72772     var _sections;
72773     var _paneSelection = select_default2(null);
72774     var _paneTooltip;
72775     var pane = {
72776       id: id2
72777     };
72778     pane.label = function(val) {
72779       if (!arguments.length) return _label;
72780       _label = val;
72781       return pane;
72782     };
72783     pane.key = function(val) {
72784       if (!arguments.length) return _key;
72785       _key = val;
72786       return pane;
72787     };
72788     pane.description = function(val) {
72789       if (!arguments.length) return _description;
72790       _description = val;
72791       return pane;
72792     };
72793     pane.iconName = function(val) {
72794       if (!arguments.length) return _iconName;
72795       _iconName = val;
72796       return pane;
72797     };
72798     pane.sections = function(val) {
72799       if (!arguments.length) return _sections;
72800       _sections = val;
72801       return pane;
72802     };
72803     pane.selection = function() {
72804       return _paneSelection;
72805     };
72806     function hidePane() {
72807       context.ui().togglePanes();
72808     }
72809     pane.togglePane = function(d3_event) {
72810       if (d3_event) d3_event.preventDefault();
72811       _paneTooltip.hide();
72812       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
72813     };
72814     pane.renderToggleButton = function(selection2) {
72815       if (!_paneTooltip) {
72816         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
72817       }
72818       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
72819     };
72820     pane.renderContent = function(selection2) {
72821       if (_sections) {
72822         _sections.forEach(function(section) {
72823           selection2.call(section.render);
72824         });
72825       }
72826     };
72827     pane.renderPane = function(selection2) {
72828       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
72829       var heading2 = _paneSelection.append("div").attr("class", "pane-heading");
72830       heading2.append("h2").text("").call(_label);
72831       heading2.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
72832       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
72833       if (_key) {
72834         context.keybinding().on(_key, pane.togglePane);
72835       }
72836     };
72837     return pane;
72838   }
72839   var init_pane = __esm({
72840     "modules/ui/pane.js"() {
72841       "use strict";
72842       init_src5();
72843       init_icon();
72844       init_localizer();
72845       init_tooltip();
72846     }
72847   });
72848
72849   // modules/ui/sections/background_display_options.js
72850   var background_display_options_exports = {};
72851   __export(background_display_options_exports, {
72852     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions
72853   });
72854   function uiSectionBackgroundDisplayOptions(context) {
72855     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
72856     var _storedOpacity = corePreferences("background-opacity");
72857     var _minVal = 0;
72858     var _maxVal = 3;
72859     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
72860     var _options = {
72861       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
72862       contrast: 1,
72863       saturation: 1,
72864       sharpness: 1
72865     };
72866     function clamp3(x2, min3, max3) {
72867       return Math.max(min3, Math.min(x2, max3));
72868     }
72869     function updateValue(d2, val) {
72870       val = clamp3(val, _minVal, _maxVal);
72871       _options[d2] = val;
72872       context.background()[d2](val);
72873       if (d2 === "brightness") {
72874         corePreferences("background-opacity", val);
72875       }
72876       section.reRender();
72877     }
72878     function renderDisclosureContent(selection2) {
72879       var container = selection2.selectAll(".display-options-container").data([0]);
72880       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
72881       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
72882         return "display-control display-control-" + d2;
72883       });
72884       slidersEnter.html(function(d2) {
72885         return _t.html("background." + d2);
72886       }).append("span").attr("class", function(d2) {
72887         return "display-option-value display-option-value-" + d2;
72888       });
72889       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
72890       sildersControlEnter.append("input").attr("class", function(d2) {
72891         return "display-option-input display-option-input-" + d2;
72892       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.01").on("input", function(d3_event, d2) {
72893         var val = select_default2(this).property("value");
72894         if (!val && d3_event && d3_event.target) {
72895           val = d3_event.target.value;
72896         }
72897         updateValue(d2, val);
72898       });
72899       sildersControlEnter.append("button").attr("title", function(d2) {
72900         return `${_t("background.reset")} ${_t("background." + d2)}`;
72901       }).attr("class", function(d2) {
72902         return "display-option-reset display-option-reset-" + d2;
72903       }).on("click", function(d3_event, d2) {
72904         if (d3_event.button !== 0) return;
72905         updateValue(d2, 1);
72906       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72907       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
72908         d3_event.preventDefault();
72909         for (var i3 = 0; i3 < _sliders.length; i3++) {
72910           updateValue(_sliders[i3], 1);
72911         }
72912       });
72913       container = containerEnter.merge(container);
72914       container.selectAll(".display-option-input").property("value", function(d2) {
72915         return _options[d2];
72916       });
72917       container.selectAll(".display-option-value").text(function(d2) {
72918         return Math.floor(_options[d2] * 100) + "%";
72919       });
72920       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
72921         return _options[d2] === 1;
72922       });
72923       if (containerEnter.size() && _options.brightness !== 1) {
72924         context.background().brightness(_options.brightness);
72925       }
72926     }
72927     return section;
72928   }
72929   var init_background_display_options = __esm({
72930     "modules/ui/sections/background_display_options.js"() {
72931       "use strict";
72932       init_src5();
72933       init_preferences();
72934       init_localizer();
72935       init_icon();
72936       init_section();
72937     }
72938   });
72939
72940   // modules/ui/settings/custom_background.js
72941   var custom_background_exports = {};
72942   __export(custom_background_exports, {
72943     uiSettingsCustomBackground: () => uiSettingsCustomBackground
72944   });
72945   function uiSettingsCustomBackground() {
72946     var dispatch14 = dispatch_default("change");
72947     function render(selection2) {
72948       var _origSettings = {
72949         template: corePreferences("background-custom-template")
72950       };
72951       var _currSettings = {
72952         template: corePreferences("background-custom-template")
72953       };
72954       var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
72955       var modal = uiConfirm(selection2).okButton();
72956       modal.classed("settings-modal settings-custom-background", true);
72957       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
72958       var textSection = modal.select(".modal-section.message-text");
72959       var instructions = `${_t.html("settings.custom_background.instructions.info")}
72960
72961 #### ${_t.html("settings.custom_background.instructions.wms.tokens_label")}
72962 * ${_t.html("settings.custom_background.instructions.wms.tokens.proj")}
72963 * ${_t.html("settings.custom_background.instructions.wms.tokens.wkid")}
72964 * ${_t.html("settings.custom_background.instructions.wms.tokens.dimensions")}
72965 * ${_t.html("settings.custom_background.instructions.wms.tokens.bbox")}
72966
72967 #### ${_t.html("settings.custom_background.instructions.tms.tokens_label")}
72968 * ${_t.html("settings.custom_background.instructions.tms.tokens.xyz")}
72969 * ${_t.html("settings.custom_background.instructions.tms.tokens.flipped_y")}
72970 * ${_t.html("settings.custom_background.instructions.tms.tokens.switch")}
72971 * ${_t.html("settings.custom_background.instructions.tms.tokens.quadtile")}
72972 * ${_t.html("settings.custom_background.instructions.tms.tokens.scale_factor")}
72973
72974 #### ${_t.html("settings.custom_background.instructions.example")}
72975 \`${example}\``;
72976       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
72977       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
72978       var buttonSection = modal.select(".modal-section.buttons");
72979       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
72980       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
72981       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
72982       function isSaveDisabled() {
72983         return null;
72984       }
72985       function clickCancel() {
72986         textSection.select(".field-template").property("value", _origSettings.template);
72987         corePreferences("background-custom-template", _origSettings.template);
72988         this.blur();
72989         modal.close();
72990       }
72991       function clickSave() {
72992         _currSettings.template = textSection.select(".field-template").property("value");
72993         corePreferences("background-custom-template", _currSettings.template);
72994         this.blur();
72995         modal.close();
72996         dispatch14.call("change", this, _currSettings);
72997       }
72998     }
72999     return utilRebind(render, dispatch14, "on");
73000   }
73001   var init_custom_background = __esm({
73002     "modules/ui/settings/custom_background.js"() {
73003       "use strict";
73004       init_src4();
73005       init_marked_esm();
73006       init_preferences();
73007       init_localizer();
73008       init_confirm();
73009       init_util();
73010     }
73011   });
73012
73013   // modules/ui/sections/background_list.js
73014   var background_list_exports = {};
73015   __export(background_list_exports, {
73016     uiSectionBackgroundList: () => uiSectionBackgroundList
73017   });
73018   function uiSectionBackgroundList(context) {
73019     var _backgroundList = select_default2(null);
73020     var _customSource = context.background().findSource("custom");
73021     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
73022     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
73023     function previousBackgroundID() {
73024       return corePreferences("background-last-used-toggle");
73025     }
73026     function renderDisclosureContent(selection2) {
73027       var container = selection2.selectAll(".layer-background-list").data([0]);
73028       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
73029       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
73030       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
73031         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
73032       );
73033       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73034         d3_event.preventDefault();
73035         uiMapInMap.toggle();
73036       });
73037       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
73038       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
73039         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
73040       );
73041       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73042         d3_event.preventDefault();
73043         context.ui().info.toggle("background");
73044       });
73045       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
73046       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
73047         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
73048       );
73049       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73050         d3_event.preventDefault();
73051         context.ui().info.toggle("location");
73052       });
73053       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
73054       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"));
73055       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
73056         chooseBackground(d2);
73057       }, function(d2) {
73058         return !d2.isHidden() && !d2.overlay;
73059       });
73060     }
73061     function setTooltips(selection2) {
73062       selection2.each(function(d2, i3, nodes) {
73063         var item = select_default2(this).select("label");
73064         var span = item.select("span");
73065         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
73066         var hasDescription = d2.hasDescription();
73067         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
73068         item.call(uiTooltip().destroyAny);
73069         if (d2.id === previousBackgroundID()) {
73070           item.call(
73071             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
73072           );
73073         } else if (hasDescription || isOverflowing) {
73074           item.call(
73075             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
73076           );
73077         }
73078       });
73079     }
73080     function drawListItems(layerList, type2, change, filter2) {
73081       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
73082         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
73083       });
73084       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
73085         return d2.id + "---" + i3;
73086       });
73087       layerLinks.exit().remove();
73088       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
73089         return d2.id === "custom";
73090       }).classed("best", function(d2) {
73091         return d2.best();
73092       });
73093       var label = enter.append("label");
73094       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
73095         return d2.id;
73096       }).on("change", change);
73097       label.append("span").each(function(d2) {
73098         d2.label()(select_default2(this));
73099       });
73100       enter.filter(function(d2) {
73101         return d2.id === "custom";
73102       }).append("button").attr("class", "layer-browse").call(
73103         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73104       ).on("click", function(d3_event) {
73105         d3_event.preventDefault();
73106         editCustom();
73107       }).call(svgIcon("#iD-icon-more"));
73108       enter.filter(function(d2) {
73109         return d2.best();
73110       }).append("div").attr("class", "best").call(
73111         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73112       ).append("span").text("\u2605");
73113       layerList.call(updateLayerSelections);
73114     }
73115     function updateLayerSelections(selection2) {
73116       function active(d2) {
73117         return context.background().showsLayer(d2);
73118       }
73119       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
73120         return d2.id === previousBackgroundID();
73121       }).call(setTooltips).selectAll("input").property("checked", active);
73122     }
73123     function chooseBackground(d2) {
73124       if (d2.id === "custom" && !d2.template()) {
73125         return editCustom();
73126       }
73127       var previousBackground = context.background().baseLayerSource();
73128       corePreferences("background-last-used-toggle", previousBackground.id);
73129       corePreferences("background-last-used", d2.id);
73130       context.background().baseLayerSource(d2);
73131     }
73132     function customChanged(d2) {
73133       if (d2 && d2.template) {
73134         _customSource.template(d2.template);
73135         chooseBackground(_customSource);
73136       } else {
73137         _customSource.template("");
73138         chooseBackground(context.background().findSource("none"));
73139       }
73140     }
73141     function editCustom() {
73142       context.container().call(_settingsCustomBackground);
73143     }
73144     context.background().on("change.background_list", function() {
73145       _backgroundList.call(updateLayerSelections);
73146     });
73147     context.map().on(
73148       "move.background_list",
73149       debounce_default(function() {
73150         window.requestIdleCallback(section.reRender);
73151       }, 1e3)
73152     );
73153     return section;
73154   }
73155   var init_background_list = __esm({
73156     "modules/ui/sections/background_list.js"() {
73157       "use strict";
73158       init_debounce();
73159       init_src();
73160       init_src5();
73161       init_preferences();
73162       init_localizer();
73163       init_tooltip();
73164       init_icon();
73165       init_cmd();
73166       init_custom_background();
73167       init_map_in_map();
73168       init_section();
73169     }
73170   });
73171
73172   // modules/ui/sections/background_offset.js
73173   var background_offset_exports = {};
73174   __export(background_offset_exports, {
73175     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset
73176   });
73177   function uiSectionBackgroundOffset(context) {
73178     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73179     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
73180     var _directions = [
73181       ["top", [0, -0.5]],
73182       ["left", [-0.5, 0]],
73183       ["right", [0.5, 0]],
73184       ["bottom", [0, 0.5]]
73185     ];
73186     function updateValue() {
73187       var meters = geoOffsetToMeters(context.background().offset());
73188       var x2 = +meters[0].toFixed(2);
73189       var y2 = +meters[1].toFixed(2);
73190       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
73191       context.container().selectAll(".nudge-reset").classed("disabled", function() {
73192         return x2 === 0 && y2 === 0;
73193       });
73194     }
73195     function resetOffset() {
73196       context.background().offset([0, 0]);
73197       updateValue();
73198     }
73199     function nudge(d2) {
73200       context.background().nudge(d2, context.map().zoom());
73201       updateValue();
73202     }
73203     function inputOffset() {
73204       var input = select_default2(this);
73205       var d2 = input.node().value;
73206       if (d2 === "") return resetOffset();
73207       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
73208         return !isNaN(n3) && n3;
73209       });
73210       if (d2.length !== 2 || !d2[0] || !d2[1]) {
73211         input.classed("error", true);
73212         return;
73213       }
73214       context.background().offset(geoMetersToOffset(d2));
73215       updateValue();
73216     }
73217     function dragOffset(d3_event) {
73218       if (d3_event.button !== 0) return;
73219       var origin = [d3_event.clientX, d3_event.clientY];
73220       var pointerId = d3_event.pointerId || "mouse";
73221       context.container().append("div").attr("class", "nudge-surface");
73222       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
73223       if (_pointerPrefix === "pointer") {
73224         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
73225       }
73226       function pointermove(d3_event2) {
73227         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
73228         var latest = [d3_event2.clientX, d3_event2.clientY];
73229         var d2 = [
73230           -(origin[0] - latest[0]) / 4,
73231           -(origin[1] - latest[1]) / 4
73232         ];
73233         origin = latest;
73234         nudge(d2);
73235       }
73236       function pointerup(d3_event2) {
73237         if (pointerId !== (d3_event2.pointerId || "mouse")) return;
73238         if (d3_event2.button !== 0) return;
73239         context.container().selectAll(".nudge-surface").remove();
73240         select_default2(window).on(".drag-bg-offset", null);
73241       }
73242     }
73243     function renderDisclosureContent(selection2) {
73244       var container = selection2.selectAll(".nudge-container").data([0]);
73245       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
73246       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
73247       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
73248       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
73249       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
73250       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
73251         return _t(`background.nudge.${d2[0]}`);
73252       }).attr("class", function(d2) {
73253         return d2[0] + " nudge";
73254       }).on("click", function(d3_event, d2) {
73255         nudge(d2[1]);
73256       });
73257       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
73258         d3_event.preventDefault();
73259         resetOffset();
73260       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
73261       updateValue();
73262     }
73263     context.background().on("change.backgroundOffset-update", updateValue);
73264     return section;
73265   }
73266   var init_background_offset = __esm({
73267     "modules/ui/sections/background_offset.js"() {
73268       "use strict";
73269       init_src5();
73270       init_localizer();
73271       init_geo2();
73272       init_icon();
73273       init_section();
73274     }
73275   });
73276
73277   // modules/ui/sections/overlay_list.js
73278   var overlay_list_exports = {};
73279   __export(overlay_list_exports, {
73280     uiSectionOverlayList: () => uiSectionOverlayList
73281   });
73282   function uiSectionOverlayList(context) {
73283     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
73284     var _overlayList = select_default2(null);
73285     function setTooltips(selection2) {
73286       selection2.each(function(d2, i3, nodes) {
73287         var item = select_default2(this).select("label");
73288         var span = item.select("span");
73289         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
73290         var description = d2.description();
73291         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
73292         item.call(uiTooltip().destroyAny);
73293         if (description || isOverflowing) {
73294           item.call(
73295             uiTooltip().placement(placement).title(() => description || d2.name())
73296           );
73297         }
73298       });
73299     }
73300     function updateLayerSelections(selection2) {
73301       function active(d2) {
73302         return context.background().showsLayer(d2);
73303       }
73304       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
73305     }
73306     function chooseOverlay(d3_event, d2) {
73307       d3_event.preventDefault();
73308       context.background().toggleOverlayLayer(d2);
73309       _overlayList.call(updateLayerSelections);
73310       document.activeElement.blur();
73311     }
73312     function drawListItems(layerList, type2, change, filter2) {
73313       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
73314       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
73315         return d2.name();
73316       });
73317       layerLinks.exit().remove();
73318       var enter = layerLinks.enter().append("li");
73319       var label = enter.append("label");
73320       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
73321       label.append("span").each(function(d2) {
73322         d2.label()(select_default2(this));
73323       });
73324       layerList.selectAll("li").sort(sortSources);
73325       layerList.call(updateLayerSelections);
73326       function sortSources(a2, b2) {
73327         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
73328       }
73329     }
73330     function renderDisclosureContent(selection2) {
73331       var container = selection2.selectAll(".layer-overlay-list").data([0]);
73332       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
73333       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
73334         return !d2.isHidden() && d2.overlay;
73335       });
73336     }
73337     context.map().on(
73338       "move.overlay_list",
73339       debounce_default(function() {
73340         window.requestIdleCallback(section.reRender);
73341       }, 1e3)
73342     );
73343     return section;
73344   }
73345   var init_overlay_list = __esm({
73346     "modules/ui/sections/overlay_list.js"() {
73347       "use strict";
73348       init_debounce();
73349       init_src();
73350       init_src5();
73351       init_localizer();
73352       init_tooltip();
73353       init_section();
73354     }
73355   });
73356
73357   // modules/ui/panes/background.js
73358   var background_exports3 = {};
73359   __export(background_exports3, {
73360     uiPaneBackground: () => uiPaneBackground
73361   });
73362   function uiPaneBackground(context) {
73363     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
73364       uiSectionBackgroundList(context),
73365       uiSectionOverlayList(context),
73366       uiSectionBackgroundDisplayOptions(context),
73367       uiSectionBackgroundOffset(context)
73368     ]);
73369     return backgroundPane;
73370   }
73371   var init_background3 = __esm({
73372     "modules/ui/panes/background.js"() {
73373       "use strict";
73374       init_localizer();
73375       init_pane();
73376       init_background_display_options();
73377       init_background_list();
73378       init_background_offset();
73379       init_overlay_list();
73380     }
73381   });
73382
73383   // modules/ui/panes/help.js
73384   var help_exports = {};
73385   __export(help_exports, {
73386     uiPaneHelp: () => uiPaneHelp
73387   });
73388   function uiPaneHelp(context) {
73389     var docKeys = [
73390       ["help", [
73391         "welcome",
73392         "open_data_h",
73393         "open_data",
73394         "before_start_h",
73395         "before_start",
73396         "open_source_h",
73397         "open_source",
73398         "open_source_attribution",
73399         "open_source_help"
73400       ]],
73401       ["overview", [
73402         "navigation_h",
73403         "navigation_drag",
73404         "navigation_zoom",
73405         "features_h",
73406         "features",
73407         "nodes_ways"
73408       ]],
73409       ["editing", [
73410         "select_h",
73411         "select_left_click",
73412         "select_right_click",
73413         "select_space",
73414         "multiselect_h",
73415         "multiselect",
73416         "multiselect_shift_click",
73417         "multiselect_lasso",
73418         "undo_redo_h",
73419         "undo_redo",
73420         "save_h",
73421         "save",
73422         "save_validation",
73423         "upload_h",
73424         "upload",
73425         "backups_h",
73426         "backups",
73427         "keyboard_h",
73428         "keyboard"
73429       ]],
73430       ["feature_editor", [
73431         "intro",
73432         "definitions",
73433         "type_h",
73434         "type",
73435         "type_picker",
73436         "fields_h",
73437         "fields_all_fields",
73438         "fields_example",
73439         "fields_add_field",
73440         "tags_h",
73441         "tags_all_tags",
73442         "tags_resources"
73443       ]],
73444       ["points", [
73445         "intro",
73446         "add_point_h",
73447         "add_point",
73448         "add_point_finish",
73449         "move_point_h",
73450         "move_point",
73451         "delete_point_h",
73452         "delete_point",
73453         "delete_point_command"
73454       ]],
73455       ["lines", [
73456         "intro",
73457         "add_line_h",
73458         "add_line",
73459         "add_line_draw",
73460         "add_line_continue",
73461         "add_line_finish",
73462         "modify_line_h",
73463         "modify_line_dragnode",
73464         "modify_line_addnode",
73465         "connect_line_h",
73466         "connect_line",
73467         "connect_line_display",
73468         "connect_line_drag",
73469         "connect_line_tag",
73470         "disconnect_line_h",
73471         "disconnect_line_command",
73472         "move_line_h",
73473         "move_line_command",
73474         "move_line_connected",
73475         "delete_line_h",
73476         "delete_line",
73477         "delete_line_command"
73478       ]],
73479       ["areas", [
73480         "intro",
73481         "point_or_area_h",
73482         "point_or_area",
73483         "add_area_h",
73484         "add_area_command",
73485         "add_area_draw",
73486         "add_area_continue",
73487         "add_area_finish",
73488         "square_area_h",
73489         "square_area_command",
73490         "modify_area_h",
73491         "modify_area_dragnode",
73492         "modify_area_addnode",
73493         "delete_area_h",
73494         "delete_area",
73495         "delete_area_command"
73496       ]],
73497       ["relations", [
73498         "intro",
73499         "edit_relation_h",
73500         "edit_relation",
73501         "edit_relation_add",
73502         "edit_relation_delete",
73503         "maintain_relation_h",
73504         "maintain_relation",
73505         "relation_types_h",
73506         "multipolygon_h",
73507         "multipolygon",
73508         "multipolygon_create",
73509         "multipolygon_merge",
73510         "turn_restriction_h",
73511         "turn_restriction",
73512         "turn_restriction_field",
73513         "turn_restriction_editing",
73514         "route_h",
73515         "route",
73516         "route_add",
73517         "boundary_h",
73518         "boundary",
73519         "boundary_add"
73520       ]],
73521       ["operations", [
73522         "intro",
73523         "intro_2",
73524         "straighten",
73525         "orthogonalize",
73526         "circularize",
73527         "move",
73528         "rotate",
73529         "reflect",
73530         "continue",
73531         "reverse",
73532         "disconnect",
73533         "split",
73534         "extract",
73535         "merge",
73536         "delete",
73537         "downgrade",
73538         "copy_paste"
73539       ]],
73540       ["notes", [
73541         "intro",
73542         "add_note_h",
73543         "add_note",
73544         "place_note",
73545         "move_note",
73546         "update_note_h",
73547         "update_note",
73548         "save_note_h",
73549         "save_note"
73550       ]],
73551       ["imagery", [
73552         "intro",
73553         "sources_h",
73554         "choosing",
73555         "sources",
73556         "offsets_h",
73557         "offset",
73558         "offset_change"
73559       ]],
73560       ["streetlevel", [
73561         "intro",
73562         "using_h",
73563         "using",
73564         "photos",
73565         "viewer"
73566       ]],
73567       ["gps", [
73568         "intro",
73569         "survey",
73570         "using_h",
73571         "using",
73572         "tracing",
73573         "upload"
73574       ]],
73575       ["qa", [
73576         "intro",
73577         "tools_h",
73578         "tools",
73579         "issues_h",
73580         "issues"
73581       ]]
73582     ];
73583     var headings = {
73584       "help.help.open_data_h": 3,
73585       "help.help.before_start_h": 3,
73586       "help.help.open_source_h": 3,
73587       "help.overview.navigation_h": 3,
73588       "help.overview.features_h": 3,
73589       "help.editing.select_h": 3,
73590       "help.editing.multiselect_h": 3,
73591       "help.editing.undo_redo_h": 3,
73592       "help.editing.save_h": 3,
73593       "help.editing.upload_h": 3,
73594       "help.editing.backups_h": 3,
73595       "help.editing.keyboard_h": 3,
73596       "help.feature_editor.type_h": 3,
73597       "help.feature_editor.fields_h": 3,
73598       "help.feature_editor.tags_h": 3,
73599       "help.points.add_point_h": 3,
73600       "help.points.move_point_h": 3,
73601       "help.points.delete_point_h": 3,
73602       "help.lines.add_line_h": 3,
73603       "help.lines.modify_line_h": 3,
73604       "help.lines.connect_line_h": 3,
73605       "help.lines.disconnect_line_h": 3,
73606       "help.lines.move_line_h": 3,
73607       "help.lines.delete_line_h": 3,
73608       "help.areas.point_or_area_h": 3,
73609       "help.areas.add_area_h": 3,
73610       "help.areas.square_area_h": 3,
73611       "help.areas.modify_area_h": 3,
73612       "help.areas.delete_area_h": 3,
73613       "help.relations.edit_relation_h": 3,
73614       "help.relations.maintain_relation_h": 3,
73615       "help.relations.relation_types_h": 2,
73616       "help.relations.multipolygon_h": 3,
73617       "help.relations.turn_restriction_h": 3,
73618       "help.relations.route_h": 3,
73619       "help.relations.boundary_h": 3,
73620       "help.notes.add_note_h": 3,
73621       "help.notes.update_note_h": 3,
73622       "help.notes.save_note_h": 3,
73623       "help.imagery.sources_h": 3,
73624       "help.imagery.offsets_h": 3,
73625       "help.streetlevel.using_h": 3,
73626       "help.gps.using_h": 3,
73627       "help.qa.tools_h": 3,
73628       "help.qa.issues_h": 3
73629     };
73630     var docs = docKeys.map(function(key) {
73631       var helpkey = "help." + key[0];
73632       var helpPaneReplacements = { version: context.version };
73633       var text = key[1].reduce(function(all, part) {
73634         var subkey = helpkey + "." + part;
73635         var depth = headings[subkey];
73636         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
73637         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
73638       }, "");
73639       return {
73640         title: _t.html(helpkey + ".title"),
73641         content: marked(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
73642       };
73643     });
73644     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
73645     helpPane.renderContent = function(content) {
73646       function clickHelp(d2, i3) {
73647         var rtl = _mainLocalizer.textDirection() === "rtl";
73648         content.property("scrollTop", 0);
73649         helpPane.selection().select(".pane-heading h2").html(d2.title);
73650         body.html(d2.content);
73651         body.selectAll("a").attr("target", "_blank");
73652         menuItems.classed("selected", function(m2) {
73653           return m2.title === d2.title;
73654         });
73655         nav.html("");
73656         if (rtl) {
73657           nav.call(drawNext).call(drawPrevious);
73658         } else {
73659           nav.call(drawPrevious).call(drawNext);
73660         }
73661         function drawNext(selection2) {
73662           if (i3 < docs.length - 1) {
73663             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
73664               d3_event.preventDefault();
73665               clickHelp(docs[i3 + 1], i3 + 1);
73666             });
73667             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
73668           }
73669         }
73670         function drawPrevious(selection2) {
73671           if (i3 > 0) {
73672             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
73673               d3_event.preventDefault();
73674               clickHelp(docs[i3 - 1], i3 - 1);
73675             });
73676             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
73677           }
73678         }
73679       }
73680       function clickWalkthrough(d3_event) {
73681         d3_event.preventDefault();
73682         if (context.inIntro()) return;
73683         context.container().call(uiIntro(context));
73684         context.ui().togglePanes();
73685       }
73686       function clickShortcuts(d3_event) {
73687         d3_event.preventDefault();
73688         context.container().call(context.ui().shortcuts, true);
73689       }
73690       var toc = content.append("ul").attr("class", "toc");
73691       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
73692         return d2.title;
73693       }).on("click", function(d3_event, d2) {
73694         d3_event.preventDefault();
73695         clickHelp(d2, docs.indexOf(d2));
73696       });
73697       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
73698         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
73699       ).append("a").attr("href", "#").on("click", clickShortcuts);
73700       shortcuts.append("div").call(_t.append("shortcuts.title"));
73701       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
73702       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73703       walkthrough.append("div").call(_t.append("splash.walkthrough"));
73704       var helpContent = content.append("div").attr("class", "left-content");
73705       var body = helpContent.append("div").attr("class", "body");
73706       var nav = helpContent.append("div").attr("class", "nav");
73707       clickHelp(docs[0], 0);
73708     };
73709     return helpPane;
73710   }
73711   var init_help = __esm({
73712     "modules/ui/panes/help.js"() {
73713       "use strict";
73714       init_marked_esm();
73715       init_icon();
73716       init_intro();
73717       init_pane();
73718       init_localizer();
73719       init_tooltip();
73720       init_helper();
73721     }
73722   });
73723
73724   // modules/ui/sections/validation_issues.js
73725   var validation_issues_exports = {};
73726   __export(validation_issues_exports, {
73727     uiSectionValidationIssues: () => uiSectionValidationIssues
73728   });
73729   function uiSectionValidationIssues(id2, severity, context) {
73730     var _issues = [];
73731     var section = uiSection(id2, context).label(function() {
73732       if (!_issues) return "";
73733       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
73734       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
73735     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
73736       return _issues && _issues.length;
73737     });
73738     function getOptions() {
73739       return {
73740         what: corePreferences("validate-what") || "edited",
73741         where: corePreferences("validate-where") || "all"
73742       };
73743     }
73744     function reloadIssues() {
73745       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
73746     }
73747     function renderDisclosureContent(selection2) {
73748       var center = context.map().center();
73749       var graph = context.graph();
73750       var issues = _issues.map(function withDistance(issue) {
73751         var extent = issue.extent(graph);
73752         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
73753         return Object.assign(issue, { dist });
73754       }).sort(function byDistance(a2, b2) {
73755         return a2.dist - b2.dist;
73756       });
73757       issues = issues.slice(0, 1e3);
73758       selection2.call(drawIssuesList, issues);
73759     }
73760     function drawIssuesList(selection2, issues) {
73761       var list2 = selection2.selectAll(".issues-list").data([0]);
73762       list2 = list2.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list2);
73763       var items = list2.selectAll("li").data(issues, function(d2) {
73764         return d2.key;
73765       });
73766       items.exit().remove();
73767       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
73768         return "issue severity-" + d2.severity;
73769       });
73770       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
73771         context.validator().focusIssue(d2);
73772       }).on("mouseover", function(d3_event, d2) {
73773         utilHighlightEntities(d2.entityIds, true, context);
73774       }).on("mouseout", function(d3_event, d2) {
73775         utilHighlightEntities(d2.entityIds, false, context);
73776       });
73777       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
73778       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
73779         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73780         select_default2(this).call(svgIcon(iconName));
73781       });
73782       textEnter.append("span").attr("class", "issue-message");
73783       items = items.merge(itemsEnter).order();
73784       items.selectAll(".issue-message").text("").each(function(d2) {
73785         return d2.message(context)(select_default2(this));
73786       });
73787     }
73788     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
73789       window.requestIdleCallback(function() {
73790         reloadIssues();
73791         section.reRender();
73792       });
73793     });
73794     context.map().on(
73795       "move.uiSectionValidationIssues" + id2,
73796       debounce_default(function() {
73797         window.requestIdleCallback(function() {
73798           if (getOptions().where === "visible") {
73799             reloadIssues();
73800           }
73801           section.reRender();
73802         });
73803       }, 1e3)
73804     );
73805     return section;
73806   }
73807   var init_validation_issues = __esm({
73808     "modules/ui/sections/validation_issues.js"() {
73809       "use strict";
73810       init_debounce();
73811       init_src5();
73812       init_geo2();
73813       init_icon();
73814       init_preferences();
73815       init_localizer();
73816       init_util();
73817       init_section();
73818     }
73819   });
73820
73821   // modules/ui/sections/validation_options.js
73822   var validation_options_exports = {};
73823   __export(validation_options_exports, {
73824     uiSectionValidationOptions: () => uiSectionValidationOptions
73825   });
73826   function uiSectionValidationOptions(context) {
73827     var section = uiSection("issues-options", context).content(renderContent);
73828     function renderContent(selection2) {
73829       var container = selection2.selectAll(".issues-options-container").data([0]);
73830       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
73831       var data = [
73832         { key: "what", values: ["edited", "all"] },
73833         { key: "where", values: ["visible", "all"] }
73834       ];
73835       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
73836         return d2.key;
73837       });
73838       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
73839         return "issues-option issues-option-" + d2.key;
73840       });
73841       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
73842         return _t.html("issues.options." + d2.key + ".title");
73843       });
73844       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
73845         return d2.values.map(function(val) {
73846           return { value: val, key: d2.key };
73847         });
73848       }).enter().append("label");
73849       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
73850         return "issues-option-" + d2.key;
73851       }).attr("value", function(d2) {
73852         return d2.value;
73853       }).property("checked", function(d2) {
73854         return getOptions()[d2.key] === d2.value;
73855       }).on("change", function(d3_event, d2) {
73856         updateOptionValue(d3_event, d2.key, d2.value);
73857       });
73858       valuesEnter.append("span").html(function(d2) {
73859         return _t.html("issues.options." + d2.key + "." + d2.value);
73860       });
73861     }
73862     function getOptions() {
73863       return {
73864         what: corePreferences("validate-what") || "edited",
73865         // 'all', 'edited'
73866         where: corePreferences("validate-where") || "all"
73867         // 'all', 'visible'
73868       };
73869     }
73870     function updateOptionValue(d3_event, d2, val) {
73871       if (!val && d3_event && d3_event.target) {
73872         val = d3_event.target.value;
73873       }
73874       corePreferences("validate-" + d2, val);
73875       context.validator().validate();
73876     }
73877     return section;
73878   }
73879   var init_validation_options = __esm({
73880     "modules/ui/sections/validation_options.js"() {
73881       "use strict";
73882       init_preferences();
73883       init_localizer();
73884       init_section();
73885     }
73886   });
73887
73888   // modules/ui/sections/validation_rules.js
73889   var validation_rules_exports = {};
73890   __export(validation_rules_exports, {
73891     uiSectionValidationRules: () => uiSectionValidationRules
73892   });
73893   function uiSectionValidationRules(context) {
73894     var MINSQUARE = 0;
73895     var MAXSQUARE = 20;
73896     var DEFAULTSQUARE = 5;
73897     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
73898     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
73899       return key !== "maprules";
73900     }).sort(function(key1, key2) {
73901       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
73902     });
73903     function renderDisclosureContent(selection2) {
73904       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
73905       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
73906       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
73907       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
73908       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73909         d3_event.preventDefault();
73910         context.validator().disableRules(_ruleKeys);
73911       });
73912       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73913         d3_event.preventDefault();
73914         context.validator().disableRules([]);
73915       });
73916       container = container.merge(containerEnter);
73917       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
73918     }
73919     function drawListItems(selection2, data, type2, name, change, active) {
73920       var items = selection2.selectAll("li").data(data);
73921       items.exit().remove();
73922       var enter = items.enter().append("li");
73923       if (name === "rule") {
73924         enter.call(
73925           uiTooltip().title(function(d2) {
73926             return _t.append("issues." + d2 + ".tip");
73927           }).placement("top")
73928         );
73929       }
73930       var label = enter.append("label");
73931       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73932       label.append("span").html(function(d2) {
73933         var params = {};
73934         if (d2 === "unsquare_way") {
73935           params.val = { html: '<span class="square-degrees"></span>' };
73936         }
73937         return _t.html("issues." + d2 + ".title", params);
73938       });
73939       items = items.merge(enter);
73940       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73941       var degStr = corePreferences("validate-square-degrees");
73942       if (degStr === null) {
73943         degStr = DEFAULTSQUARE.toString();
73944       }
73945       var span = items.selectAll(".square-degrees");
73946       var input = span.selectAll(".square-degrees-input").data([0]);
73947       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) {
73948         d3_event.preventDefault();
73949         d3_event.stopPropagation();
73950         this.select();
73951       }).on("keyup", function(d3_event) {
73952         if (d3_event.keyCode === 13) {
73953           this.blur();
73954           this.select();
73955         }
73956       }).on("blur", changeSquare).merge(input).property("value", degStr);
73957     }
73958     function changeSquare() {
73959       var input = select_default2(this);
73960       var degStr = utilGetSetValue(input).trim();
73961       var degNum = Number(degStr);
73962       if (!isFinite(degNum)) {
73963         degNum = DEFAULTSQUARE;
73964       } else if (degNum > MAXSQUARE) {
73965         degNum = MAXSQUARE;
73966       } else if (degNum < MINSQUARE) {
73967         degNum = MINSQUARE;
73968       }
73969       degNum = Math.round(degNum * 10) / 10;
73970       degStr = degNum.toString();
73971       input.property("value", degStr);
73972       corePreferences("validate-square-degrees", degStr);
73973       context.validator().revalidateUnsquare();
73974     }
73975     function isRuleEnabled(d2) {
73976       return context.validator().isRuleEnabled(d2);
73977     }
73978     function toggleRule(d3_event, d2) {
73979       context.validator().toggleRule(d2);
73980     }
73981     context.validator().on("validated.uiSectionValidationRules", function() {
73982       window.requestIdleCallback(section.reRender);
73983     });
73984     return section;
73985   }
73986   var init_validation_rules = __esm({
73987     "modules/ui/sections/validation_rules.js"() {
73988       "use strict";
73989       init_src5();
73990       init_preferences();
73991       init_localizer();
73992       init_util();
73993       init_tooltip();
73994       init_section();
73995     }
73996   });
73997
73998   // modules/ui/sections/validation_status.js
73999   var validation_status_exports = {};
74000   __export(validation_status_exports, {
74001     uiSectionValidationStatus: () => uiSectionValidationStatus
74002   });
74003   function uiSectionValidationStatus(context) {
74004     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
74005       var issues = context.validator().getIssues(getOptions());
74006       return issues.length === 0;
74007     });
74008     function getOptions() {
74009       return {
74010         what: corePreferences("validate-what") || "edited",
74011         where: corePreferences("validate-where") || "all"
74012       };
74013     }
74014     function renderContent(selection2) {
74015       var box = selection2.selectAll(".box").data([0]);
74016       var boxEnter = box.enter().append("div").attr("class", "box");
74017       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
74018       var noIssuesMessage = boxEnter.append("span");
74019       noIssuesMessage.append("strong").attr("class", "message");
74020       noIssuesMessage.append("br");
74021       noIssuesMessage.append("span").attr("class", "details");
74022       renderIgnoredIssuesReset(selection2);
74023       setNoIssuesText(selection2);
74024     }
74025     function renderIgnoredIssuesReset(selection2) {
74026       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
74027       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
74028       resetIgnored.exit().remove();
74029       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
74030       resetIgnoredEnter.append("a").attr("href", "#");
74031       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
74032       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
74033       resetIgnored.on("click", function(d3_event) {
74034         d3_event.preventDefault();
74035         context.validator().resetIgnoredIssues();
74036       });
74037     }
74038     function setNoIssuesText(selection2) {
74039       var opts = getOptions();
74040       function checkForHiddenIssues(cases) {
74041         for (var type2 in cases) {
74042           var hiddenOpts = cases[type2];
74043           var hiddenIssues = context.validator().getIssues(hiddenOpts);
74044           if (hiddenIssues.length) {
74045             selection2.select(".box .details").html("").call(_t.append(
74046               "issues.no_issues.hidden_issues." + type2,
74047               { count: hiddenIssues.length.toString() }
74048             ));
74049             return;
74050           }
74051         }
74052         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
74053       }
74054       var messageType;
74055       if (opts.what === "edited" && opts.where === "visible") {
74056         messageType = "edits_in_view";
74057         checkForHiddenIssues({
74058           elsewhere: { what: "edited", where: "all" },
74059           everything_else: { what: "all", where: "visible" },
74060           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
74061           everything_else_elsewhere: { what: "all", where: "all" },
74062           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
74063           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
74064           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
74065         });
74066       } else if (opts.what === "edited" && opts.where === "all") {
74067         messageType = "edits";
74068         checkForHiddenIssues({
74069           everything_else: { what: "all", where: "all" },
74070           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
74071           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
74072         });
74073       } else if (opts.what === "all" && opts.where === "visible") {
74074         messageType = "everything_in_view";
74075         checkForHiddenIssues({
74076           elsewhere: { what: "all", where: "all" },
74077           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
74078           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
74079           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
74080           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
74081         });
74082       } else if (opts.what === "all" && opts.where === "all") {
74083         messageType = "everything";
74084         checkForHiddenIssues({
74085           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
74086           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
74087         });
74088       }
74089       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
74090         messageType = "no_edits";
74091       }
74092       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
74093     }
74094     context.validator().on("validated.uiSectionValidationStatus", function() {
74095       window.requestIdleCallback(section.reRender);
74096     });
74097     context.map().on(
74098       "move.uiSectionValidationStatus",
74099       debounce_default(function() {
74100         window.requestIdleCallback(section.reRender);
74101       }, 1e3)
74102     );
74103     return section;
74104   }
74105   var init_validation_status = __esm({
74106     "modules/ui/sections/validation_status.js"() {
74107       "use strict";
74108       init_debounce();
74109       init_icon();
74110       init_preferences();
74111       init_localizer();
74112       init_section();
74113     }
74114   });
74115
74116   // modules/ui/panes/issues.js
74117   var issues_exports = {};
74118   __export(issues_exports, {
74119     uiPaneIssues: () => uiPaneIssues
74120   });
74121   function uiPaneIssues(context) {
74122     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
74123       uiSectionValidationOptions(context),
74124       uiSectionValidationStatus(context),
74125       uiSectionValidationIssues("issues-errors", "error", context),
74126       uiSectionValidationIssues("issues-warnings", "warning", context),
74127       uiSectionValidationRules(context)
74128     ]);
74129     return issuesPane;
74130   }
74131   var init_issues = __esm({
74132     "modules/ui/panes/issues.js"() {
74133       "use strict";
74134       init_localizer();
74135       init_pane();
74136       init_validation_issues();
74137       init_validation_options();
74138       init_validation_rules();
74139       init_validation_status();
74140     }
74141   });
74142
74143   // modules/ui/settings/custom_data.js
74144   var custom_data_exports = {};
74145   __export(custom_data_exports, {
74146     uiSettingsCustomData: () => uiSettingsCustomData
74147   });
74148   function uiSettingsCustomData(context) {
74149     var dispatch14 = dispatch_default("change");
74150     function render(selection2) {
74151       var dataLayer = context.layers().layer("data");
74152       var _origSettings = {
74153         fileList: dataLayer && dataLayer.fileList() || null,
74154         url: corePreferences("settings-custom-data-url")
74155       };
74156       var _currSettings = {
74157         fileList: dataLayer && dataLayer.fileList() || null
74158         // url: prefs('settings-custom-data-url')
74159       };
74160       var modal = uiConfirm(selection2).okButton();
74161       modal.classed("settings-modal settings-custom-data", true);
74162       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
74163       var textSection = modal.select(".modal-section.message-text");
74164       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
74165       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) {
74166         var files = d3_event.target.files;
74167         if (files && files.length) {
74168           _currSettings.url = "";
74169           textSection.select(".field-url").property("value", "");
74170           _currSettings.fileList = files;
74171         } else {
74172           _currSettings.fileList = null;
74173         }
74174       });
74175       textSection.append("h4").call(_t.append("settings.custom_data.or"));
74176       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
74177       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
74178       var buttonSection = modal.select(".modal-section.buttons");
74179       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
74180       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
74181       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
74182       function isSaveDisabled() {
74183         return null;
74184       }
74185       function clickCancel() {
74186         textSection.select(".field-url").property("value", _origSettings.url);
74187         corePreferences("settings-custom-data-url", _origSettings.url);
74188         this.blur();
74189         modal.close();
74190       }
74191       function clickSave() {
74192         _currSettings.url = textSection.select(".field-url").property("value").trim();
74193         if (_currSettings.url) {
74194           _currSettings.fileList = null;
74195         }
74196         if (_currSettings.fileList) {
74197           _currSettings.url = "";
74198         }
74199         corePreferences("settings-custom-data-url", _currSettings.url);
74200         this.blur();
74201         modal.close();
74202         dispatch14.call("change", this, _currSettings);
74203       }
74204     }
74205     return utilRebind(render, dispatch14, "on");
74206   }
74207   var init_custom_data = __esm({
74208     "modules/ui/settings/custom_data.js"() {
74209       "use strict";
74210       init_src4();
74211       init_preferences();
74212       init_localizer();
74213       init_confirm();
74214       init_util();
74215     }
74216   });
74217
74218   // modules/ui/sections/data_layers.js
74219   var data_layers_exports = {};
74220   __export(data_layers_exports, {
74221     uiSectionDataLayers: () => uiSectionDataLayers
74222   });
74223   function uiSectionDataLayers(context) {
74224     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
74225     var layers = context.layers();
74226     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
74227     function renderDisclosureContent(selection2) {
74228       var container = selection2.selectAll(".data-layer-container").data([0]);
74229       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
74230     }
74231     function showsLayer(which) {
74232       var layer = layers.layer(which);
74233       if (layer) {
74234         return layer.enabled();
74235       }
74236       return false;
74237     }
74238     function setLayer(which, enabled) {
74239       var mode = context.mode();
74240       if (mode && /^draw/.test(mode.id)) return;
74241       var layer = layers.layer(which);
74242       if (layer) {
74243         layer.enabled(enabled);
74244         if (!enabled && (which === "osm" || which === "notes")) {
74245           context.enter(modeBrowse(context));
74246         }
74247       }
74248     }
74249     function toggleLayer(which) {
74250       setLayer(which, !showsLayer(which));
74251     }
74252     function drawOsmItems(selection2) {
74253       var osmKeys = ["osm", "notes"];
74254       var osmLayers = layers.all().filter(function(obj) {
74255         return osmKeys.indexOf(obj.id) !== -1;
74256       });
74257       var ul = selection2.selectAll(".layer-list-osm").data([0]);
74258       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
74259       var li = ul.selectAll(".list-item").data(osmLayers);
74260       li.exit().remove();
74261       var liEnter = li.enter().append("li").attr("class", function(d2) {
74262         return "list-item list-item-" + d2.id;
74263       });
74264       var labelEnter = liEnter.append("label").each(function(d2) {
74265         if (d2.id === "osm") {
74266           select_default2(this).call(
74267             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
74268           );
74269         } else {
74270           select_default2(this).call(
74271             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
74272           );
74273         }
74274       });
74275       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74276         toggleLayer(d2.id);
74277       });
74278       labelEnter.append("span").html(function(d2) {
74279         return _t.html("map_data.layers." + d2.id + ".title");
74280       });
74281       li.merge(liEnter).classed("active", function(d2) {
74282         return d2.layer.enabled();
74283       }).selectAll("input").property("checked", function(d2) {
74284         return d2.layer.enabled();
74285       });
74286     }
74287     function drawQAItems(selection2) {
74288       var qaKeys = ["keepRight", "osmose"];
74289       var qaLayers = layers.all().filter(function(obj) {
74290         return qaKeys.indexOf(obj.id) !== -1;
74291       });
74292       var ul = selection2.selectAll(".layer-list-qa").data([0]);
74293       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
74294       var li = ul.selectAll(".list-item").data(qaLayers);
74295       li.exit().remove();
74296       var liEnter = li.enter().append("li").attr("class", function(d2) {
74297         return "list-item list-item-" + d2.id;
74298       });
74299       var labelEnter = liEnter.append("label").each(function(d2) {
74300         select_default2(this).call(
74301           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
74302         );
74303       });
74304       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74305         toggleLayer(d2.id);
74306       });
74307       labelEnter.append("span").each(function(d2) {
74308         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
74309       });
74310       li.merge(liEnter).classed("active", function(d2) {
74311         return d2.layer.enabled();
74312       }).selectAll("input").property("checked", function(d2) {
74313         return d2.layer.enabled();
74314       });
74315     }
74316     function drawVectorItems(selection2) {
74317       var dataLayer = layers.layer("data");
74318       var vtData = [
74319         {
74320           name: "Detroit Neighborhoods/Parks",
74321           src: "neighborhoods-parks",
74322           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
74323           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"
74324         },
74325         {
74326           name: "Detroit Composite POIs",
74327           src: "composite-poi",
74328           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
74329           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"
74330         },
74331         {
74332           name: "Detroit All-The-Places POIs",
74333           src: "alltheplaces-poi",
74334           tooltip: "Public domain business location data created by web scrapers.",
74335           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"
74336         }
74337       ];
74338       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
74339       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
74340       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
74341       container.exit().remove();
74342       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
74343       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
74344       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
74345       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");
74346       container = container.merge(containerEnter);
74347       var ul = container.selectAll(".layer-list-vectortile");
74348       var li = ul.selectAll(".list-item").data(vtData);
74349       li.exit().remove();
74350       var liEnter = li.enter().append("li").attr("class", function(d2) {
74351         return "list-item list-item-" + d2.src;
74352       });
74353       var labelEnter = liEnter.append("label").each(function(d2) {
74354         select_default2(this).call(
74355           uiTooltip().title(d2.tooltip).placement("top")
74356         );
74357       });
74358       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
74359       labelEnter.append("span").text(function(d2) {
74360         return d2.name;
74361       });
74362       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
74363       function isVTLayerSelected(d2) {
74364         return dataLayer && dataLayer.template() === d2.template;
74365       }
74366       function selectVTLayer(d3_event, d2) {
74367         corePreferences("settings-custom-data-url", d2.template);
74368         if (dataLayer) {
74369           dataLayer.template(d2.template, d2.src);
74370           dataLayer.enabled(true);
74371         }
74372       }
74373     }
74374     function drawCustomDataItems(selection2) {
74375       var dataLayer = layers.layer("data");
74376       var hasData = dataLayer && dataLayer.hasData();
74377       var showsData = hasData && dataLayer.enabled();
74378       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
74379       ul.exit().remove();
74380       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
74381       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
74382       var labelEnter = liEnter.append("label").call(
74383         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
74384       );
74385       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
74386         toggleLayer("data");
74387       });
74388       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
74389       liEnter.append("button").attr("class", "open-data-options").call(
74390         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74391       ).on("click", function(d3_event) {
74392         d3_event.preventDefault();
74393         editCustom();
74394       }).call(svgIcon("#iD-icon-more"));
74395       liEnter.append("button").attr("class", "zoom-to-data").call(
74396         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74397       ).on("click", function(d3_event) {
74398         if (select_default2(this).classed("disabled")) return;
74399         d3_event.preventDefault();
74400         d3_event.stopPropagation();
74401         dataLayer.fitZoom();
74402       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74403       ul = ul.merge(ulEnter);
74404       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74405       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74406     }
74407     function editCustom() {
74408       context.container().call(settingsCustomData);
74409     }
74410     function customChanged(d2) {
74411       var dataLayer = layers.layer("data");
74412       if (d2 && d2.url) {
74413         dataLayer.url(d2.url);
74414       } else if (d2 && d2.fileList) {
74415         dataLayer.fileList(d2.fileList);
74416       }
74417     }
74418     function drawPanelItems(selection2) {
74419       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
74420       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
74421         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
74422       );
74423       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
74424         d3_event.preventDefault();
74425         context.ui().info.toggle("history");
74426       });
74427       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
74428       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
74429         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
74430       );
74431       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
74432         d3_event.preventDefault();
74433         context.ui().info.toggle("measurement");
74434       });
74435       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
74436     }
74437     context.layers().on("change.uiSectionDataLayers", section.reRender);
74438     context.map().on(
74439       "move.uiSectionDataLayers",
74440       debounce_default(function() {
74441         window.requestIdleCallback(section.reRender);
74442       }, 1e3)
74443     );
74444     return section;
74445   }
74446   var init_data_layers = __esm({
74447     "modules/ui/sections/data_layers.js"() {
74448       "use strict";
74449       init_debounce();
74450       init_src5();
74451       init_preferences();
74452       init_localizer();
74453       init_tooltip();
74454       init_icon();
74455       init_geo2();
74456       init_browse();
74457       init_cmd();
74458       init_section();
74459       init_custom_data();
74460     }
74461   });
74462
74463   // modules/ui/sections/map_features.js
74464   var map_features_exports = {};
74465   __export(map_features_exports, {
74466     uiSectionMapFeatures: () => uiSectionMapFeatures
74467   });
74468   function uiSectionMapFeatures(context) {
74469     var _features = context.features().keys();
74470     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74471     function renderDisclosureContent(selection2) {
74472       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
74473       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
74474       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
74475       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
74476       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
74477         d3_event.preventDefault();
74478         context.features().disableAll();
74479       });
74480       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
74481         d3_event.preventDefault();
74482         context.features().enableAll();
74483       });
74484       container = container.merge(containerEnter);
74485       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
74486     }
74487     function drawListItems(selection2, data, type2, name, change, active) {
74488       var items = selection2.selectAll("li").data(data);
74489       items.exit().remove();
74490       var enter = items.enter().append("li").call(
74491         uiTooltip().title(function(d2) {
74492           var tip = _t.append(name + "." + d2 + ".tooltip");
74493           if (autoHiddenFeature(d2)) {
74494             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
74495             return (selection3) => {
74496               selection3.call(tip);
74497               selection3.append("div").call(msg);
74498             };
74499           }
74500           return tip;
74501         }).placement("top")
74502       );
74503       var label = enter.append("label");
74504       label.append("input").attr("type", type2).attr("name", name).on("change", change);
74505       label.append("span").html(function(d2) {
74506         return _t.html(name + "." + d2 + ".description");
74507       });
74508       items = items.merge(enter);
74509       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
74510     }
74511     function autoHiddenFeature(d2) {
74512       return context.features().autoHidden(d2);
74513     }
74514     function showsFeature(d2) {
74515       return context.features().enabled(d2);
74516     }
74517     function clickFeature(d3_event, d2) {
74518       context.features().toggle(d2);
74519     }
74520     function showsLayer(id2) {
74521       var layer = context.layers().layer(id2);
74522       return layer && layer.enabled();
74523     }
74524     context.features().on("change.map_features", section.reRender);
74525     return section;
74526   }
74527   var init_map_features = __esm({
74528     "modules/ui/sections/map_features.js"() {
74529       "use strict";
74530       init_localizer();
74531       init_tooltip();
74532       init_section();
74533     }
74534   });
74535
74536   // modules/ui/sections/map_style_options.js
74537   var map_style_options_exports = {};
74538   __export(map_style_options_exports, {
74539     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions
74540   });
74541   function uiSectionMapStyleOptions(context) {
74542     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74543     function renderDisclosureContent(selection2) {
74544       var container = selection2.selectAll(".layer-fill-list").data([0]);
74545       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
74546       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
74547       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
74548         return context.surface().classed("highlight-edited");
74549       });
74550     }
74551     function drawListItems(selection2, data, type2, name, change, active) {
74552       var items = selection2.selectAll("li").data(data);
74553       items.exit().remove();
74554       var enter = items.enter().append("li").call(
74555         uiTooltip().title(function(d2) {
74556           return _t.append(name + "." + d2 + ".tooltip");
74557         }).keys(function(d2) {
74558           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
74559           if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
74560           return key ? [key] : null;
74561         }).placement("top")
74562       );
74563       var label = enter.append("label");
74564       label.append("input").attr("type", type2).attr("name", name).on("change", change);
74565       label.append("span").html(function(d2) {
74566         return _t.html(name + "." + d2 + ".description");
74567       });
74568       items = items.merge(enter);
74569       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
74570     }
74571     function isActiveFill(d2) {
74572       return context.map().activeAreaFill() === d2;
74573     }
74574     function toggleHighlightEdited(d3_event) {
74575       d3_event.preventDefault();
74576       context.map().toggleHighlightEdited();
74577     }
74578     function setFill(d3_event, d2) {
74579       context.map().activeAreaFill(d2);
74580     }
74581     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
74582     return section;
74583   }
74584   var init_map_style_options = __esm({
74585     "modules/ui/sections/map_style_options.js"() {
74586       "use strict";
74587       init_localizer();
74588       init_tooltip();
74589       init_section();
74590     }
74591   });
74592
74593   // modules/ui/settings/local_photos.js
74594   var local_photos_exports2 = {};
74595   __export(local_photos_exports2, {
74596     uiSettingsLocalPhotos: () => uiSettingsLocalPhotos
74597   });
74598   function uiSettingsLocalPhotos(context) {
74599     var dispatch14 = dispatch_default("change");
74600     var photoLayer = context.layers().layer("local-photos");
74601     var modal;
74602     function render(selection2) {
74603       modal = uiConfirm(selection2).okButton();
74604       modal.classed("settings-modal settings-local-photos", true);
74605       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
74606       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
74607       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
74608       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
74609       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) {
74610         var files = d3_event.target.files;
74611         if (files && files.length) {
74612           photoList.select("ul").append("li").classed("placeholder", true).append("div");
74613           dispatch14.call("change", this, files);
74614         }
74615         d3_event.target.value = null;
74616       });
74617       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
74618       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
74619       photoList.append("ul");
74620       updatePhotoList(photoList.select("ul"));
74621       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
74622     }
74623     function updatePhotoList(container) {
74624       var _a3;
74625       function locationUnavailable(d2) {
74626         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
74627       }
74628       container.selectAll("li.placeholder").remove();
74629       let selection2 = container.selectAll("li").data((_a3 = photoLayer.getPhotos()) != null ? _a3 : [], (d2) => d2.id);
74630       selection2.exit().remove();
74631       const selectionEnter = selection2.enter().append("li");
74632       selectionEnter.append("span").classed("filename", true);
74633       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
74634       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
74635         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
74636       );
74637       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
74638       selection2 = selection2.merge(selectionEnter);
74639       selection2.classed("invalid", locationUnavailable);
74640       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
74641       selection2.select("span.filename").on("click", (d3_event, d2) => {
74642         photoLayer.openPhoto(d3_event, d2, false);
74643       });
74644       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
74645         photoLayer.openPhoto(d3_event, d2, true);
74646       });
74647       selection2.select("button.remove").on("click", (d3_event, d2) => {
74648         photoLayer.removePhoto(d2.id);
74649         updatePhotoList(container);
74650       });
74651     }
74652     return utilRebind(render, dispatch14, "on");
74653   }
74654   var init_local_photos2 = __esm({
74655     "modules/ui/settings/local_photos.js"() {
74656       "use strict";
74657       init_src4();
74658       init_lodash();
74659       init_localizer();
74660       init_confirm();
74661       init_util();
74662       init_tooltip();
74663       init_svg();
74664     }
74665   });
74666
74667   // modules/ui/sections/photo_overlays.js
74668   var photo_overlays_exports = {};
74669   __export(photo_overlays_exports, {
74670     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays
74671   });
74672   function uiSectionPhotoOverlays(context) {
74673     let _savedLayers = [];
74674     let _layersHidden = false;
74675     const _streetLayerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
74676     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
74677     var layers = context.layers();
74678     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
74679     const photoDates = {};
74680     const now3 = +/* @__PURE__ */ new Date();
74681     function renderDisclosureContent(selection2) {
74682       var container = selection2.selectAll(".photo-overlay-container").data([0]);
74683       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateSlider).call(drawUsernameFilter).call(drawLocalPhotos);
74684     }
74685     function drawPhotoItems(selection2) {
74686       var photoKeys = context.photos().overlayLayerIDs();
74687       var photoLayers = layers.all().filter(function(obj) {
74688         return photoKeys.indexOf(obj.id) !== -1;
74689       });
74690       var data = photoLayers.filter(function(obj) {
74691         if (!obj.layer.supported()) return false;
74692         if (layerEnabled(obj)) return true;
74693         if (typeof obj.layer.validHere === "function") {
74694           return obj.layer.validHere(context.map().extent(), context.map().zoom());
74695         }
74696         return true;
74697       });
74698       function layerSupported(d2) {
74699         return d2.layer && d2.layer.supported();
74700       }
74701       function layerEnabled(d2) {
74702         return layerSupported(d2) && (d2.layer.enabled() || _savedLayers.includes(d2.id));
74703       }
74704       function layerRendered(d2) {
74705         var _a3, _b2, _c;
74706         return (_c = (_b2 = (_a3 = d2.layer).rendered) == null ? void 0 : _b2.call(_a3, context.map().zoom())) != null ? _c : true;
74707       }
74708       var ul = selection2.selectAll(".layer-list-photos").data([0]);
74709       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
74710       var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
74711       li.exit().remove();
74712       var liEnter = li.enter().append("li").attr("class", function(d2) {
74713         var classes = "list-item-photos list-item-" + d2.id;
74714         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
74715           classes += " indented";
74716         }
74717         return classes;
74718       });
74719       var labelEnter = liEnter.append("label").each(function(d2) {
74720         var titleID;
74721         if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
74722         else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
74723         else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
74724         else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
74725         select_default2(this).call(
74726           uiTooltip().title(() => {
74727             if (!layerRendered(d2)) {
74728               return _t.append("street_side.minzoom_tooltip");
74729             } else {
74730               return _t.append(titleID);
74731             }
74732           }).placement("top")
74733         );
74734       });
74735       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74736         toggleLayer(d2.id);
74737       });
74738       labelEnter.append("span").html(function(d2) {
74739         var id2 = d2.id;
74740         if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
74741         return _t.html(id2.replace(/-/g, "_") + ".title");
74742       });
74743       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
74744     }
74745     function drawPhotoTypeItems(selection2) {
74746       var data = context.photos().allPhotoTypes();
74747       function typeEnabled(d2) {
74748         return context.photos().showsPhotoType(d2);
74749       }
74750       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
74751       ul.exit().remove();
74752       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
74753       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
74754       li.exit().remove();
74755       var liEnter = li.enter().append("li").attr("class", function(d2) {
74756         return "list-item-photo-types list-item-" + d2;
74757       });
74758       var labelEnter = liEnter.append("label").each(function(d2) {
74759         select_default2(this).call(
74760           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
74761         );
74762       });
74763       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
74764         context.photos().togglePhotoType(d2, true);
74765       });
74766       labelEnter.append("span").html(function(d2) {
74767         return _t.html("photo_overlays.photo_type." + d2 + ".title");
74768       });
74769       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
74770     }
74771     function drawDateSlider(selection2) {
74772       var ul = selection2.selectAll(".layer-list-date-slider").data([0]);
74773       ul.exit().remove();
74774       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-slider").merge(ul);
74775       var li = ul.selectAll(".list-item-date-slider").data(context.photos().shouldFilterDateBySlider() ? ["date-slider"] : []);
74776       li.exit().remove();
74777       var liEnter = li.enter().append("li").attr("class", "list-item-date-slider");
74778       var labelEnter = liEnter.append("label").each(function() {
74779         select_default2(this).call(
74780           uiTooltip().title(() => _t.append("photo_overlays.age_slider_filter.tooltip")).placement("top")
74781         );
74782       });
74783       labelEnter.append("span").attr("class", "dateSliderSpan").call(_t.append("photo_overlays.age_slider_filter.title"));
74784       let sliderWrap = labelEnter.append("div").attr("class", "slider-wrap");
74785       sliderWrap.append("input").attr("type", "range").attr("min", 0).attr("max", 1).attr("step", 1e-3).attr("list", "photo-overlay-data-range").attr("value", () => dateSliderValue("from")).classed("list-option-date-slider", true).classed("from-date", true).style("direction", _mainLocalizer.textDirection() === "rtl" ? "ltr" : "rtl").call(utilNoAuto).on("change", function() {
74786         let value = select_default2(this).property("value");
74787         setYearFilter(value, true, "from");
74788       });
74789       selection2.select("input.from-date").each(function() {
74790         this.value = dateSliderValue("from");
74791       });
74792       sliderWrap.append("div").attr("class", "date-slider-label");
74793       sliderWrap.append("input").attr("type", "range").attr("min", 0).attr("max", 1).attr("step", 1e-3).attr("list", "photo-overlay-data-range-inverted").attr("value", () => 1 - dateSliderValue("to")).classed("list-option-date-slider", true).classed("to-date", true).style("display", () => dateSliderValue("to") === 0 ? "none" : null).style("direction", _mainLocalizer.textDirection()).call(utilNoAuto).on("change", function() {
74794         let value = select_default2(this).property("value");
74795         setYearFilter(1 - value, true, "to");
74796       });
74797       selection2.select("input.to-date").each(function() {
74798         this.value = 1 - dateSliderValue("to");
74799       });
74800       selection2.select(".date-slider-label").call(dateSliderValue("from") === 1 ? _t.addOrUpdate("photo_overlays.age_slider_filter.label_all") : _t.addOrUpdate("photo_overlays.age_slider_filter.label_date", {
74801         date: new Date(now3 - Math.pow(dateSliderValue("from"), 1.45) * 10 * 365.25 * 86400 * 1e3).toLocaleDateString(_mainLocalizer.localeCode())
74802       }));
74803       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range");
74804       sliderWrap.append("datalist").attr("class", "date-slider-values").attr("id", "photo-overlay-data-range-inverted");
74805       const dateTicks = /* @__PURE__ */ new Set();
74806       for (const dates of Object.values(photoDates)) {
74807         dates.forEach((date) => {
74808           dateTicks.add(Math.round(1e3 * Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45)) / 1e3);
74809         });
74810       }
74811       const ticks2 = selection2.select("datalist#photo-overlay-data-range").selectAll("option").data([...dateTicks].concat([1, 0]));
74812       ticks2.exit().remove();
74813       ticks2.enter().append("option").merge(ticks2).attr("value", (d2) => d2);
74814       const ticksInverted = selection2.select("datalist#photo-overlay-data-range-inverted").selectAll("option").data([...dateTicks].concat([1, 0]));
74815       ticksInverted.exit().remove();
74816       ticksInverted.enter().append("option").merge(ticksInverted).attr("value", (d2) => 1 - d2);
74817       li.merge(liEnter).classed("active", filterEnabled);
74818       function filterEnabled() {
74819         return !!context.photos().fromDate();
74820       }
74821     }
74822     function dateSliderValue(which) {
74823       const val = which === "from" ? context.photos().fromDate() : context.photos().toDate();
74824       if (val) {
74825         const date = +new Date(val);
74826         return Math.pow((now3 - date) / (10 * 365.25 * 86400 * 1e3), 1 / 1.45);
74827       } else return which === "from" ? 1 : 0;
74828     }
74829     function setYearFilter(value, updateUrl, which) {
74830       value = +value + (which === "from" ? 1e-3 : -1e-3);
74831       if (value < 1 && value > 0) {
74832         const date = new Date(now3 - Math.pow(value, 1.45) * 10 * 365.25 * 86400 * 1e3).toISOString().substring(0, 10);
74833         context.photos().setDateFilter(`${which}Date`, date, updateUrl);
74834       } else {
74835         context.photos().setDateFilter(`${which}Date`, null, updateUrl);
74836       }
74837     }
74838     ;
74839     function drawUsernameFilter(selection2) {
74840       function filterEnabled() {
74841         return context.photos().usernames();
74842       }
74843       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
74844       ul.exit().remove();
74845       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
74846       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
74847       li.exit().remove();
74848       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
74849       var labelEnter = liEnter.append("label").each(function() {
74850         select_default2(this).call(
74851           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
74852         );
74853       });
74854       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
74855       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
74856         var value = select_default2(this).property("value");
74857         context.photos().setUsernameFilter(value, true);
74858         select_default2(this).property("value", usernameValue);
74859       });
74860       li.merge(liEnter).classed("active", filterEnabled);
74861       function usernameValue() {
74862         var usernames = context.photos().usernames();
74863         if (usernames) return usernames.join("; ");
74864         return usernames;
74865       }
74866     }
74867     function toggleLayer(which) {
74868       setLayer(which, !showsLayer(which));
74869     }
74870     function showsLayer(which) {
74871       var layer = layers.layer(which);
74872       if (layer) {
74873         return layer.enabled();
74874       }
74875       return false;
74876     }
74877     function setLayer(which, enabled) {
74878       var layer = layers.layer(which);
74879       if (layer) {
74880         layer.enabled(enabled);
74881       }
74882     }
74883     function drawLocalPhotos(selection2) {
74884       var photoLayer = layers.layer("local-photos");
74885       var hasData = photoLayer && photoLayer.hasData();
74886       var showsData = hasData && photoLayer.enabled();
74887       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
74888       ul.exit().remove();
74889       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
74890       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
74891       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
74892       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
74893         toggleLayer("local-photos");
74894       });
74895       localPhotosLabelEnter.call(_t.append("local_photos.header"));
74896       localPhotosEnter.append("button").attr("class", "open-data-options").call(
74897         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74898       ).on("click", function(d3_event) {
74899         d3_event.preventDefault();
74900         editLocalPhotos();
74901       }).call(svgIcon("#iD-icon-more"));
74902       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
74903         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74904       ).on("click", function(d3_event) {
74905         if (select_default2(this).classed("disabled")) return;
74906         d3_event.preventDefault();
74907         d3_event.stopPropagation();
74908         photoLayer.fitZoom();
74909       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74910       ul = ul.merge(ulEnter);
74911       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74912       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74913     }
74914     function editLocalPhotos() {
74915       context.container().call(settingsLocalPhotos);
74916     }
74917     function localPhotosChanged(d2) {
74918       var localPhotosLayer = layers.layer("local-photos");
74919       localPhotosLayer.fileList(d2);
74920     }
74921     function toggleStreetSide() {
74922       let layerContainer = select_default2(".photo-overlay-container");
74923       if (!_layersHidden) {
74924         layers.all().forEach((d2) => {
74925           if (_streetLayerIDs.includes(d2.id)) {
74926             if (showsLayer(d2.id)) _savedLayers.push(d2.id);
74927             setLayer(d2.id, false);
74928           }
74929         });
74930         layerContainer.classed("disabled-panel", true);
74931       } else {
74932         _savedLayers.forEach((d2) => {
74933           setLayer(d2, true);
74934         });
74935         _savedLayers = [];
74936         layerContainer.classed("disabled-panel", false);
74937       }
74938       _layersHidden = !_layersHidden;
74939     }
74940     ;
74941     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
74942     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
74943     context.layers().on("photoDatesChanged.uiSectionPhotoOverlays", function(service, dates) {
74944       photoDates[service] = dates.map((date) => +new Date(date));
74945       section.reRender();
74946     });
74947     context.keybinding().on("\u21E7P", toggleStreetSide);
74948     context.map().on(
74949       "move.photo_overlays",
74950       debounce_default(function() {
74951         window.requestIdleCallback(section.reRender);
74952       }, 1e3)
74953     );
74954     return section;
74955   }
74956   var init_photo_overlays = __esm({
74957     "modules/ui/sections/photo_overlays.js"() {
74958       "use strict";
74959       init_debounce();
74960       init_src5();
74961       init_localizer();
74962       init_tooltip();
74963       init_section();
74964       init_util();
74965       init_local_photos2();
74966       init_svg();
74967     }
74968   });
74969
74970   // modules/ui/panes/map_data.js
74971   var map_data_exports = {};
74972   __export(map_data_exports, {
74973     uiPaneMapData: () => uiPaneMapData
74974   });
74975   function uiPaneMapData(context) {
74976     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([
74977       uiSectionDataLayers(context),
74978       uiSectionPhotoOverlays(context),
74979       uiSectionMapStyleOptions(context),
74980       uiSectionMapFeatures(context)
74981     ]);
74982     return mapDataPane;
74983   }
74984   var init_map_data = __esm({
74985     "modules/ui/panes/map_data.js"() {
74986       "use strict";
74987       init_localizer();
74988       init_pane();
74989       init_data_layers();
74990       init_map_features();
74991       init_map_style_options();
74992       init_photo_overlays();
74993     }
74994   });
74995
74996   // modules/ui/panes/preferences.js
74997   var preferences_exports2 = {};
74998   __export(preferences_exports2, {
74999     uiPanePreferences: () => uiPanePreferences
75000   });
75001   function uiPanePreferences(context) {
75002     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
75003       uiSectionPrivacy(context)
75004     ]);
75005     return preferencesPane;
75006   }
75007   var init_preferences2 = __esm({
75008     "modules/ui/panes/preferences.js"() {
75009       "use strict";
75010       init_localizer();
75011       init_pane();
75012       init_privacy();
75013     }
75014   });
75015
75016   // modules/ui/init.js
75017   var init_exports = {};
75018   __export(init_exports, {
75019     uiInit: () => uiInit
75020   });
75021   function uiInit(context) {
75022     var _initCounter = 0;
75023     var _needWidth = {};
75024     var _lastPointerType;
75025     var overMap;
75026     function render(container) {
75027       container.on("click.ui", function(d3_event) {
75028         if (d3_event.button !== 0) return;
75029         if (!d3_event.composedPath) return;
75030         var isOkayTarget = d3_event.composedPath().some(function(node) {
75031           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
75032           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
75033           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
75034           node.nodeName === "A");
75035         });
75036         if (isOkayTarget) return;
75037         d3_event.preventDefault();
75038       });
75039       var detected = utilDetect();
75040       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
75041       // but we only need to do this on desktop Safari anyway. – #7694
75042       !detected.isMobileWebKit) {
75043         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
75044           d3_event.preventDefault();
75045         });
75046       }
75047       if ("PointerEvent" in window) {
75048         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
75049           var pointerType = d3_event.pointerType || "mouse";
75050           if (_lastPointerType !== pointerType) {
75051             _lastPointerType = pointerType;
75052             container.attr("pointer", pointerType);
75053           }
75054         }, true);
75055       } else {
75056         _lastPointerType = "mouse";
75057         container.attr("pointer", "mouse");
75058       }
75059       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
75060       container.call(uiFullScreen(context));
75061       var map2 = context.map();
75062       map2.redrawEnable(false);
75063       map2.on("hitMinZoom.ui", function() {
75064         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
75065       });
75066       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
75067       container.append("div").attr("class", "sidebar").call(ui.sidebar);
75068       var content = container.append("div").attr("class", "main-content active");
75069       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
75070       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
75071       overMap = content.append("div").attr("class", "over-map");
75072       overMap.append("div").attr("class", "select-trap").text("t");
75073       overMap.call(uiMapInMap(context)).call(uiNotice(context));
75074       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
75075       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
75076       var controls = controlsWrap.append("div").attr("class", "map-controls");
75077       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
75078       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
75079       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
75080       controlsWrap.on("wheel.mapControls", function(d3_event) {
75081         if (!d3_event.deltaX) {
75082           controlsWrap.node().scrollTop += d3_event.deltaY;
75083         }
75084       });
75085       var panes = overMap.append("div").attr("class", "map-panes");
75086       var uiPanes = [
75087         uiPaneBackground(context),
75088         uiPaneMapData(context),
75089         uiPaneIssues(context),
75090         uiPanePreferences(context),
75091         uiPaneHelp(context)
75092       ];
75093       uiPanes.forEach(function(pane) {
75094         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
75095         panes.call(pane.renderPane);
75096       });
75097       ui.info = uiInfo(context);
75098       overMap.call(ui.info);
75099       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
75100       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
75101       var about = content.append("div").attr("class", "map-footer");
75102       about.append("div").attr("class", "api-status").call(uiStatus(context));
75103       var footer = about.append("div").attr("class", "map-footer-bar fillD");
75104       footer.append("div").attr("class", "flash-wrap footer-hide");
75105       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
75106       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
75107       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
75108       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
75109       var apiConnections = context.connection().apiConnections();
75110       if (apiConnections && apiConnections.length > 1) {
75111         aboutList.append("li").attr("class", "source-switch").call(
75112           uiSourceSwitch(context).keys(apiConnections)
75113         );
75114       }
75115       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
75116       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
75117       var issueLinks = aboutList.append("li");
75118       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"));
75119       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"));
75120       aboutList.append("li").attr("class", "version").call(uiVersion(context));
75121       if (!context.embed()) {
75122         aboutList.call(uiAccount(context));
75123       }
75124       ui.onResize();
75125       map2.redrawEnable(true);
75126       ui.hash = behaviorHash(context);
75127       ui.hash();
75128       if (!ui.hash.hadLocation) {
75129         map2.centerZoom([0, 0], 2);
75130       }
75131       window.onbeforeunload = function() {
75132         return context.save();
75133       };
75134       window.onunload = function() {
75135         context.history().unlock();
75136       };
75137       select_default2(window).on("resize.editor", function() {
75138         ui.onResize();
75139       });
75140       var panPixels = 80;
75141       context.keybinding().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) {
75142         if (d3_event) {
75143           d3_event.stopImmediatePropagation();
75144           d3_event.preventDefault();
75145         }
75146         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
75147         if (previousBackground) {
75148           var currentBackground = context.background().baseLayerSource();
75149           corePreferences("background-last-used-toggle", currentBackground.id);
75150           corePreferences("background-last-used", previousBackground.id);
75151           context.background().baseLayerSource(previousBackground);
75152         }
75153       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
75154         d3_event.preventDefault();
75155         d3_event.stopPropagation();
75156         context.map().toggleWireframe();
75157       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
75158         d3_event.preventDefault();
75159         d3_event.stopPropagation();
75160         var mode = context.mode();
75161         if (mode && /^draw/.test(mode.id)) return;
75162         var layer = context.layers().layer("osm");
75163         if (layer) {
75164           layer.enabled(!layer.enabled());
75165           if (!layer.enabled()) {
75166             context.enter(modeBrowse(context));
75167           }
75168         }
75169       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
75170         d3_event.preventDefault();
75171         context.map().toggleHighlightEdited();
75172       });
75173       context.on("enter.editor", function(entered) {
75174         container.classed("mode-" + entered.id, true);
75175       }).on("exit.editor", function(exited) {
75176         container.classed("mode-" + exited.id, false);
75177       });
75178       context.enter(modeBrowse(context));
75179       if (!_initCounter++) {
75180         if (!ui.hash.startWalkthrough) {
75181           context.container().call(uiSplash(context)).call(uiRestore(context));
75182         }
75183         context.container().call(ui.shortcuts);
75184       }
75185       var osm = context.connection();
75186       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
75187       if (osm && auth) {
75188         osm.on("authLoading.ui", function() {
75189           context.container().call(auth);
75190         }).on("authDone.ui", function() {
75191           auth.close();
75192         });
75193       }
75194       _initCounter++;
75195       if (ui.hash.startWalkthrough) {
75196         ui.hash.startWalkthrough = false;
75197         context.container().call(uiIntro(context));
75198       }
75199       function pan(d2) {
75200         return function(d3_event) {
75201           if (d3_event.shiftKey) return;
75202           if (context.container().select(".combobox").size()) return;
75203           d3_event.preventDefault();
75204           context.map().pan(d2, 100);
75205         };
75206       }
75207     }
75208     let ui = {};
75209     let _loadPromise;
75210     ui.ensureLoaded = () => {
75211       if (_loadPromise) return _loadPromise;
75212       return _loadPromise = Promise.all([
75213         // must have strings and presets before loading the UI
75214         _mainLocalizer.ensureLoaded(),
75215         _mainPresetIndex.ensureLoaded()
75216       ]).then(() => {
75217         if (!context.container().empty()) render(context.container());
75218       }).catch((err) => console.error(err));
75219     };
75220     ui.restart = function() {
75221       context.keybinding().clear();
75222       _loadPromise = null;
75223       context.container().selectAll("*").remove();
75224       ui.ensureLoaded();
75225     };
75226     ui.lastPointerType = function() {
75227       return _lastPointerType;
75228     };
75229     ui.svgDefs = svgDefs(context);
75230     ui.flash = uiFlash(context);
75231     ui.sidebar = uiSidebar(context);
75232     ui.photoviewer = uiPhotoviewer(context);
75233     ui.shortcuts = uiShortcuts(context);
75234     ui.onResize = function(withPan) {
75235       var map2 = context.map();
75236       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
75237       utilGetDimensions(context.container().select(".sidebar"), true);
75238       if (withPan !== void 0) {
75239         map2.redrawEnable(false);
75240         map2.pan(withPan);
75241         map2.redrawEnable(true);
75242       }
75243       map2.dimensions(mapDimensions);
75244       ui.photoviewer.onMapResize();
75245       ui.checkOverflow(".top-toolbar");
75246       ui.checkOverflow(".map-footer-bar");
75247       var resizeWindowEvent = document.createEvent("Event");
75248       resizeWindowEvent.initEvent("resizeWindow", true, true);
75249       document.dispatchEvent(resizeWindowEvent);
75250     };
75251     ui.checkOverflow = function(selector, reset) {
75252       if (reset) {
75253         delete _needWidth[selector];
75254       }
75255       var selection2 = context.container().select(selector);
75256       if (selection2.empty()) return;
75257       var scrollWidth = selection2.property("scrollWidth");
75258       var clientWidth = selection2.property("clientWidth");
75259       var needed = _needWidth[selector] || scrollWidth;
75260       if (scrollWidth > clientWidth) {
75261         selection2.classed("narrow", true);
75262         if (!_needWidth[selector]) {
75263           _needWidth[selector] = scrollWidth;
75264         }
75265       } else if (scrollWidth >= needed) {
75266         selection2.classed("narrow", false);
75267       }
75268     };
75269     ui.togglePanes = function(showPane) {
75270       var hidePanes = context.container().selectAll(".map-pane.shown");
75271       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
75272       hidePanes.classed("shown", false).classed("hide", true);
75273       context.container().selectAll(".map-pane-control button").classed("active", false);
75274       if (showPane) {
75275         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
75276         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
75277         showPane.classed("shown", true).classed("hide", false);
75278         if (hidePanes.empty()) {
75279           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
75280         } else {
75281           showPane.style(side, "0px");
75282         }
75283       } else {
75284         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
75285           select_default2(this).classed("shown", false).classed("hide", true);
75286         });
75287       }
75288     };
75289     var _editMenu = uiEditMenu(context);
75290     ui.editMenu = function() {
75291       return _editMenu;
75292     };
75293     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
75294       ui.closeEditMenu();
75295       if (!operations && context.mode().operations) operations = context.mode().operations();
75296       if (!operations || !operations.length) return;
75297       if (!context.map().editableDataEnabled()) return;
75298       var surfaceNode = context.surface().node();
75299       if (surfaceNode.focus) {
75300         surfaceNode.focus();
75301       }
75302       operations.forEach(function(operation2) {
75303         if (operation2.point) operation2.point(anchorPoint);
75304       });
75305       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
75306       overMap.call(_editMenu);
75307     };
75308     ui.closeEditMenu = function() {
75309       if (overMap !== void 0) {
75310         overMap.select(".edit-menu").remove();
75311       }
75312     };
75313     var _saveLoading = select_default2(null);
75314     context.uploader().on("saveStarted.ui", function() {
75315       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
75316       context.container().call(_saveLoading);
75317     }).on("saveEnded.ui", function() {
75318       _saveLoading.close();
75319       _saveLoading = select_default2(null);
75320     });
75321     marked.use({
75322       mangle: false,
75323       headerIds: false
75324     });
75325     return ui;
75326   }
75327   var init_init2 = __esm({
75328     "modules/ui/init.js"() {
75329       "use strict";
75330       init_marked_esm();
75331       init_src5();
75332       init_preferences();
75333       init_localizer();
75334       init_presets();
75335       init_behavior();
75336       init_browse();
75337       init_svg();
75338       init_detect();
75339       init_dimensions();
75340       init_account();
75341       init_attribution();
75342       init_contributors();
75343       init_edit_menu();
75344       init_feature_info();
75345       init_flash();
75346       init_full_screen();
75347       init_geolocate2();
75348       init_info();
75349       init_intro2();
75350       init_issues_info();
75351       init_loading();
75352       init_map_in_map();
75353       init_notice();
75354       init_photoviewer();
75355       init_restore();
75356       init_scale2();
75357       init_shortcuts();
75358       init_sidebar();
75359       init_source_switch();
75360       init_spinner();
75361       init_splash();
75362       init_status();
75363       init_tooltip();
75364       init_top_toolbar();
75365       init_version();
75366       init_zoom3();
75367       init_zoom_to_selection();
75368       init_cmd();
75369       init_background3();
75370       init_help();
75371       init_issues();
75372       init_map_data();
75373       init_preferences2();
75374     }
75375   });
75376
75377   // modules/ui/commit_warnings.js
75378   var commit_warnings_exports = {};
75379   __export(commit_warnings_exports, {
75380     uiCommitWarnings: () => uiCommitWarnings
75381   });
75382   function uiCommitWarnings(context) {
75383     function commitWarnings(selection2) {
75384       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
75385       for (var severity in issuesBySeverity) {
75386         var issues = issuesBySeverity[severity];
75387         if (severity !== "error") {
75388           issues = issues.filter(function(issue) {
75389             return issue.type !== "help_request";
75390           });
75391         }
75392         var section = severity + "-section";
75393         var issueItem = severity + "-item";
75394         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
75395         container.exit().remove();
75396         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
75397         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
75398         containerEnter.append("ul").attr("class", "changeset-list");
75399         container = containerEnter.merge(container);
75400         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
75401           return d2.key;
75402         });
75403         items.exit().remove();
75404         var itemsEnter = items.enter().append("li").attr("class", issueItem);
75405         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
75406           if (d2.entityIds) {
75407             context.surface().selectAll(
75408               utilEntityOrMemberSelector(
75409                 d2.entityIds,
75410                 context.graph()
75411               )
75412             ).classed("hover", true);
75413           }
75414         }).on("mouseout", function() {
75415           context.surface().selectAll(".hover").classed("hover", false);
75416         }).on("click", function(d3_event, d2) {
75417           context.validator().focusIssue(d2);
75418         });
75419         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
75420         buttons.append("strong").attr("class", "issue-message");
75421         buttons.filter(function(d2) {
75422           return d2.tooltip;
75423         }).call(
75424           uiTooltip().title(function(d2) {
75425             return d2.tooltip;
75426           }).placement("top")
75427         );
75428         items = itemsEnter.merge(items);
75429         items.selectAll(".issue-message").text("").each(function(d2) {
75430           return d2.message(context)(select_default2(this));
75431         });
75432       }
75433     }
75434     return commitWarnings;
75435   }
75436   var init_commit_warnings = __esm({
75437     "modules/ui/commit_warnings.js"() {
75438       "use strict";
75439       init_src5();
75440       init_localizer();
75441       init_icon();
75442       init_tooltip();
75443       init_util();
75444     }
75445   });
75446
75447   // modules/ui/lasso.js
75448   var lasso_exports = {};
75449   __export(lasso_exports, {
75450     uiLasso: () => uiLasso
75451   });
75452   function uiLasso(context) {
75453     var group, polygon2;
75454     lasso.coordinates = [];
75455     function lasso(selection2) {
75456       context.container().classed("lasso", true);
75457       group = selection2.append("g").attr("class", "lasso hide");
75458       polygon2 = group.append("path").attr("class", "lasso-path");
75459       group.call(uiToggle(true));
75460     }
75461     function draw() {
75462       if (polygon2) {
75463         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
75464           return "M" + d2.join(" L") + " Z";
75465         });
75466       }
75467     }
75468     lasso.extent = function() {
75469       return lasso.coordinates.reduce(function(extent, point) {
75470         return extent.extend(geoExtent(point));
75471       }, geoExtent());
75472     };
75473     lasso.p = function(_2) {
75474       if (!arguments.length) return lasso;
75475       lasso.coordinates.push(_2);
75476       draw();
75477       return lasso;
75478     };
75479     lasso.close = function() {
75480       if (group) {
75481         group.call(uiToggle(false, function() {
75482           select_default2(this).remove();
75483         }));
75484       }
75485       context.container().classed("lasso", false);
75486     };
75487     return lasso;
75488   }
75489   var init_lasso = __esm({
75490     "modules/ui/lasso.js"() {
75491       "use strict";
75492       init_src5();
75493       init_geo2();
75494       init_toggle();
75495     }
75496   });
75497
75498   // node_modules/osm-community-index/lib/simplify.js
75499   function simplify(str) {
75500     if (typeof str !== "string") return "";
75501     return import_diacritics.default.remove(
75502       str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
75503     );
75504   }
75505   var import_diacritics;
75506   var init_simplify = __esm({
75507     "node_modules/osm-community-index/lib/simplify.js"() {
75508       import_diacritics = __toESM(require_diacritics(), 1);
75509     }
75510   });
75511
75512   // node_modules/osm-community-index/lib/resolve_strings.js
75513   function resolveStrings(item, defaults, localizerFn) {
75514     let itemStrings = Object.assign({}, item.strings);
75515     let defaultStrings = Object.assign({}, defaults[item.type]);
75516     const anyToken = new RegExp(/(\{\w+\})/, "gi");
75517     if (localizerFn) {
75518       if (itemStrings.community) {
75519         const communityID = simplify(itemStrings.community);
75520         itemStrings.community = localizerFn(`_communities.${communityID}`);
75521       }
75522       ["name", "description", "extendedDescription"].forEach((prop) => {
75523         if (defaultStrings[prop]) defaultStrings[prop] = localizerFn(`_defaults.${item.type}.${prop}`);
75524         if (itemStrings[prop]) itemStrings[prop] = localizerFn(`${item.id}.${prop}`);
75525       });
75526     }
75527     let replacements = {
75528       account: item.account,
75529       community: itemStrings.community,
75530       signupUrl: itemStrings.signupUrl,
75531       url: itemStrings.url
75532     };
75533     if (!replacements.signupUrl) {
75534       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
75535     }
75536     if (!replacements.url) {
75537       replacements.url = resolve(itemStrings.url || defaultStrings.url);
75538     }
75539     let resolved = {
75540       name: resolve(itemStrings.name || defaultStrings.name),
75541       url: resolve(itemStrings.url || defaultStrings.url),
75542       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
75543       description: resolve(itemStrings.description || defaultStrings.description),
75544       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
75545     };
75546     resolved.nameHTML = linkify(resolved.url, resolved.name);
75547     resolved.urlHTML = linkify(resolved.url);
75548     resolved.signupUrlHTML = linkify(resolved.signupUrl);
75549     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
75550     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
75551     return resolved;
75552     function resolve(s2, addLinks) {
75553       if (!s2) return void 0;
75554       let result = s2;
75555       for (let key in replacements) {
75556         const token = `{${key}}`;
75557         const regex = new RegExp(token, "g");
75558         if (regex.test(result)) {
75559           let replacement = replacements[key];
75560           if (!replacement) {
75561             throw new Error(`Cannot resolve token: ${token}`);
75562           } else {
75563             if (addLinks && (key === "signupUrl" || key === "url")) {
75564               replacement = linkify(replacement);
75565             }
75566             result = result.replace(regex, replacement);
75567           }
75568         }
75569       }
75570       const leftovers = result.match(anyToken);
75571       if (leftovers) {
75572         throw new Error(`Cannot resolve tokens: ${leftovers}`);
75573       }
75574       if (addLinks && item.type === "reddit") {
75575         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
75576       }
75577       return result;
75578     }
75579     function linkify(url, text) {
75580       if (!url) return void 0;
75581       text = text || url;
75582       return `<a target="_blank" href="${url}">${text}</a>`;
75583     }
75584   }
75585   var init_resolve_strings = __esm({
75586     "node_modules/osm-community-index/lib/resolve_strings.js"() {
75587       init_simplify();
75588     }
75589   });
75590
75591   // node_modules/osm-community-index/index.mjs
75592   var init_osm_community_index = __esm({
75593     "node_modules/osm-community-index/index.mjs"() {
75594       init_resolve_strings();
75595       init_simplify();
75596     }
75597   });
75598
75599   // modules/ui/success.js
75600   var success_exports = {};
75601   __export(success_exports, {
75602     uiSuccess: () => uiSuccess
75603   });
75604   function uiSuccess(context) {
75605     const MAXEVENTS = 2;
75606     const dispatch14 = dispatch_default("cancel");
75607     let _changeset2;
75608     let _location;
75609     ensureOSMCommunityIndex();
75610     function ensureOSMCommunityIndex() {
75611       const data = _mainFileFetcher;
75612       return Promise.all([
75613         data.get("oci_features"),
75614         data.get("oci_resources"),
75615         data.get("oci_defaults")
75616       ]).then((vals) => {
75617         if (_oci) return _oci;
75618         if (vals[0] && Array.isArray(vals[0].features)) {
75619           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
75620         }
75621         let ociResources = Object.values(vals[1].resources);
75622         if (ociResources.length) {
75623           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
75624             _oci = {
75625               resources: ociResources,
75626               defaults: vals[2].defaults
75627             };
75628             return _oci;
75629           });
75630         } else {
75631           _oci = {
75632             resources: [],
75633             // no resources?
75634             defaults: vals[2].defaults
75635           };
75636           return _oci;
75637         }
75638       });
75639     }
75640     function parseEventDate(when) {
75641       if (!when) return;
75642       let raw = when.trim();
75643       if (!raw) return;
75644       if (!/Z$/.test(raw)) {
75645         raw += "Z";
75646       }
75647       const parsed = new Date(raw);
75648       return new Date(parsed.toUTCString().slice(0, 25));
75649     }
75650     function success(selection2) {
75651       let header = selection2.append("div").attr("class", "header fillL");
75652       header.append("h2").call(_t.append("success.just_edited"));
75653       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
75654       let body = selection2.append("div").attr("class", "body save-success fillL");
75655       let summary = body.append("div").attr("class", "save-summary");
75656       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
75657       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"));
75658       let osm = context.connection();
75659       if (!osm) return;
75660       let changesetURL = osm.changesetURL(_changeset2.id);
75661       let table = summary.append("table").attr("class", "summary-table");
75662       let row = table.append("tr").attr("class", "summary-row");
75663       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");
75664       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
75665       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
75666       summaryDetail.append("div").html(_t.html("success.changeset_id", {
75667         changeset_id: { html: `<a href="${changesetURL}" target="_blank">${_changeset2.id}</a>` }
75668       }));
75669       if (showDonationMessage !== false) {
75670         const donationUrl = "https://supporting.openstreetmap.org/";
75671         let supporting = body.append("div").attr("class", "save-supporting");
75672         supporting.append("h3").call(_t.append("success.supporting.title"));
75673         supporting.append("p").call(_t.append("success.supporting.details"));
75674         table = supporting.append("table").attr("class", "supporting-table");
75675         row = table.append("tr").attr("class", "supporting-row");
75676         row.append("td").attr("class", "cell-icon supporting-icon").append("a").attr("target", "_blank").attr("href", donationUrl).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-donation");
75677         let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
75678         supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
75679         supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
75680       }
75681       ensureOSMCommunityIndex().then((oci) => {
75682         const loc = context.map().center();
75683         const validHere = _sharedLocationManager.locationSetsAt(loc);
75684         let communities = [];
75685         oci.resources.forEach((resource) => {
75686           let area = validHere[resource.locationSetID];
75687           if (!area) return;
75688           const localizer = (stringID) => _t.html(`community.${stringID}`);
75689           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
75690           communities.push({
75691             area,
75692             order: resource.order || 0,
75693             resource
75694           });
75695         });
75696         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
75697         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
75698       });
75699     }
75700     function showCommunityLinks(selection2, resources) {
75701       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
75702       communityLinks.append("h3").call(_t.append("success.like_osm"));
75703       let table = communityLinks.append("table").attr("class", "community-table");
75704       let row = table.selectAll(".community-row").data(resources);
75705       let rowEnter = row.enter().append("tr").attr("class", "community-row");
75706       rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d2) => d2.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d2) => `#community-${d2.type}`);
75707       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
75708       communityDetail.each(showCommunityDetails);
75709       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"));
75710     }
75711     function showCommunityDetails(d2) {
75712       let selection2 = select_default2(this);
75713       let communityID = d2.id;
75714       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
75715       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
75716       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
75717         selection2.append("div").call(
75718           uiDisclosure(context, `community-more-${d2.id}`, false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
75719         );
75720       }
75721       let nextEvents = (d2.events || []).map((event) => {
75722         event.date = parseEventDate(event.when);
75723         return event;
75724       }).filter((event) => {
75725         const t2 = event.date.getTime();
75726         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
75727         return !isNaN(t2) && t2 >= now3;
75728       }).sort((a2, b2) => {
75729         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
75730       }).slice(0, MAXEVENTS);
75731       if (nextEvents.length) {
75732         selection2.append("div").call(
75733           uiDisclosure(context, `community-events-${d2.id}`, false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
75734         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
75735       }
75736       function showMore(selection3) {
75737         let more = selection3.selectAll(".community-more").data([0]);
75738         let moreEnter = more.enter().append("div").attr("class", "community-more");
75739         if (d2.resolved.extendedDescriptionHTML) {
75740           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
75741         }
75742         if (d2.languageCodes && d2.languageCodes.length) {
75743           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
75744           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
75745         }
75746       }
75747       function showNextEvents(selection3) {
75748         let events = selection3.append("div").attr("class", "community-events");
75749         let item = events.selectAll(".community-event").data(nextEvents);
75750         let itemEnter = item.enter().append("div").attr("class", "community-event");
75751         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
75752           let name = d4.name;
75753           if (d4.i18n && d4.id) {
75754             name = _t(`community.${communityID}.events.${d4.id}.name`, { default: name });
75755           }
75756           return name;
75757         });
75758         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
75759           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
75760           if (d4.date.getHours() || d4.date.getMinutes()) {
75761             options2.hour = "numeric";
75762             options2.minute = "numeric";
75763           }
75764           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
75765         });
75766         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
75767           let where = d4.where;
75768           if (d4.i18n && d4.id) {
75769             where = _t(`community.${communityID}.events.${d4.id}.where`, { default: where });
75770           }
75771           return where;
75772         });
75773         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
75774           let description = d4.description;
75775           if (d4.i18n && d4.id) {
75776             description = _t(`community.${communityID}.events.${d4.id}.description`, { default: description });
75777           }
75778           return description;
75779         });
75780       }
75781     }
75782     success.changeset = function(val) {
75783       if (!arguments.length) return _changeset2;
75784       _changeset2 = val;
75785       return success;
75786     };
75787     success.location = function(val) {
75788       if (!arguments.length) return _location;
75789       _location = val;
75790       return success;
75791     };
75792     return utilRebind(success, dispatch14, "on");
75793   }
75794   var _oci;
75795   var init_success = __esm({
75796     "modules/ui/success.js"() {
75797       "use strict";
75798       init_src4();
75799       init_src5();
75800       init_osm_community_index();
75801       init_id();
75802       init_file_fetcher();
75803       init_LocationManager();
75804       init_localizer();
75805       init_icon();
75806       init_disclosure();
75807       init_rebind();
75808       _oci = null;
75809     }
75810   });
75811
75812   // modules/ui/index.js
75813   var ui_exports = {};
75814   __export(ui_exports, {
75815     uiAccount: () => uiAccount,
75816     uiAttribution: () => uiAttribution,
75817     uiChangesetEditor: () => uiChangesetEditor,
75818     uiCmd: () => uiCmd,
75819     uiCombobox: () => uiCombobox,
75820     uiCommit: () => uiCommit,
75821     uiCommitWarnings: () => uiCommitWarnings,
75822     uiConfirm: () => uiConfirm,
75823     uiConflicts: () => uiConflicts,
75824     uiContributors: () => uiContributors,
75825     uiCurtain: () => uiCurtain,
75826     uiDataEditor: () => uiDataEditor,
75827     uiDataHeader: () => uiDataHeader,
75828     uiDisclosure: () => uiDisclosure,
75829     uiEditMenu: () => uiEditMenu,
75830     uiEntityEditor: () => uiEntityEditor,
75831     uiFeatureInfo: () => uiFeatureInfo,
75832     uiFeatureList: () => uiFeatureList,
75833     uiField: () => uiField,
75834     uiFieldHelp: () => uiFieldHelp,
75835     uiFlash: () => uiFlash,
75836     uiFormFields: () => uiFormFields,
75837     uiFullScreen: () => uiFullScreen,
75838     uiGeolocate: () => uiGeolocate,
75839     uiInfo: () => uiInfo,
75840     uiInit: () => uiInit,
75841     uiInspector: () => uiInspector,
75842     uiIssuesInfo: () => uiIssuesInfo,
75843     uiKeepRightDetails: () => uiKeepRightDetails,
75844     uiKeepRightEditor: () => uiKeepRightEditor,
75845     uiKeepRightHeader: () => uiKeepRightHeader,
75846     uiLasso: () => uiLasso,
75847     uiLengthIndicator: () => uiLengthIndicator,
75848     uiLoading: () => uiLoading,
75849     uiMapInMap: () => uiMapInMap,
75850     uiModal: () => uiModal,
75851     uiNoteComments: () => uiNoteComments,
75852     uiNoteEditor: () => uiNoteEditor,
75853     uiNoteHeader: () => uiNoteHeader,
75854     uiNoteReport: () => uiNoteReport,
75855     uiNotice: () => uiNotice,
75856     uiPopover: () => uiPopover,
75857     uiPresetIcon: () => uiPresetIcon,
75858     uiPresetList: () => uiPresetList,
75859     uiRestore: () => uiRestore,
75860     uiScale: () => uiScale,
75861     uiSidebar: () => uiSidebar,
75862     uiSourceSwitch: () => uiSourceSwitch,
75863     uiSpinner: () => uiSpinner,
75864     uiSplash: () => uiSplash,
75865     uiStatus: () => uiStatus,
75866     uiSuccess: () => uiSuccess,
75867     uiTagReference: () => uiTagReference,
75868     uiToggle: () => uiToggle,
75869     uiTooltip: () => uiTooltip,
75870     uiVersion: () => uiVersion,
75871     uiViewOnKeepRight: () => uiViewOnKeepRight,
75872     uiViewOnOSM: () => uiViewOnOSM,
75873     uiZoom: () => uiZoom
75874   });
75875   var init_ui = __esm({
75876     "modules/ui/index.js"() {
75877       "use strict";
75878       init_init2();
75879       init_account();
75880       init_attribution();
75881       init_changeset_editor();
75882       init_cmd();
75883       init_combobox();
75884       init_commit();
75885       init_commit_warnings();
75886       init_confirm();
75887       init_conflicts();
75888       init_contributors();
75889       init_curtain();
75890       init_data_editor();
75891       init_data_header();
75892       init_disclosure();
75893       init_edit_menu();
75894       init_entity_editor();
75895       init_feature_info();
75896       init_feature_list();
75897       init_field2();
75898       init_field_help();
75899       init_flash();
75900       init_form_fields();
75901       init_full_screen();
75902       init_geolocate2();
75903       init_info();
75904       init_inspector();
75905       init_issues_info();
75906       init_keepRight_details();
75907       init_keepRight_editor();
75908       init_keepRight_header();
75909       init_length_indicator();
75910       init_lasso();
75911       init_loading();
75912       init_map_in_map();
75913       init_modal();
75914       init_notice();
75915       init_note_comments();
75916       init_note_editor();
75917       init_note_header();
75918       init_note_report();
75919       init_popover();
75920       init_preset_icon();
75921       init_preset_list();
75922       init_restore();
75923       init_scale2();
75924       init_sidebar();
75925       init_source_switch();
75926       init_spinner();
75927       init_splash();
75928       init_status();
75929       init_success();
75930       init_tag_reference();
75931       init_toggle();
75932       init_tooltip();
75933       init_version();
75934       init_view_on_osm();
75935       init_view_on_keepRight();
75936       init_zoom3();
75937     }
75938   });
75939
75940   // modules/ui/fields/input.js
75941   var input_exports = {};
75942   __export(input_exports, {
75943     likelyRawNumberFormat: () => likelyRawNumberFormat,
75944     uiFieldColour: () => uiFieldText,
75945     uiFieldEmail: () => uiFieldText,
75946     uiFieldIdentifier: () => uiFieldText,
75947     uiFieldNumber: () => uiFieldText,
75948     uiFieldTel: () => uiFieldText,
75949     uiFieldText: () => uiFieldText,
75950     uiFieldUrl: () => uiFieldText
75951   });
75952   function uiFieldText(field, context) {
75953     var dispatch14 = dispatch_default("change");
75954     var input = select_default2(null);
75955     var outlinkButton = select_default2(null);
75956     var wrap2 = select_default2(null);
75957     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
75958     var _entityIDs = [];
75959     var _tags;
75960     var _phoneFormats = {};
75961     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
75962     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
75963     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
75964     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
75965     if (field.type === "tel") {
75966       _mainFileFetcher.get("phone_formats").then(function(d2) {
75967         _phoneFormats = d2;
75968         updatePhonePlaceholder();
75969       }).catch(function() {
75970       });
75971     }
75972     function calcLocked() {
75973       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
75974         var entity = context.graph().hasEntity(entityID);
75975         if (!entity) return false;
75976         if (entity.tags.wikidata) return true;
75977         var preset = _mainPresetIndex.match(entity, context.graph());
75978         var isSuggestion = preset && preset.suggestion;
75979         var which = field.id;
75980         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
75981       });
75982       field.locked(isLocked);
75983     }
75984     function i3(selection2) {
75985       calcLocked();
75986       var isLocked = field.locked();
75987       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
75988       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
75989       input = wrap2.selectAll("input").data([0]);
75990       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);
75991       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
75992       wrap2.call(_lengthIndicator);
75993       if (field.type === "tel") {
75994         updatePhonePlaceholder();
75995       } else if (field.type === "number") {
75996         var rtl = _mainLocalizer.textDirection() === "rtl";
75997         input.attr("type", "text");
75998         var inc = field.increment;
75999         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
76000         buttons.enter().append("button").attr("class", function(d2) {
76001           var which = d2 > 0 ? "increment" : "decrement";
76002           return "form-field-button " + which;
76003         }).attr("title", function(d2) {
76004           var which = d2 > 0 ? "increment" : "decrement";
76005           return _t(`inspector.${which}`);
76006         }).merge(buttons).on("click", function(d3_event, d2) {
76007           d3_event.preventDefault();
76008           var isMixed = Array.isArray(_tags[field.key]);
76009           if (isMixed) return;
76010           var raw_vals = input.node().value || "0";
76011           var vals = raw_vals.split(";");
76012           vals = vals.map(function(v2) {
76013             v2 = v2.trim();
76014             const isRawNumber = likelyRawNumberFormat.test(v2);
76015             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
76016             if (isDirectionField) {
76017               const compassDir = cardinal[v2.toLowerCase()];
76018               if (compassDir !== void 0) {
76019                 num = compassDir;
76020               }
76021             }
76022             if (!isFinite(num)) return v2;
76023             num = parseFloat(num);
76024             if (!isFinite(num)) return v2;
76025             num += d2;
76026             if (isDirectionField) {
76027               num = (num % 360 + 360) % 360;
76028             }
76029             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
76030           });
76031           input.node().value = vals.join(";");
76032           change()();
76033         });
76034       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
76035         input.attr("type", "text");
76036         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
76037         outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
76038           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
76039           if (domainResults.length >= 2 && domainResults[1]) {
76040             var domain = domainResults[1];
76041             return _t("icons.view_on", { domain });
76042           }
76043           return "";
76044         }).merge(outlinkButton);
76045         outlinkButton.on("click", function(d3_event) {
76046           d3_event.preventDefault();
76047           var value = validIdentifierValueForLink();
76048           if (value) {
76049             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
76050             window.open(url, "_blank");
76051           }
76052         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
76053       } else if (field.type === "url") {
76054         input.attr("type", "text");
76055         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
76056         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) {
76057           d3_event.preventDefault();
76058           const value = validIdentifierValueForLink();
76059           if (value) window.open(value, "_blank");
76060         }).merge(outlinkButton);
76061       } else if (field.type === "colour") {
76062         input.attr("type", "text");
76063         updateColourPreview();
76064       } else if (field.type === "date") {
76065         input.attr("type", "text");
76066         updateDateField();
76067       }
76068     }
76069     function updateColourPreview() {
76070       wrap2.selectAll(".colour-preview").remove();
76071       const colour = utilGetSetValue(input);
76072       if (!isColourValid(colour) && colour !== "") {
76073         wrap2.selectAll("input.colour-selector").remove();
76074         wrap2.selectAll(".form-field-button").remove();
76075         return;
76076       }
76077       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
76078       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
76079         d3_event.preventDefault();
76080         var colour2 = this.value;
76081         if (!isColourValid(colour2)) return;
76082         utilGetSetValue(input, this.value);
76083         change()();
76084         updateColourPreview();
76085       }, 100));
76086       wrap2.selectAll("input.colour-selector").attr("value", colour);
76087       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
76088       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
76089       if (colour === "") {
76090         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
76091       }
76092       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
76093     }
76094     function updateDateField() {
76095       function isDateValid(date2) {
76096         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
76097       }
76098       const date = utilGetSetValue(input);
76099       const now3 = /* @__PURE__ */ new Date();
76100       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
76101       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
76102         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", () => {
76103           utilGetSetValue(input, today);
76104           change()();
76105           updateDateField();
76106         });
76107       } else {
76108         wrap2.selectAll(".date-set-today").remove();
76109       }
76110       if (!isDateValid(date) && date !== "") {
76111         wrap2.selectAll("input.date-selector").remove();
76112         wrap2.selectAll(".date-calendar").remove();
76113         return;
76114       }
76115       if (utilDetect().browser !== "Safari") {
76116         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
76117         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
76118           d3_event.preventDefault();
76119           var date2 = this.value;
76120           if (!isDateValid(date2)) return;
76121           utilGetSetValue(input, this.value);
76122           change()();
76123           updateDateField();
76124         }, 100));
76125         wrap2.selectAll("input.date-selector").attr("value", date);
76126         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
76127         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
76128         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
76129       }
76130     }
76131     function updatePhonePlaceholder() {
76132       if (input.empty() || !Object.keys(_phoneFormats).length) return;
76133       var extent = combinedEntityExtent();
76134       var countryCode = extent && iso1A2Code(extent.center());
76135       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
76136       if (format2) input.attr("placeholder", format2);
76137     }
76138     function validIdentifierValueForLink() {
76139       var _a3;
76140       const value = utilGetSetValue(input).trim();
76141       if (field.type === "url" && value) {
76142         try {
76143           return new URL(value).href;
76144         } catch {
76145           return null;
76146         }
76147       }
76148       if (field.type === "identifier" && field.pattern) {
76149         return value && ((_a3 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a3[0]);
76150       }
76151       return null;
76152     }
76153     function clamped(num) {
76154       if (field.minValue !== void 0) {
76155         num = Math.max(num, field.minValue);
76156       }
76157       if (field.maxValue !== void 0) {
76158         num = Math.min(num, field.maxValue);
76159       }
76160       return num;
76161     }
76162     function getVals(tags) {
76163       if (field.keys) {
76164         const multiSelection = context.selectedIDs();
76165         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
76166         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]));
76167       } else {
76168         return new Set([].concat(tags[field.key]));
76169       }
76170     }
76171     function change(onInput) {
76172       return function() {
76173         var t2 = {};
76174         var val = utilGetSetValue(input);
76175         if (!onInput) val = context.cleanTagValue(val);
76176         if (!val && getVals(_tags).size > 1) return;
76177         var displayVal = val;
76178         if (field.type === "number" && val) {
76179           var numbers2 = val.split(";");
76180           numbers2 = numbers2.map(function(v2) {
76181             if (likelyRawNumberFormat.test(v2)) {
76182               return v2;
76183             }
76184             var num = parseLocaleFloat(v2);
76185             const fractionDigits = countDecimalPlaces(v2);
76186             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
76187           });
76188           val = numbers2.join(";");
76189         }
76190         if (!onInput) utilGetSetValue(input, displayVal);
76191         t2[field.key] = val || void 0;
76192         if (field.keys) {
76193           dispatch14.call("change", this, (tags) => {
76194             if (field.keys.some((key) => tags[key])) {
76195               field.keys.filter((key) => tags[key]).forEach((key) => {
76196                 tags[key] = val || void 0;
76197               });
76198             } else {
76199               tags[field.key] = val || void 0;
76200             }
76201             return tags;
76202           }, onInput);
76203         } else {
76204           dispatch14.call("change", this, t2, onInput);
76205         }
76206       };
76207     }
76208     i3.entityIDs = function(val) {
76209       if (!arguments.length) return _entityIDs;
76210       _entityIDs = val;
76211       return i3;
76212     };
76213     i3.tags = function(tags) {
76214       var _a3;
76215       _tags = tags;
76216       const vals = getVals(tags);
76217       const isMixed = vals.size > 1;
76218       var val = vals.size === 1 ? (_a3 = [...vals][0]) != null ? _a3 : "" : "";
76219       var shouldUpdate;
76220       if (field.type === "number" && val) {
76221         var numbers2 = val.split(";");
76222         var oriNumbers = utilGetSetValue(input).split(";");
76223         if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
76224         numbers2 = numbers2.map(function(v2) {
76225           v2 = v2.trim();
76226           var num = Number(v2);
76227           if (!isFinite(num) || v2 === "") return v2;
76228           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
76229           return formatFloat(num, fractionDigits);
76230         });
76231         val = numbers2.join(";");
76232         shouldUpdate = (inputValue, setValue) => {
76233           const inputNums = inputValue.split(";").map(
76234             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
76235           );
76236           const setNums = setValue.split(";").map(parseLocaleFloat);
76237           return !isEqual_default(inputNums, setNums);
76238         };
76239       }
76240       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);
76241       if (field.type === "number") {
76242         const buttons = wrap2.selectAll(".increment, .decrement");
76243         if (isMixed) {
76244           buttons.attr("disabled", "disabled").classed("disabled", true);
76245         } else {
76246           var raw_vals = tags[field.key] || "0";
76247           const canIncDec = raw_vals.split(";").some(
76248             (val2) => isFinite(Number(val2)) || isDirectionField && val2.trim().toLowerCase() in cardinal
76249           );
76250           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
76251         }
76252       }
76253       if (field.type === "tel") updatePhonePlaceholder();
76254       if (field.type === "colour") updateColourPreview();
76255       if (field.type === "date") updateDateField();
76256       if (outlinkButton && !outlinkButton.empty()) {
76257         var disabled = !validIdentifierValueForLink();
76258         outlinkButton.classed("disabled", disabled);
76259       }
76260       if (!isMixed) {
76261         _lengthIndicator.update(tags[field.key]);
76262       }
76263     };
76264     i3.focus = function() {
76265       var node = input.node();
76266       if (node) node.focus();
76267     };
76268     function combinedEntityExtent() {
76269       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
76270     }
76271     return utilRebind(i3, dispatch14, "on");
76272   }
76273   var likelyRawNumberFormat;
76274   var init_input = __esm({
76275     "modules/ui/fields/input.js"() {
76276       "use strict";
76277       init_src4();
76278       init_src5();
76279       init_debounce();
76280       init_country_coder();
76281       init_presets();
76282       init_file_fetcher();
76283       init_localizer();
76284       init_util();
76285       init_icon();
76286       init_node2();
76287       init_tags();
76288       init_ui();
76289       init_tooltip();
76290       init_lodash();
76291       likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
76292     }
76293   });
76294
76295   // modules/ui/fields/access.js
76296   var access_exports = {};
76297   __export(access_exports, {
76298     uiFieldAccess: () => uiFieldAccess
76299   });
76300   function uiFieldAccess(field, context) {
76301     var dispatch14 = dispatch_default("change");
76302     var items = select_default2(null);
76303     var _tags;
76304     function access(selection2) {
76305       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
76306       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
76307       var list2 = wrap2.selectAll("ul").data([0]);
76308       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
76309       items = list2.selectAll("li").data(field.keys);
76310       var enter = items.enter().append("li").attr("class", function(d2) {
76311         return "labeled-input preset-access-" + d2;
76312       });
76313       enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
76314         return "preset-input-access-" + d2;
76315       }).html(function(d2) {
76316         return field.t.html("types." + d2);
76317       });
76318       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
76319         return "preset-input-access preset-input-access-" + d2;
76320       }).call(utilNoAuto).each(function(d2) {
76321         select_default2(this).call(
76322           uiCombobox(context, "access-" + d2).data(access.options(d2))
76323         );
76324       });
76325       items = items.merge(enter);
76326       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
76327     }
76328     function change(d3_event, d2) {
76329       var tag2 = {};
76330       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
76331       if (!value && typeof _tags[d2] !== "string") return;
76332       tag2[d2] = value || void 0;
76333       dispatch14.call("change", this, tag2);
76334     }
76335     access.options = function(type2) {
76336       var options2 = [
76337         "yes",
76338         "no",
76339         "designated",
76340         "permissive",
76341         "destination",
76342         "customers",
76343         "private",
76344         "permit",
76345         "unknown"
76346       ];
76347       if (type2 === "access") {
76348         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
76349       }
76350       if (type2 === "bicycle") {
76351         options2.splice(options2.length - 4, 0, "dismount");
76352       }
76353       var stringsField = field.resolveReference("stringsCrossReference");
76354       return options2.map(function(option) {
76355         return {
76356           title: stringsField.t("options." + option + ".description"),
76357           value: option
76358         };
76359       });
76360     };
76361     const placeholdersByTag = {
76362       highway: {
76363         footway: {
76364           foot: "designated",
76365           motor_vehicle: "no"
76366         },
76367         steps: {
76368           foot: "yes",
76369           motor_vehicle: "no",
76370           bicycle: "no",
76371           horse: "no"
76372         },
76373         ladder: {
76374           foot: "yes",
76375           motor_vehicle: "no",
76376           bicycle: "no",
76377           horse: "no"
76378         },
76379         pedestrian: {
76380           foot: "yes",
76381           motor_vehicle: "no"
76382         },
76383         cycleway: {
76384           motor_vehicle: "no",
76385           bicycle: "designated"
76386         },
76387         bridleway: {
76388           motor_vehicle: "no",
76389           horse: "designated"
76390         },
76391         path: {
76392           foot: "yes",
76393           motor_vehicle: "no",
76394           bicycle: "yes",
76395           horse: "yes"
76396         },
76397         motorway: {
76398           foot: "no",
76399           motor_vehicle: "yes",
76400           bicycle: "no",
76401           horse: "no"
76402         },
76403         trunk: {
76404           motor_vehicle: "yes"
76405         },
76406         primary: {
76407           foot: "yes",
76408           motor_vehicle: "yes",
76409           bicycle: "yes",
76410           horse: "yes"
76411         },
76412         secondary: {
76413           foot: "yes",
76414           motor_vehicle: "yes",
76415           bicycle: "yes",
76416           horse: "yes"
76417         },
76418         tertiary: {
76419           foot: "yes",
76420           motor_vehicle: "yes",
76421           bicycle: "yes",
76422           horse: "yes"
76423         },
76424         residential: {
76425           foot: "yes",
76426           motor_vehicle: "yes",
76427           bicycle: "yes",
76428           horse: "yes"
76429         },
76430         unclassified: {
76431           foot: "yes",
76432           motor_vehicle: "yes",
76433           bicycle: "yes",
76434           horse: "yes"
76435         },
76436         service: {
76437           foot: "yes",
76438           motor_vehicle: "yes",
76439           bicycle: "yes",
76440           horse: "yes"
76441         },
76442         motorway_link: {
76443           foot: "no",
76444           motor_vehicle: "yes",
76445           bicycle: "no",
76446           horse: "no"
76447         },
76448         trunk_link: {
76449           motor_vehicle: "yes"
76450         },
76451         primary_link: {
76452           foot: "yes",
76453           motor_vehicle: "yes",
76454           bicycle: "yes",
76455           horse: "yes"
76456         },
76457         secondary_link: {
76458           foot: "yes",
76459           motor_vehicle: "yes",
76460           bicycle: "yes",
76461           horse: "yes"
76462         },
76463         tertiary_link: {
76464           foot: "yes",
76465           motor_vehicle: "yes",
76466           bicycle: "yes",
76467           horse: "yes"
76468         },
76469         construction: {
76470           access: "no"
76471         },
76472         busway: {
76473           access: "no",
76474           bus: "designated",
76475           emergency: "yes"
76476         }
76477       },
76478       barrier: {
76479         bollard: {
76480           access: "no",
76481           bicycle: "yes",
76482           foot: "yes"
76483         },
76484         bus_trap: {
76485           motor_vehicle: "no",
76486           psv: "yes",
76487           foot: "yes",
76488           bicycle: "yes"
76489         },
76490         city_wall: {
76491           access: "no"
76492         },
76493         coupure: {
76494           access: "yes"
76495         },
76496         cycle_barrier: {
76497           motor_vehicle: "no"
76498         },
76499         ditch: {
76500           access: "no"
76501         },
76502         entrance: {
76503           access: "yes"
76504         },
76505         fence: {
76506           access: "no"
76507         },
76508         hedge: {
76509           access: "no"
76510         },
76511         jersey_barrier: {
76512           access: "no"
76513         },
76514         motorcycle_barrier: {
76515           motor_vehicle: "no"
76516         },
76517         rail_guard: {
76518           access: "no"
76519         }
76520       }
76521     };
76522     access.tags = function(tags) {
76523       _tags = tags;
76524       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
76525         return typeof tags[d2] === "string" ? tags[d2] : "";
76526       }).classed("mixed", function(accessField) {
76527         return tags[accessField] && Array.isArray(tags[accessField]) || new Set(getAllPlaceholders(tags, accessField)).size > 1;
76528       }).attr("title", function(accessField) {
76529         return tags[accessField] && Array.isArray(tags[accessField]) && tags[accessField].filter(Boolean).join("\n");
76530       }).attr("placeholder", function(accessField) {
76531         let placeholders = getAllPlaceholders(tags, accessField);
76532         if (new Set(placeholders).size === 1) {
76533           return placeholders[0];
76534         } else {
76535           return _t("inspector.multiple_values");
76536         }
76537       });
76538       function getAllPlaceholders(tags2, accessField) {
76539         let allTags = tags2[Symbol.for("allTags")];
76540         if (allTags && allTags.length > 1) {
76541           const placeholders = [];
76542           allTags.forEach((tags3) => {
76543             placeholders.push(getPlaceholder(tags3, accessField));
76544           });
76545           return placeholders;
76546         } else {
76547           return [getPlaceholder(tags2, accessField)];
76548         }
76549       }
76550       function getPlaceholder(tags2, accessField) {
76551         if (tags2[accessField]) {
76552           return tags2[accessField];
76553         }
76554         if (tags2.motorroad === "yes" && (accessField === "foot" || accessField === "bicycle" || accessField === "horse")) {
76555           return "no";
76556         }
76557         if (tags2.vehicle && (accessField === "bicycle" || accessField === "motor_vehicle")) {
76558           return tags2.vehicle;
76559         }
76560         if (tags2.access) {
76561           return tags2.access;
76562         }
76563         for (const key in placeholdersByTag) {
76564           if (tags2[key]) {
76565             if (placeholdersByTag[key][tags2[key]] && placeholdersByTag[key][tags2[key]][accessField]) {
76566               return placeholdersByTag[key][tags2[key]][accessField];
76567             }
76568           }
76569         }
76570         if (accessField === "access" && !tags2.barrier) {
76571           return "yes";
76572         }
76573         return field.placeholder();
76574       }
76575     };
76576     access.focus = function() {
76577       items.selectAll(".preset-input-access").node().focus();
76578     };
76579     return utilRebind(access, dispatch14, "on");
76580   }
76581   var init_access = __esm({
76582     "modules/ui/fields/access.js"() {
76583       "use strict";
76584       init_src4();
76585       init_src5();
76586       init_combobox();
76587       init_util();
76588       init_localizer();
76589     }
76590   });
76591
76592   // modules/ui/fields/address.js
76593   var address_exports = {};
76594   __export(address_exports, {
76595     uiFieldAddress: () => uiFieldAddress
76596   });
76597   function uiFieldAddress(field, context) {
76598     var dispatch14 = dispatch_default("change");
76599     var _selection = select_default2(null);
76600     var _wrap = select_default2(null);
76601     var addrField = _mainPresetIndex.field("address");
76602     var _entityIDs = [];
76603     var _tags;
76604     var _countryCode;
76605     var _addressFormats = [{
76606       format: [
76607         ["housenumber", "street"],
76608         ["city", "postcode"]
76609       ]
76610     }];
76611     _mainFileFetcher.get("address_formats").then(function(d2) {
76612       _addressFormats = d2;
76613       if (!_selection.empty()) {
76614         _selection.call(address);
76615       }
76616     }).catch(function() {
76617     });
76618     function getNear(isAddressable, type2, searchRadius, resultProp) {
76619       var extent = combinedEntityExtent();
76620       var l2 = extent.center();
76621       var box = extent.padByMeters(searchRadius);
76622       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
76623         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
76624         if (d2.geometry(context.graph()) === "line") {
76625           var loc = context.projection([
76626             (extent[0][0] + extent[1][0]) / 2,
76627             (extent[0][1] + extent[1][1]) / 2
76628           ]);
76629           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
76630           dist = geoSphericalDistance(choice.loc, l2);
76631         }
76632         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
76633         let title = value;
76634         if (type2 === "street") {
76635           title = `${addrField.t("placeholders.street")}: ${title}`;
76636         } else if (type2 === "place") {
76637           title = `${addrField.t("placeholders.place")}: ${title}`;
76638         }
76639         return {
76640           title,
76641           value,
76642           dist,
76643           type: type2,
76644           klass: `address-${type2}`
76645         };
76646       }).sort(function(a2, b2) {
76647         return a2.dist - b2.dist;
76648       });
76649       return utilArrayUniqBy(features, "value");
76650     }
76651     function getEnclosing(isAddressable, type2, resultProp) {
76652       var extent = combinedEntityExtent();
76653       var features = context.history().intersects(extent).filter(isAddressable).map((d2) => {
76654         if (d2.geometry(context.graph()) !== "area") {
76655           return false;
76656         }
76657         const geom = d2.asGeoJSON(context.graph()).coordinates[0];
76658         if (!geoPolygonContainsPolygon(geom, extent.polygon())) {
76659           return false;
76660         }
76661         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
76662         return {
76663           title: value,
76664           value,
76665           dist: 0,
76666           geom,
76667           type: type2,
76668           klass: `address-${type2}`
76669         };
76670       }).filter(Boolean);
76671       return utilArrayUniqBy(features, "value");
76672     }
76673     function getNearStreets() {
76674       function isAddressable(d2) {
76675         return d2.tags.highway && d2.tags.name && d2.type === "way";
76676       }
76677       return getNear(isAddressable, "street", 200);
76678     }
76679     function getNearPlaces() {
76680       function isAddressable(d2) {
76681         if (d2.tags.name) {
76682           if (d2.tags.place) return true;
76683           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
76684         }
76685         return false;
76686       }
76687       return getNear(isAddressable, "place", 200);
76688     }
76689     function getNearCities() {
76690       function isAddressable(d2) {
76691         if (d2.tags.name) {
76692           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
76693           if (d2.tags.border_type === "city") return true;
76694           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
76695         }
76696         if (d2.tags[`${field.key}:city`]) return true;
76697         return false;
76698       }
76699       return getNear(isAddressable, "city", 200, `${field.key}:city`);
76700     }
76701     function getNearPostcodes() {
76702       const postcodes = [].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code"));
76703       return utilArrayUniqBy(postcodes, (item) => item.value);
76704     }
76705     function getNearValues(key) {
76706       const tagKey = `${field.key}:${key}`;
76707       function hasTag(d2) {
76708         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
76709       }
76710       return getNear(hasTag, key, 200, tagKey);
76711     }
76712     function getEnclosingValues(key) {
76713       const tagKey = `${field.key}:${key}`;
76714       function hasTag(d2) {
76715         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
76716       }
76717       const enclosingAddresses = getEnclosing(hasTag, key, tagKey);
76718       function isBuilding(d2) {
76719         return _entityIDs.indexOf(d2.id) === -1 && d2.tags.building && d2.tags.building !== "no";
76720       }
76721       const enclosingBuildings = getEnclosing(isBuilding, "building", "building").map((d2) => d2.geom);
76722       function isInNearbyBuilding(d2) {
76723         return hasTag(d2) && d2.type === "node" && enclosingBuildings.some(
76724           (geom) => geoPointInPolygon(d2.loc, geom) || geom.indexOf(d2.loc) !== -1
76725         );
76726       }
76727       const nearPointAddresses = getNear(isInNearbyBuilding, key, 100, tagKey);
76728       return utilArrayUniqBy([
76729         ...enclosingAddresses,
76730         ...nearPointAddresses
76731       ], "value").sort((a2, b2) => a2.value > b2.value ? 1 : -1);
76732     }
76733     function updateForCountryCode() {
76734       if (!_countryCode) return;
76735       var addressFormat;
76736       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
76737         var format2 = _addressFormats[i3];
76738         if (!format2.countryCodes) {
76739           addressFormat = format2;
76740         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
76741           addressFormat = format2;
76742           break;
76743         }
76744       }
76745       const maybeDropdowns = /* @__PURE__ */ new Set([
76746         "housenumber",
76747         "housename"
76748       ]);
76749       const dropdowns = /* @__PURE__ */ new Set([
76750         "block_number",
76751         "city",
76752         "country",
76753         "county",
76754         "district",
76755         "floor",
76756         "hamlet",
76757         "neighbourhood",
76758         "place",
76759         "postcode",
76760         "province",
76761         "quarter",
76762         "state",
76763         "street",
76764         "street+place",
76765         "subdistrict",
76766         "suburb",
76767         "town",
76768         ...maybeDropdowns
76769       ]);
76770       var widths = addressFormat.widths || {
76771         housenumber: 1 / 5,
76772         unit: 1 / 5,
76773         street: 1 / 2,
76774         place: 1 / 2,
76775         city: 2 / 3,
76776         state: 1 / 4,
76777         postcode: 1 / 3
76778       };
76779       function row(r2) {
76780         var total = r2.reduce(function(sum, key) {
76781           return sum + (widths[key] || 0.5);
76782         }, 0);
76783         return r2.map(function(key) {
76784           return {
76785             id: key,
76786             width: (widths[key] || 0.5) / total
76787           };
76788         });
76789       }
76790       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
76791         return d2.toString();
76792       });
76793       rows.exit().remove();
76794       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").attr("id", (d2) => d2.id === "housenumber" ? field.domId : null).attr("class", function(d2) {
76795         return "addr-" + d2.id;
76796       }).call(utilNoAuto).each(addDropdown).call(updatePlaceholder).style("width", function(d2) {
76797         return d2.width * 100 + "%";
76798       });
76799       function addDropdown(d2) {
76800         if (!dropdowns.has(d2.id)) {
76801           return false;
76802         }
76803         var nearValues;
76804         switch (d2.id) {
76805           case "street":
76806             nearValues = getNearStreets;
76807             break;
76808           case "place":
76809             nearValues = getNearPlaces;
76810             break;
76811           case "street+place":
76812             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
76813             d2.isAutoStreetPlace = true;
76814             d2.id = _tags[`${field.key}:place`] ? "place" : "street";
76815             break;
76816           case "city":
76817             nearValues = getNearCities;
76818             break;
76819           case "postcode":
76820             nearValues = getNearPostcodes;
76821             break;
76822           case "housenumber":
76823           case "housename":
76824             nearValues = getEnclosingValues;
76825             break;
76826           default:
76827             nearValues = getNearValues;
76828         }
76829         if (maybeDropdowns.has(d2.id)) {
76830           const candidates = nearValues(d2.id);
76831           if (candidates.length === 0) return false;
76832         }
76833         select_default2(this).call(
76834           uiCombobox(context, `address-${d2.isAutoStreetPlace ? "street-place" : d2.id}`).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
76835             typedValue = typedValue.toLowerCase();
76836             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
76837           }).on("accept", function(selected) {
76838             if (d2.isAutoStreetPlace) {
76839               d2.id = selected ? selected.type : "street";
76840               utilTriggerEvent(select_default2(this), "change");
76841             }
76842           })
76843         );
76844       }
76845       _wrap.selectAll("input").on("blur", change()).on("change", change());
76846       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
76847       if (_tags) updateTags(_tags);
76848     }
76849     function address(selection2) {
76850       _selection = selection2;
76851       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
76852       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
76853       var extent = combinedEntityExtent();
76854       if (extent) {
76855         var countryCode;
76856         if (context.inIntro()) {
76857           countryCode = _t("intro.graph.countrycode");
76858         } else {
76859           var center = extent.center();
76860           countryCode = iso1A2Code(center);
76861         }
76862         if (countryCode) {
76863           _countryCode = countryCode.toLowerCase();
76864           updateForCountryCode();
76865         }
76866       }
76867     }
76868     function change(onInput) {
76869       return function() {
76870         var tags = {};
76871         _wrap.selectAll("input").each(function(subfield) {
76872           var key = field.key + ":" + subfield.id;
76873           var value = this.value;
76874           if (!onInput) value = context.cleanTagValue(value);
76875           if (Array.isArray(_tags[key]) && !value) return;
76876           if (subfield.isAutoStreetPlace) {
76877             if (subfield.id === "street") {
76878               tags[`${field.key}:place`] = void 0;
76879             } else if (subfield.id === "place") {
76880               tags[`${field.key}:street`] = void 0;
76881             }
76882           }
76883           tags[key] = value || void 0;
76884         });
76885         Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
76886         dispatch14.call("change", this, tags, onInput);
76887       };
76888     }
76889     function updatePlaceholder(inputSelection) {
76890       return inputSelection.attr("placeholder", function(subfield) {
76891         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
76892           return _t("inspector.multiple_values");
76893         }
76894         if (subfield.isAutoStreetPlace) {
76895           return `${getLocalPlaceholder("street")} / ${getLocalPlaceholder("place")}`;
76896         }
76897         return getLocalPlaceholder(subfield.id);
76898       });
76899     }
76900     function getLocalPlaceholder(key) {
76901       if (_countryCode) {
76902         var localkey = key + "!" + _countryCode;
76903         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
76904         return addrField.t("placeholders." + tkey);
76905       }
76906     }
76907     function updateTags(tags) {
76908       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
76909         var val;
76910         if (subfield.isAutoStreetPlace) {
76911           const streetKey = `${field.key}:street`;
76912           const placeKey = `${field.key}:place`;
76913           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
76914             val = tags[streetKey];
76915             subfield.id = "street";
76916           } else {
76917             val = tags[placeKey];
76918             subfield.id = "place";
76919           }
76920         } else {
76921           val = tags[`${field.key}:${subfield.id}`];
76922         }
76923         return typeof val === "string" ? val : "";
76924       }).attr("title", function(subfield) {
76925         var val = tags[field.key + ":" + subfield.id];
76926         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
76927       }).classed("mixed", function(subfield) {
76928         return Array.isArray(tags[field.key + ":" + subfield.id]);
76929       }).call(updatePlaceholder);
76930     }
76931     function combinedEntityExtent() {
76932       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
76933     }
76934     address.entityIDs = function(val) {
76935       if (!arguments.length) return _entityIDs;
76936       _entityIDs = val;
76937       return address;
76938     };
76939     address.tags = function(tags) {
76940       _tags = tags;
76941       updateTags(tags);
76942     };
76943     address.focus = function() {
76944       var node = _wrap.selectAll("input").node();
76945       if (node) node.focus();
76946     };
76947     return utilRebind(address, dispatch14, "on");
76948   }
76949   var init_address = __esm({
76950     "modules/ui/fields/address.js"() {
76951       "use strict";
76952       init_src4();
76953       init_src5();
76954       init_country_coder();
76955       init_presets();
76956       init_file_fetcher();
76957       init_geo2();
76958       init_combobox();
76959       init_util();
76960       init_localizer();
76961     }
76962   });
76963
76964   // modules/ui/fields/directional_combo.js
76965   var directional_combo_exports = {};
76966   __export(directional_combo_exports, {
76967     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo
76968   });
76969   function uiFieldDirectionalCombo(field, context) {
76970     var dispatch14 = dispatch_default("change");
76971     var items = select_default2(null);
76972     var wrap2 = select_default2(null);
76973     var _tags;
76974     var _combos = {};
76975     if (field.type === "cycleway") {
76976       field = {
76977         ...field,
76978         key: field.keys[0],
76979         keys: field.keys.slice(1)
76980       };
76981     }
76982     function directionalCombo(selection2) {
76983       function stripcolon(s2) {
76984         return s2.replace(":", "");
76985       }
76986       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
76987       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
76988       var div = wrap2.selectAll("ul").data([0]);
76989       div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
76990       items = div.selectAll("li").data(field.keys);
76991       var enter = items.enter().append("li").attr("class", function(d2) {
76992         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
76993       });
76994       enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
76995         return "preset-input-directionalcombo-" + stripcolon(d2);
76996       }).html(function(d2) {
76997         return field.t.html("types." + d2);
76998       });
76999       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
77000         const subField = {
77001           ...field,
77002           type: "combo",
77003           key
77004         };
77005         const combo = uiFieldCombo(subField, context);
77006         combo.on("change", (t2) => change(key, t2[key]));
77007         _combos[key] = combo;
77008         select_default2(this).call(combo);
77009       });
77010       items = items.merge(enter);
77011       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
77012     }
77013     function change(key, newValue) {
77014       const commonKey = field.key;
77015       const otherCommonKey = field.key.endsWith(":both") ? field.key.replace(/:both$/, "") : `${field.key}:both`;
77016       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
77017       dispatch14.call("change", this, (tags) => {
77018         const otherValue = tags[otherKey] || tags[commonKey] || tags[otherCommonKey];
77019         if (newValue === otherValue) {
77020           tags[commonKey] = newValue;
77021           delete tags[key];
77022           delete tags[otherKey];
77023           delete tags[otherCommonKey];
77024         } else {
77025           tags[key] = newValue;
77026           delete tags[commonKey];
77027           delete tags[otherCommonKey];
77028           tags[otherKey] = otherValue;
77029         }
77030         return tags;
77031       });
77032     }
77033     directionalCombo.tags = function(tags) {
77034       _tags = tags;
77035       const commonKey = field.key.replace(/:both$/, "");
77036       for (let key in _combos) {
77037         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[`${commonKey}:both`]).concat(_tags[key]).filter(Boolean))];
77038         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
77039       }
77040     };
77041     directionalCombo.focus = function() {
77042       var node = wrap2.selectAll("input").node();
77043       if (node) node.focus();
77044     };
77045     return utilRebind(directionalCombo, dispatch14, "on");
77046   }
77047   var init_directional_combo = __esm({
77048     "modules/ui/fields/directional_combo.js"() {
77049       "use strict";
77050       init_src4();
77051       init_src5();
77052       init_util();
77053       init_combo();
77054     }
77055   });
77056
77057   // modules/ui/fields/lanes.js
77058   var lanes_exports2 = {};
77059   __export(lanes_exports2, {
77060     uiFieldLanes: () => uiFieldLanes
77061   });
77062   function uiFieldLanes(field, context) {
77063     var dispatch14 = dispatch_default("change");
77064     var LANE_WIDTH = 40;
77065     var LANE_HEIGHT = 200;
77066     var _entityIDs = [];
77067     function lanes(selection2) {
77068       var lanesData = context.entity(_entityIDs[0]).lanes();
77069       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
77070         selection2.call(lanes.off);
77071         return;
77072       }
77073       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77074       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77075       var surface = wrap2.selectAll(".surface").data([0]);
77076       var d2 = utilGetDimensions(wrap2);
77077       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
77078       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
77079       var lanesSelection = surface.selectAll(".lanes").data([0]);
77080       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
77081       lanesSelection.attr("transform", function() {
77082         return "translate(" + freeSpace / 2 + ", 0)";
77083       });
77084       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
77085       lane.exit().remove();
77086       var enter = lane.enter().append("g").attr("class", "lane");
77087       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
77088       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
77089       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
77090       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
77091       lane = lane.merge(enter);
77092       lane.attr("transform", function(d4) {
77093         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
77094       });
77095       lane.select(".forward").style("visibility", function(d4) {
77096         return d4.direction === "forward" ? "visible" : "hidden";
77097       });
77098       lane.select(".bothways").style("visibility", function(d4) {
77099         return d4.direction === "bothways" ? "visible" : "hidden";
77100       });
77101       lane.select(".backward").style("visibility", function(d4) {
77102         return d4.direction === "backward" ? "visible" : "hidden";
77103       });
77104     }
77105     lanes.entityIDs = function(val) {
77106       _entityIDs = val;
77107     };
77108     lanes.tags = function() {
77109     };
77110     lanes.focus = function() {
77111     };
77112     lanes.off = function() {
77113     };
77114     return utilRebind(lanes, dispatch14, "on");
77115   }
77116   var init_lanes2 = __esm({
77117     "modules/ui/fields/lanes.js"() {
77118       "use strict";
77119       init_src4();
77120       init_rebind();
77121       init_dimensions();
77122       uiFieldLanes.supportsMultiselection = false;
77123     }
77124   });
77125
77126   // modules/ui/fields/localized.js
77127   var localized_exports = {};
77128   __export(localized_exports, {
77129     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
77130     uiFieldLocalized: () => uiFieldLocalized
77131   });
77132   function uiFieldLocalized(field, context) {
77133     var dispatch14 = dispatch_default("change", "input");
77134     var wikipedia = services.wikipedia;
77135     var input = select_default2(null);
77136     var localizedInputs = select_default2(null);
77137     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
77138     var _countryCode;
77139     var _tags;
77140     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
77141     });
77142     var _territoryLanguages = {};
77143     _mainFileFetcher.get("territory_languages").then(function(d2) {
77144       _territoryLanguages = d2;
77145     }).catch(function() {
77146     });
77147     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
77148     var _selection = select_default2(null);
77149     var _multilingual = [];
77150     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
77151     var _wikiTitles;
77152     var _entityIDs = [];
77153     function loadLanguagesArray(dataLanguages) {
77154       if (_languagesArray.length !== 0) return;
77155       var replacements = {
77156         sr: "sr-Cyrl",
77157         // in OSM, `sr` implies Cyrillic
77158         "sr-Cyrl": false
77159         // `sr-Cyrl` isn't used in OSM
77160       };
77161       for (var code in dataLanguages) {
77162         if (replacements[code] === false) continue;
77163         var metaCode = code;
77164         if (replacements[code]) metaCode = replacements[code];
77165         _languagesArray.push({
77166           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
77167           nativeName: dataLanguages[metaCode].nativeName,
77168           code,
77169           label: _mainLocalizer.languageName(metaCode)
77170         });
77171       }
77172     }
77173     function calcLocked() {
77174       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
77175         var entity = context.graph().hasEntity(entityID);
77176         if (!entity) return false;
77177         if (entity.tags.wikidata) return true;
77178         if (entity.tags["name:etymology:wikidata"]) return true;
77179         var preset = _mainPresetIndex.match(entity, context.graph());
77180         if (preset) {
77181           var isSuggestion = preset.suggestion;
77182           var fields = preset.fields(entity.extent(context.graph()).center());
77183           var showsBrandField = fields.some(function(d2) {
77184             return d2.id === "brand";
77185           });
77186           var showsOperatorField = fields.some(function(d2) {
77187             return d2.id === "operator";
77188           });
77189           var setsName = preset.addTags.name;
77190           var setsBrandWikidata = preset.addTags["brand:wikidata"];
77191           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
77192           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
77193         }
77194         return false;
77195       });
77196       field.locked(isLocked);
77197     }
77198     function calcMultilingual(tags) {
77199       var existingLangsOrdered = _multilingual.map(function(item2) {
77200         return item2.lang;
77201       });
77202       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
77203       for (var k2 in tags) {
77204         var m2 = k2.match(LANGUAGE_SUFFIX_REGEX);
77205         if (m2 && m2[1] === field.key && m2[2]) {
77206           var item = { lang: m2[2], value: tags[k2] };
77207           if (existingLangs.has(item.lang)) {
77208             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
77209             existingLangs.delete(item.lang);
77210           } else {
77211             _multilingual.push(item);
77212           }
77213         }
77214       }
77215       _multilingual.forEach(function(item2) {
77216         if (item2.lang && existingLangs.has(item2.lang)) {
77217           item2.value = "";
77218         }
77219       });
77220     }
77221     function localized(selection2) {
77222       _selection = selection2;
77223       calcLocked();
77224       var isLocked = field.locked();
77225       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77226       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77227       input = wrap2.selectAll(".localized-main").data([0]);
77228       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
77229       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
77230       wrap2.call(_lengthIndicator);
77231       var translateButton = wrap2.selectAll(".localized-add").data([0]);
77232       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);
77233       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
77234       if (_tags && !_multilingual.length) {
77235         calcMultilingual(_tags);
77236       }
77237       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
77238       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
77239       localizedInputs.call(renderMultilingual);
77240       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
77241       selection2.selectAll(".combobox-caret").classed("nope", true);
77242       function addNew(d3_event) {
77243         d3_event.preventDefault();
77244         if (field.locked()) return;
77245         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
77246         var langExists = _multilingual.find(function(datum2) {
77247           return datum2.lang === defaultLang;
77248         });
77249         var isLangEn = defaultLang.indexOf("en") > -1;
77250         if (isLangEn || langExists) {
77251           defaultLang = "";
77252           langExists = _multilingual.find(function(datum2) {
77253             return datum2.lang === defaultLang;
77254           });
77255         }
77256         if (!langExists) {
77257           _multilingual.unshift({ lang: defaultLang, value: "" });
77258           localizedInputs.call(renderMultilingual);
77259         }
77260       }
77261       function change(onInput) {
77262         return function(d3_event) {
77263           if (field.locked()) {
77264             d3_event.preventDefault();
77265             return;
77266           }
77267           var val = utilGetSetValue(select_default2(this));
77268           if (!onInput) val = context.cleanTagValue(val);
77269           if (!val && Array.isArray(_tags[field.key])) return;
77270           var t2 = {};
77271           t2[field.key] = val || void 0;
77272           dispatch14.call("change", this, t2, onInput);
77273         };
77274       }
77275     }
77276     function key(lang) {
77277       return field.key + ":" + lang;
77278     }
77279     function changeLang(d3_event, d2) {
77280       var tags = {};
77281       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
77282       var language = _languagesArray.find(function(d4) {
77283         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
77284       });
77285       if (language) lang = language.code;
77286       if (d2.lang && d2.lang !== lang) {
77287         tags[key(d2.lang)] = void 0;
77288       }
77289       var newKey = lang && context.cleanTagKey(key(lang));
77290       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
77291       if (newKey && value) {
77292         tags[newKey] = value;
77293       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
77294         tags[newKey] = _wikiTitles[d2.lang];
77295       }
77296       d2.lang = lang;
77297       dispatch14.call("change", this, tags);
77298     }
77299     function changeValue(d3_event, d2) {
77300       if (!d2.lang) return;
77301       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
77302       if (!value && Array.isArray(d2.value)) return;
77303       var t2 = {};
77304       t2[key(d2.lang)] = value;
77305       d2.value = value;
77306       dispatch14.call("change", this, t2);
77307     }
77308     function fetchLanguages(value, cb) {
77309       var v2 = value.toLowerCase();
77310       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
77311       if (_countryCode && _territoryLanguages[_countryCode]) {
77312         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
77313       }
77314       var langItems = [];
77315       langCodes.forEach(function(code) {
77316         var langItem = _languagesArray.find(function(item) {
77317           return item.code === code;
77318         });
77319         if (langItem) langItems.push(langItem);
77320       });
77321       langItems = utilArrayUniq(langItems.concat(_languagesArray));
77322       cb(langItems.filter(function(d2) {
77323         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;
77324       }).map(function(d2) {
77325         return { value: d2.label };
77326       }));
77327     }
77328     function renderMultilingual(selection2) {
77329       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
77330         return d2.lang;
77331       });
77332       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
77333       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
77334         var wrap2 = select_default2(this);
77335         var domId = utilUniqueDomId(index);
77336         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
77337         var text = label.append("span").attr("class", "label-text");
77338         text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
77339         text.append("span").attr("class", "label-textannotation");
77340         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
77341           if (field.locked()) return;
77342           d3_event.preventDefault();
77343           _multilingual.splice(_multilingual.indexOf(d2), 1);
77344           var langKey = d2.lang && key(d2.lang);
77345           if (langKey && langKey in _tags) {
77346             delete _tags[langKey];
77347             var t2 = {};
77348             t2[langKey] = void 0;
77349             dispatch14.call("change", this, t2);
77350             return;
77351           }
77352           renderMultilingual(selection2);
77353         }).call(svgIcon("#iD-operation-delete"));
77354         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);
77355         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
77356       });
77357       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() {
77358         select_default2(this).style("max-height", "").style("overflow", "visible");
77359       });
77360       entries = entries.merge(entriesEnter);
77361       entries.order();
77362       entries.classed("present", true);
77363       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
77364         var langItem = _languagesArray.find(function(item) {
77365           return item.code === d2.lang;
77366         });
77367         if (langItem) return langItem.label;
77368         return d2.lang;
77369       });
77370       utilGetSetValue(entries.select(".localized-value"), function(d2) {
77371         return typeof d2.value === "string" ? d2.value : "";
77372       }).attr("title", function(d2) {
77373         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
77374       }).attr("placeholder", function(d2) {
77375         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
77376       }).attr("lang", function(d2) {
77377         return d2.lang;
77378       }).classed("mixed", function(d2) {
77379         return Array.isArray(d2.value);
77380       });
77381     }
77382     localized.tags = function(tags) {
77383       _tags = tags;
77384       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
77385         _wikiTitles = {};
77386         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
77387         if (wm && wm[0] && wm[1]) {
77388           wikipedia.translations(wm[1], wm[2], function(err, d2) {
77389             if (err || !d2) return;
77390             _wikiTitles = d2;
77391           });
77392         }
77393       }
77394       var isMixed = Array.isArray(tags[field.key]);
77395       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);
77396       calcMultilingual(tags);
77397       _selection.call(localized);
77398       if (!isMixed) {
77399         _lengthIndicator.update(tags[field.key]);
77400       }
77401     };
77402     localized.focus = function() {
77403       input.node().focus();
77404     };
77405     localized.entityIDs = function(val) {
77406       if (!arguments.length) return _entityIDs;
77407       _entityIDs = val;
77408       _multilingual = [];
77409       loadCountryCode();
77410       return localized;
77411     };
77412     function loadCountryCode() {
77413       var extent = combinedEntityExtent();
77414       var countryCode = extent && iso1A2Code(extent.center());
77415       _countryCode = countryCode && countryCode.toLowerCase();
77416     }
77417     function combinedEntityExtent() {
77418       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77419     }
77420     return utilRebind(localized, dispatch14, "on");
77421   }
77422   var _languagesArray, LANGUAGE_SUFFIX_REGEX;
77423   var init_localized = __esm({
77424     "modules/ui/fields/localized.js"() {
77425       "use strict";
77426       init_src4();
77427       init_src5();
77428       init_country_coder();
77429       init_presets();
77430       init_file_fetcher();
77431       init_localizer();
77432       init_services();
77433       init_svg();
77434       init_tooltip();
77435       init_combobox();
77436       init_util();
77437       init_length_indicator();
77438       _languagesArray = [];
77439       LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
77440     }
77441   });
77442
77443   // modules/ui/fields/roadheight.js
77444   var roadheight_exports = {};
77445   __export(roadheight_exports, {
77446     uiFieldRoadheight: () => uiFieldRoadheight
77447   });
77448   function uiFieldRoadheight(field, context) {
77449     var dispatch14 = dispatch_default("change");
77450     var primaryUnitInput = select_default2(null);
77451     var primaryInput = select_default2(null);
77452     var secondaryInput = select_default2(null);
77453     var secondaryUnitInput = select_default2(null);
77454     var _entityIDs = [];
77455     var _tags;
77456     var _isImperial;
77457     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
77458     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
77459     var primaryUnits = [
77460       {
77461         value: "m",
77462         title: _t("inspector.roadheight.meter")
77463       },
77464       {
77465         value: "ft",
77466         title: _t("inspector.roadheight.foot")
77467       }
77468     ];
77469     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
77470     function roadheight(selection2) {
77471       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77472       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77473       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
77474       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
77475       primaryInput.on("change", change).on("blur", change);
77476       var loc = combinedEntityExtent().center();
77477       _isImperial = roadHeightUnit(loc) === "ft";
77478       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
77479       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
77480       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
77481       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
77482       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
77483       secondaryInput.on("change", change).on("blur", change);
77484       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
77485       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
77486       function changeUnits() {
77487         var primaryUnit = utilGetSetValue(primaryUnitInput);
77488         if (primaryUnit === "m") {
77489           _isImperial = false;
77490         } else if (primaryUnit === "ft") {
77491           _isImperial = true;
77492         }
77493         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
77494         setUnitSuggestions();
77495         change();
77496       }
77497     }
77498     function setUnitSuggestions() {
77499       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
77500     }
77501     function change() {
77502       var tag2 = {};
77503       var primaryValue = utilGetSetValue(primaryInput).trim();
77504       var secondaryValue = utilGetSetValue(secondaryInput).trim();
77505       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
77506       if (!primaryValue && !secondaryValue) {
77507         tag2[field.key] = void 0;
77508       } else {
77509         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
77510         if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
77511         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
77512         if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
77513         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
77514           tag2[field.key] = context.cleanTagValue(rawPrimaryValue);
77515         } else {
77516           if (rawPrimaryValue !== "") {
77517             rawPrimaryValue = rawPrimaryValue + "'";
77518           }
77519           if (rawSecondaryValue !== "") {
77520             rawSecondaryValue = rawSecondaryValue + '"';
77521           }
77522           tag2[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
77523         }
77524       }
77525       dispatch14.call("change", this, tag2);
77526     }
77527     roadheight.tags = function(tags) {
77528       _tags = tags;
77529       var primaryValue = tags[field.key];
77530       var secondaryValue;
77531       var isMixed = Array.isArray(primaryValue);
77532       if (!isMixed) {
77533         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
77534           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
77535           if (secondaryValue !== null) {
77536             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
77537           }
77538           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
77539           if (primaryValue !== null) {
77540             primaryValue = formatFloat(parseFloat(primaryValue[1]));
77541           }
77542           _isImperial = true;
77543         } else if (primaryValue) {
77544           var rawValue = primaryValue;
77545           primaryValue = parseFloat(rawValue);
77546           if (isNaN(primaryValue)) {
77547             primaryValue = rawValue;
77548           } else {
77549             primaryValue = formatFloat(primaryValue);
77550           }
77551           _isImperial = false;
77552         }
77553       }
77554       setUnitSuggestions();
77555       var inchesPlaceholder = formatFloat(0);
77556       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);
77557       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");
77558       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
77559     };
77560     roadheight.focus = function() {
77561       primaryInput.node().focus();
77562     };
77563     roadheight.entityIDs = function(val) {
77564       _entityIDs = val;
77565     };
77566     function combinedEntityExtent() {
77567       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77568     }
77569     return utilRebind(roadheight, dispatch14, "on");
77570   }
77571   var init_roadheight = __esm({
77572     "modules/ui/fields/roadheight.js"() {
77573       "use strict";
77574       init_src4();
77575       init_src5();
77576       init_country_coder();
77577       init_combobox();
77578       init_localizer();
77579       init_util();
77580       init_input();
77581     }
77582   });
77583
77584   // modules/ui/fields/roadspeed.js
77585   var roadspeed_exports = {};
77586   __export(roadspeed_exports, {
77587     uiFieldRoadspeed: () => uiFieldRoadspeed
77588   });
77589   function uiFieldRoadspeed(field, context) {
77590     var dispatch14 = dispatch_default("change");
77591     var unitInput = select_default2(null);
77592     var input = select_default2(null);
77593     var _entityIDs = [];
77594     var _tags;
77595     var _isImperial;
77596     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
77597     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
77598     var speedCombo = uiCombobox(context, "roadspeed");
77599     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
77600     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
77601     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
77602     function roadspeed(selection2) {
77603       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77604       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77605       input = wrap2.selectAll("input.roadspeed-number").data([0]);
77606       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
77607       input.on("change", change).on("blur", change);
77608       var loc = combinedEntityExtent().center();
77609       _isImperial = roadSpeedUnit(loc) === "mph";
77610       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
77611       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
77612       unitInput.on("blur", changeUnits).on("change", changeUnits);
77613       function changeUnits() {
77614         var unit2 = utilGetSetValue(unitInput);
77615         if (unit2 === "km/h") {
77616           _isImperial = false;
77617         } else if (unit2 === "mph") {
77618           _isImperial = true;
77619         }
77620         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
77621         setUnitSuggestions();
77622         change();
77623       }
77624     }
77625     function setUnitSuggestions() {
77626       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
77627       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
77628     }
77629     function comboValues(d2) {
77630       return {
77631         value: formatFloat(d2),
77632         title: formatFloat(d2)
77633       };
77634     }
77635     function change() {
77636       var tag2 = {};
77637       var value = utilGetSetValue(input).trim();
77638       if (!value && Array.isArray(_tags[field.key])) return;
77639       if (!value) {
77640         tag2[field.key] = void 0;
77641       } else {
77642         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
77643         if (isNaN(rawValue)) rawValue = value;
77644         if (isNaN(rawValue) || !_isImperial) {
77645           tag2[field.key] = context.cleanTagValue(rawValue);
77646         } else {
77647           tag2[field.key] = context.cleanTagValue(rawValue + " mph");
77648         }
77649       }
77650       dispatch14.call("change", this, tag2);
77651     }
77652     roadspeed.tags = function(tags) {
77653       _tags = tags;
77654       var rawValue = tags[field.key];
77655       var value = rawValue;
77656       var isMixed = Array.isArray(value);
77657       if (!isMixed) {
77658         if (rawValue && rawValue.indexOf("mph") >= 0) {
77659           _isImperial = true;
77660         } else if (rawValue) {
77661           _isImperial = false;
77662         }
77663         value = parseInt(value, 10);
77664         if (isNaN(value)) {
77665           value = rawValue;
77666         } else {
77667           value = formatFloat(value);
77668         }
77669       }
77670       setUnitSuggestions();
77671       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);
77672     };
77673     roadspeed.focus = function() {
77674       input.node().focus();
77675     };
77676     roadspeed.entityIDs = function(val) {
77677       _entityIDs = val;
77678     };
77679     function combinedEntityExtent() {
77680       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
77681     }
77682     return utilRebind(roadspeed, dispatch14, "on");
77683   }
77684   var init_roadspeed = __esm({
77685     "modules/ui/fields/roadspeed.js"() {
77686       "use strict";
77687       init_src4();
77688       init_src5();
77689       init_country_coder();
77690       init_combobox();
77691       init_localizer();
77692       init_util();
77693       init_input();
77694     }
77695   });
77696
77697   // modules/ui/fields/radio.js
77698   var radio_exports = {};
77699   __export(radio_exports, {
77700     uiFieldRadio: () => uiFieldRadio,
77701     uiFieldStructureRadio: () => uiFieldRadio
77702   });
77703   function uiFieldRadio(field, context) {
77704     var dispatch14 = dispatch_default("change");
77705     var placeholder = select_default2(null);
77706     var wrap2 = select_default2(null);
77707     var labels = select_default2(null);
77708     var radios = select_default2(null);
77709     var radioData = (field.options || field.keys).slice();
77710     var typeField;
77711     var layerField;
77712     var _oldType = {};
77713     var _entityIDs = [];
77714     function selectedKey() {
77715       var node = wrap2.selectAll(".form-field-input-radio label.active input");
77716       return !node.empty() && node.datum();
77717     }
77718     function radio(selection2) {
77719       selection2.classed("preset-radio", true);
77720       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77721       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
77722       enter.append("span").attr("class", "placeholder");
77723       wrap2 = wrap2.merge(enter);
77724       placeholder = wrap2.selectAll(".placeholder");
77725       labels = wrap2.selectAll("label").data(radioData);
77726       enter = labels.enter().append("label");
77727       var stringsField = field.resolveReference("stringsCrossReference");
77728       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
77729         return stringsField.t("options." + d2, { "default": d2 });
77730       }).attr("checked", false);
77731       enter.append("span").each(function(d2) {
77732         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
77733       });
77734       labels = labels.merge(enter);
77735       radios = labels.selectAll("input").on("change", changeRadio);
77736     }
77737     function structureExtras(selection2, tags) {
77738       var selected = selectedKey() || tags.layer !== void 0;
77739       var type2 = _mainPresetIndex.field(selected);
77740       var layer = _mainPresetIndex.field("layer");
77741       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
77742       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
77743       extrasWrap.exit().remove();
77744       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
77745       var list2 = extrasWrap.selectAll("ul").data([0]);
77746       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
77747       if (type2) {
77748         if (!typeField || typeField.id !== selected) {
77749           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
77750         }
77751         typeField.tags(tags);
77752       } else {
77753         typeField = null;
77754       }
77755       var typeItem = list2.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
77756         return d2.id;
77757       });
77758       typeItem.exit().remove();
77759       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
77760       typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
77761       typeEnter.append("div").attr("class", "structure-input-type-wrap");
77762       typeItem = typeItem.merge(typeEnter);
77763       if (typeField) {
77764         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
77765       }
77766       if (layer && showLayer) {
77767         if (!layerField) {
77768           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
77769         }
77770         layerField.tags(tags);
77771         field.keys = utilArrayUnion(field.keys, ["layer"]);
77772       } else {
77773         layerField = null;
77774         field.keys = field.keys.filter(function(k2) {
77775           return k2 !== "layer";
77776         });
77777       }
77778       var layerItem = list2.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
77779       layerItem.exit().remove();
77780       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
77781       layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
77782       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
77783       layerItem = layerItem.merge(layerEnter);
77784       if (layerField) {
77785         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
77786       }
77787     }
77788     function changeType(t2, onInput) {
77789       var key = selectedKey();
77790       if (!key) return;
77791       var val = t2[key];
77792       if (val !== "no") {
77793         _oldType[key] = val;
77794       }
77795       if (field.type === "structureRadio") {
77796         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
77797           t2.layer = void 0;
77798         }
77799         if (t2.layer === void 0) {
77800           if (key === "bridge" && val !== "no") {
77801             t2.layer = "1";
77802           }
77803           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
77804             t2.layer = "-1";
77805           }
77806         }
77807       }
77808       dispatch14.call("change", this, t2, onInput);
77809     }
77810     function changeLayer(t2, onInput) {
77811       if (t2.layer === "0") {
77812         t2.layer = void 0;
77813       }
77814       dispatch14.call("change", this, t2, onInput);
77815     }
77816     function changeRadio() {
77817       var t2 = {};
77818       var activeKey;
77819       if (field.key) {
77820         t2[field.key] = void 0;
77821       }
77822       radios.each(function(d2) {
77823         var active = select_default2(this).property("checked");
77824         if (active) activeKey = d2;
77825         if (field.key) {
77826           if (active) t2[field.key] = d2;
77827         } else {
77828           var val = _oldType[activeKey] || "yes";
77829           t2[d2] = active ? val : void 0;
77830         }
77831       });
77832       if (field.type === "structureRadio") {
77833         if (activeKey === "bridge") {
77834           t2.layer = "1";
77835         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
77836           t2.layer = "-1";
77837         } else {
77838           t2.layer = void 0;
77839         }
77840       }
77841       dispatch14.call("change", this, t2);
77842     }
77843     radio.tags = function(tags) {
77844       function isOptionChecked(d2) {
77845         if (field.key) {
77846           return tags[field.key] === d2;
77847         }
77848         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
77849       }
77850       function isMixed(d2) {
77851         if (field.key) {
77852           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
77853         }
77854         return Array.isArray(tags[d2]);
77855       }
77856       radios.property("checked", function(d2) {
77857         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
77858       });
77859       labels.classed("active", function(d2) {
77860         if (field.key) {
77861           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
77862         }
77863         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
77864       }).classed("mixed", isMixed).attr("title", function(d2) {
77865         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
77866       });
77867       var selection2 = radios.filter(function() {
77868         return this.checked;
77869       });
77870       if (selection2.empty()) {
77871         placeholder.text("");
77872         placeholder.call(_t.append("inspector.none"));
77873       } else {
77874         placeholder.text(selection2.attr("value"));
77875         _oldType[selection2.datum()] = tags[selection2.datum()];
77876       }
77877       if (field.type === "structureRadio") {
77878         if (!!tags.waterway && !_oldType.tunnel) {
77879           _oldType.tunnel = "culvert";
77880         }
77881         if (!!tags.waterway && !_oldType.bridge) {
77882           _oldType.bridge = "aqueduct";
77883         }
77884         wrap2.call(structureExtras, tags);
77885       }
77886     };
77887     radio.focus = function() {
77888       radios.node().focus();
77889     };
77890     radio.entityIDs = function(val) {
77891       if (!arguments.length) return _entityIDs;
77892       _entityIDs = val;
77893       _oldType = {};
77894       return radio;
77895     };
77896     radio.isAllowed = function() {
77897       return _entityIDs.length === 1;
77898     };
77899     return utilRebind(radio, dispatch14, "on");
77900   }
77901   var init_radio = __esm({
77902     "modules/ui/fields/radio.js"() {
77903       "use strict";
77904       init_src4();
77905       init_src5();
77906       init_presets();
77907       init_localizer();
77908       init_field2();
77909       init_util();
77910     }
77911   });
77912
77913   // modules/ui/fields/restrictions.js
77914   var restrictions_exports = {};
77915   __export(restrictions_exports, {
77916     uiFieldRestrictions: () => uiFieldRestrictions
77917   });
77918   function uiFieldRestrictions(field, context) {
77919     var dispatch14 = dispatch_default("change");
77920     var breathe = behaviorBreathe(context);
77921     corePreferences("turn-restriction-via-way", null);
77922     var storedViaWay = corePreferences("turn-restriction-via-way0");
77923     var storedDistance = corePreferences("turn-restriction-distance");
77924     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
77925     var _maxDistance = storedDistance ? +storedDistance : 30;
77926     var _initialized3 = false;
77927     var _parent = select_default2(null);
77928     var _container = select_default2(null);
77929     var _oldTurns;
77930     var _graph;
77931     var _vertexID;
77932     var _intersection;
77933     var _fromWayID;
77934     var _lastXPos;
77935     function restrictions(selection2) {
77936       _parent = selection2;
77937       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
77938         _graph = context.graph();
77939         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
77940       }
77941       var isOK = _intersection && _intersection.vertices.length && // has vertices
77942       _intersection.vertices.filter(function(vertex) {
77943         return vertex.id === _vertexID;
77944       }).length && _intersection.ways.length > 2;
77945       select_default2(selection2.node().parentNode).classed("hide", !isOK);
77946       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
77947         selection2.call(restrictions.off);
77948         return;
77949       }
77950       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
77951       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
77952       var container = wrap2.selectAll(".restriction-container").data([0]);
77953       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
77954       containerEnter.append("div").attr("class", "restriction-help");
77955       _container = containerEnter.merge(container).call(renderViewer);
77956       var controls = wrap2.selectAll(".restriction-controls").data([0]);
77957       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
77958     }
77959     function renderControls(selection2) {
77960       var distControl = selection2.selectAll(".restriction-distance").data([0]);
77961       distControl.exit().remove();
77962       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
77963       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
77964       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
77965       distControlEnter.append("span").attr("class", "restriction-distance-text");
77966       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
77967         var val = select_default2(this).property("value");
77968         _maxDistance = +val;
77969         _intersection = null;
77970         _container.selectAll(".layer-osm .layer-turns *").remove();
77971         corePreferences("turn-restriction-distance", _maxDistance);
77972         _parent.call(restrictions);
77973       });
77974       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
77975       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
77976       viaControl.exit().remove();
77977       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
77978       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
77979       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
77980       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
77981       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
77982         var val = select_default2(this).property("value");
77983         _maxViaWay = +val;
77984         _container.selectAll(".layer-osm .layer-turns *").remove();
77985         corePreferences("turn-restriction-via-way0", _maxViaWay);
77986         _parent.call(restrictions);
77987       });
77988       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
77989     }
77990     function renderViewer(selection2) {
77991       if (!_intersection) return;
77992       var vgraph = _intersection.graph;
77993       var filter2 = utilFunctor(true);
77994       var projection2 = geoRawMercator();
77995       var sdims = utilGetDimensions(context.container().select(".sidebar"));
77996       var d2 = [sdims[0] - 50, 370];
77997       var c2 = geoVecScale(d2, 0.5);
77998       var z2 = 22;
77999       projection2.scale(geoZoomToScale(z2));
78000       var extent = geoExtent();
78001       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
78002         extent._extend(_intersection.vertices[i3].extent());
78003       }
78004       var padTop = 35;
78005       if (_intersection.vertices.length > 1) {
78006         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
78007         var vPadding = 160;
78008         var tl = projection2([extent[0][0], extent[1][1]]);
78009         var br2 = projection2([extent[1][0], extent[0][1]]);
78010         var hFactor = (br2[0] - tl[0]) / (d2[0] - hPadding);
78011         var vFactor = (br2[1] - tl[1]) / (d2[1] - vPadding - padTop);
78012         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
78013         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
78014         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
78015         projection2.scale(geoZoomToScale(z2));
78016       }
78017       var extentCenter = projection2(extent.center());
78018       extentCenter[1] = extentCenter[1] - padTop / 2;
78019       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
78020       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
78021       var drawVertices = svgVertices(projection2, context);
78022       var drawLines = svgLines(projection2, context);
78023       var drawTurns = svgTurns(projection2, context);
78024       var firstTime = selection2.selectAll(".surface").empty();
78025       selection2.call(drawLayers);
78026       var surface = selection2.selectAll(".surface").classed("tr", true);
78027       if (firstTime) {
78028         _initialized3 = true;
78029         surface.call(breathe);
78030       }
78031       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
78032         _fromWayID = null;
78033         _oldTurns = null;
78034       }
78035       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));
78036       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
78037       surface.selectAll(".selected").classed("selected", false);
78038       surface.selectAll(".related").classed("related", false);
78039       var way;
78040       if (_fromWayID) {
78041         way = vgraph.entity(_fromWayID);
78042         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
78043       }
78044       document.addEventListener("resizeWindow", function() {
78045         utilSetDimensions(_container, null);
78046         redraw(1);
78047       }, false);
78048       updateHints(null);
78049       function click(d3_event) {
78050         surface.call(breathe.off).call(breathe);
78051         var datum2 = d3_event.target.__data__;
78052         var entity = datum2 && datum2.properties && datum2.properties.entity;
78053         if (entity) {
78054           datum2 = entity;
78055         }
78056         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
78057           _fromWayID = datum2.id;
78058           _oldTurns = null;
78059           redraw();
78060         } else if (datum2 instanceof osmTurn) {
78061           var actions, extraActions, turns, i4;
78062           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
78063           if (datum2.restrictionID && !datum2.direct) {
78064             return;
78065           } else if (datum2.restrictionID && !datum2.only) {
78066             var seen = {};
78067             var datumOnly = JSON.parse(JSON.stringify(datum2));
78068             datumOnly.only = true;
78069             restrictionType = restrictionType.replace(/^no/, "only");
78070             turns = _intersection.turns(_fromWayID, 2);
78071             extraActions = [];
78072             _oldTurns = [];
78073             for (i4 = 0; i4 < turns.length; i4++) {
78074               var turn = turns[i4];
78075               if (seen[turn.restrictionID]) continue;
78076               if (turn.direct && turn.path[1] === datum2.path[1]) {
78077                 seen[turns[i4].restrictionID] = true;
78078                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
78079                 _oldTurns.push(turn);
78080                 extraActions.push(actionUnrestrictTurn(turn));
78081               }
78082             }
78083             actions = _intersection.actions.concat(extraActions, [
78084               actionRestrictTurn(datumOnly, restrictionType),
78085               _t("operations.restriction.annotation.create")
78086             ]);
78087           } else if (datum2.restrictionID) {
78088             turns = _oldTurns || [];
78089             extraActions = [];
78090             for (i4 = 0; i4 < turns.length; i4++) {
78091               if (turns[i4].key !== datum2.key) {
78092                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
78093               }
78094             }
78095             _oldTurns = null;
78096             actions = _intersection.actions.concat(extraActions, [
78097               actionUnrestrictTurn(datum2),
78098               _t("operations.restriction.annotation.delete")
78099             ]);
78100           } else {
78101             actions = _intersection.actions.concat([
78102               actionRestrictTurn(datum2, restrictionType),
78103               _t("operations.restriction.annotation.create")
78104             ]);
78105           }
78106           context.perform.apply(context, actions);
78107           var s2 = surface.selectAll("." + datum2.key);
78108           datum2 = s2.empty() ? null : s2.datum();
78109           updateHints(datum2);
78110         } else {
78111           _fromWayID = null;
78112           _oldTurns = null;
78113           redraw();
78114         }
78115       }
78116       function mouseover(d3_event) {
78117         var datum2 = d3_event.target.__data__;
78118         updateHints(datum2);
78119       }
78120       _lastXPos = _lastXPos || sdims[0];
78121       function redraw(minChange) {
78122         var xPos = -1;
78123         if (minChange) {
78124           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
78125         }
78126         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
78127           if (context.hasEntity(_vertexID)) {
78128             _lastXPos = xPos;
78129             _container.call(renderViewer);
78130           }
78131         }
78132       }
78133       function highlightPathsFrom(wayID) {
78134         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
78135         surface.selectAll("." + wayID).classed("related", true);
78136         if (wayID) {
78137           var turns = _intersection.turns(wayID, _maxViaWay);
78138           for (var i4 = 0; i4 < turns.length; i4++) {
78139             var turn = turns[i4];
78140             var ids = [turn.to.way];
78141             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
78142             if (turn.only || turns.length === 1) {
78143               if (turn.via.ways) {
78144                 ids = ids.concat(turn.via.ways);
78145               }
78146             } else if (turn.to.way === wayID) {
78147               continue;
78148             }
78149             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
78150           }
78151         }
78152       }
78153       function updateHints(datum2) {
78154         var help = _container.selectAll(".restriction-help").html("");
78155         var placeholders = {};
78156         ["from", "via", "to"].forEach(function(k2) {
78157           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
78158         });
78159         var entity = datum2 && datum2.properties && datum2.properties.entity;
78160         if (entity) {
78161           datum2 = entity;
78162         }
78163         if (_fromWayID) {
78164           way = vgraph.entity(_fromWayID);
78165           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
78166         }
78167         if (datum2 instanceof osmWay && datum2.__from) {
78168           way = datum2;
78169           highlightPathsFrom(_fromWayID ? null : way.id);
78170           surface.selectAll("." + way.id).classed("related", true);
78171           var clickSelect = !_fromWayID || _fromWayID !== way.id;
78172           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
78173             from: placeholders.from,
78174             fromName: displayName(way.id, vgraph)
78175           }));
78176         } else if (datum2 instanceof osmTurn) {
78177           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
78178           var turnType = restrictionType.replace(/^(only|no)\_/, "");
78179           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
78180           var klass, turnText, nextText;
78181           if (datum2.no) {
78182             klass = "restrict";
78183             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
78184             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
78185           } else if (datum2.only) {
78186             klass = "only";
78187             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
78188             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
78189           } else {
78190             klass = "allow";
78191             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
78192             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
78193           }
78194           help.append("div").attr("class", "qualifier " + klass).html(turnText);
78195           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
78196             from: placeholders.from,
78197             fromName: displayName(datum2.from.way, vgraph),
78198             to: placeholders.to,
78199             toName: displayName(datum2.to.way, vgraph)
78200           }));
78201           if (datum2.via.ways && datum2.via.ways.length) {
78202             var names = [];
78203             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
78204               var prev = names[names.length - 1];
78205               var curr = displayName(datum2.via.ways[i4], vgraph);
78206               if (!prev || curr !== prev) {
78207                 names.push(curr);
78208               }
78209             }
78210             help.append("div").html(_t.html("restriction.help.via_names", {
78211               via: placeholders.via,
78212               viaNames: names.join(", ")
78213             }));
78214           }
78215           if (!indirect) {
78216             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
78217           }
78218           highlightPathsFrom(null);
78219           var alongIDs = datum2.path.slice();
78220           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
78221         } else {
78222           highlightPathsFrom(null);
78223           if (_fromWayID) {
78224             help.append("div").html(_t.html("restriction.help.from_name", {
78225               from: placeholders.from,
78226               fromName: displayName(_fromWayID, vgraph)
78227             }));
78228           } else {
78229             help.append("div").html(_t.html("restriction.help.select_from", {
78230               from: placeholders.from
78231             }));
78232           }
78233         }
78234       }
78235     }
78236     function displayMaxDistance(maxDist) {
78237       return (selection2) => {
78238         var isImperial = !_mainLocalizer.usesMetric();
78239         var opts;
78240         if (isImperial) {
78241           var distToFeet = {
78242             // imprecise conversion for prettier display
78243             20: 70,
78244             25: 85,
78245             30: 100,
78246             35: 115,
78247             40: 130,
78248             45: 145,
78249             50: 160
78250           }[maxDist];
78251           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
78252         } else {
78253           opts = { distance: _t("units.meters", { quantity: maxDist }) };
78254         }
78255         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
78256       };
78257     }
78258     function displayMaxVia(maxVia) {
78259       return (selection2) => {
78260         selection2 = selection2.html("");
78261         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"));
78262       };
78263     }
78264     function displayName(entityID, graph) {
78265       var entity = graph.entity(entityID);
78266       var name = utilDisplayName(entity) || "";
78267       var matched = _mainPresetIndex.match(entity, graph);
78268       var type2 = matched && matched.name() || utilDisplayType(entity.id);
78269       return name || type2;
78270     }
78271     restrictions.entityIDs = function(val) {
78272       _intersection = null;
78273       _fromWayID = null;
78274       _oldTurns = null;
78275       _vertexID = val[0];
78276     };
78277     restrictions.tags = function() {
78278     };
78279     restrictions.focus = function() {
78280     };
78281     restrictions.off = function(selection2) {
78282       if (!_initialized3) return;
78283       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
78284       select_default2(window).on("resize.restrictions", null);
78285     };
78286     return utilRebind(restrictions, dispatch14, "on");
78287   }
78288   var init_restrictions = __esm({
78289     "modules/ui/fields/restrictions.js"() {
78290       "use strict";
78291       init_src4();
78292       init_src5();
78293       init_presets();
78294       init_preferences();
78295       init_localizer();
78296       init_restrict_turn();
78297       init_unrestrict_turn();
78298       init_breathe();
78299       init_geo2();
78300       init_osm();
78301       init_svg();
78302       init_util();
78303       init_dimensions();
78304       uiFieldRestrictions.supportsMultiselection = false;
78305     }
78306   });
78307
78308   // modules/ui/fields/textarea.js
78309   var textarea_exports = {};
78310   __export(textarea_exports, {
78311     uiFieldTextarea: () => uiFieldTextarea
78312   });
78313   function uiFieldTextarea(field, context) {
78314     var dispatch14 = dispatch_default("change");
78315     var input = select_default2(null);
78316     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
78317     var _tags;
78318     function textarea(selection2) {
78319       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78320       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
78321       input = wrap2.selectAll("textarea").data([0]);
78322       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
78323       wrap2.call(_lengthIndicator);
78324       function change(onInput) {
78325         return function() {
78326           var val = utilGetSetValue(input);
78327           if (!onInput) val = context.cleanTagValue(val);
78328           if (!val && Array.isArray(_tags[field.key])) return;
78329           var t2 = {};
78330           t2[field.key] = val || void 0;
78331           dispatch14.call("change", this, t2, onInput);
78332         };
78333       }
78334     }
78335     textarea.tags = function(tags) {
78336       _tags = tags;
78337       var isMixed = Array.isArray(tags[field.key]);
78338       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);
78339       if (!isMixed) {
78340         _lengthIndicator.update(tags[field.key]);
78341       }
78342     };
78343     textarea.focus = function() {
78344       input.node().focus();
78345     };
78346     return utilRebind(textarea, dispatch14, "on");
78347   }
78348   var init_textarea = __esm({
78349     "modules/ui/fields/textarea.js"() {
78350       "use strict";
78351       init_src4();
78352       init_src5();
78353       init_localizer();
78354       init_util();
78355       init_ui();
78356     }
78357   });
78358
78359   // modules/ui/fields/wikidata.js
78360   var wikidata_exports = {};
78361   __export(wikidata_exports, {
78362     uiFieldWikidata: () => uiFieldWikidata
78363   });
78364   function uiFieldWikidata(field, context) {
78365     var wikidata = services.wikidata;
78366     var dispatch14 = dispatch_default("change");
78367     var _selection = select_default2(null);
78368     var _searchInput = select_default2(null);
78369     var _qid = null;
78370     var _wikidataEntity = null;
78371     var _wikiURL = "";
78372     var _entityIDs = [];
78373     var _wikipediaKey = field.keys && field.keys.find(function(key) {
78374       return key.includes("wikipedia");
78375     });
78376     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
78377     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
78378     function wiki(selection2) {
78379       _selection = selection2;
78380       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78381       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
78382       var list2 = wrap2.selectAll("ul").data([0]);
78383       list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
78384       var searchRow = list2.selectAll("li.wikidata-search").data([0]);
78385       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
78386       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
78387         var node = select_default2(this).node();
78388         node.setSelectionRange(0, node.value.length);
78389       }).on("blur", function() {
78390         setLabelForEntity();
78391       }).call(combobox.fetcher(fetchWikidataItems));
78392       combobox.on("accept", function(d2) {
78393         if (d2) {
78394           _qid = d2.id;
78395           change();
78396         }
78397       }).on("cancel", function() {
78398         setLabelForEntity();
78399       });
78400       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) {
78401         d3_event.preventDefault();
78402         if (_wikiURL) window.open(_wikiURL, "_blank");
78403       });
78404       searchRow = searchRow.merge(searchRowEnter);
78405       _searchInput = searchRow.select("input");
78406       var wikidataProperties = ["description", "identifier"];
78407       var items = list2.selectAll("li.labeled-input").data(wikidataProperties);
78408       var enter = items.enter().append("li").attr("class", function(d2) {
78409         return "labeled-input preset-wikidata-" + d2;
78410       });
78411       enter.append("div").attr("class", "label").html(function(d2) {
78412         return _t.html("wikidata." + d2);
78413       });
78414       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
78415       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
78416         d3_event.preventDefault();
78417         select_default2(this.parentNode).select("input").node().select();
78418         document.execCommand("copy");
78419       });
78420     }
78421     function fetchWikidataItems(q2, callback) {
78422       if (!q2 && _hintKey) {
78423         for (var i3 in _entityIDs) {
78424           var entity = context.hasEntity(_entityIDs[i3]);
78425           if (entity.tags[_hintKey]) {
78426             q2 = entity.tags[_hintKey];
78427             break;
78428           }
78429         }
78430       }
78431       wikidata.itemsForSearchQuery(q2, function(err, data) {
78432         if (err) {
78433           if (err !== "No query") console.error(err);
78434           return;
78435         }
78436         var result = data.map(function(item) {
78437           return {
78438             id: item.id,
78439             value: item.display.label.value + " (" + item.id + ")",
78440             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
78441             title: item.display.description && item.display.description.value,
78442             terms: item.aliases
78443           };
78444         });
78445         if (callback) callback(result);
78446       });
78447     }
78448     function change() {
78449       var syncTags = {};
78450       syncTags[field.key] = _qid;
78451       dispatch14.call("change", this, syncTags);
78452       var initGraph = context.graph();
78453       var initEntityIDs = _entityIDs;
78454       wikidata.entityByQID(_qid, function(err, entity) {
78455         if (err) return;
78456         if (context.graph() !== initGraph) return;
78457         if (!entity.sitelinks) return;
78458         var langs = wikidata.languagesToQuery();
78459         ["labels", "descriptions"].forEach(function(key) {
78460           if (!entity[key]) return;
78461           var valueLangs = Object.keys(entity[key]);
78462           if (valueLangs.length === 0) return;
78463           var valueLang = valueLangs[0];
78464           if (langs.indexOf(valueLang) === -1) {
78465             langs.push(valueLang);
78466           }
78467         });
78468         var newWikipediaValue;
78469         if (_wikipediaKey) {
78470           var foundPreferred;
78471           for (var i3 in langs) {
78472             var lang = langs[i3];
78473             var siteID = lang.replace("-", "_") + "wiki";
78474             if (entity.sitelinks[siteID]) {
78475               foundPreferred = true;
78476               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
78477               break;
78478             }
78479           }
78480           if (!foundPreferred) {
78481             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
78482               return site.endsWith("wiki");
78483             });
78484             if (wikiSiteKeys.length === 0) {
78485               newWikipediaValue = null;
78486             } else {
78487               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
78488               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
78489               newWikipediaValue = wikiLang + ":" + wikiTitle;
78490             }
78491           }
78492         }
78493         if (newWikipediaValue) {
78494           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
78495         }
78496         if (typeof newWikipediaValue === "undefined") return;
78497         var actions = initEntityIDs.map(function(entityID) {
78498           var entity2 = context.hasEntity(entityID);
78499           if (!entity2) return null;
78500           var currTags = Object.assign({}, entity2.tags);
78501           if (newWikipediaValue === null) {
78502             if (!currTags[_wikipediaKey]) return null;
78503             delete currTags[_wikipediaKey];
78504           } else {
78505             currTags[_wikipediaKey] = newWikipediaValue;
78506           }
78507           return actionChangeTags(entityID, currTags);
78508         }).filter(Boolean);
78509         if (!actions.length) return;
78510         context.overwrite(
78511           function actionUpdateWikipediaTags(graph) {
78512             actions.forEach(function(action) {
78513               graph = action(graph);
78514             });
78515             return graph;
78516           },
78517           context.history().undoAnnotation()
78518         );
78519       });
78520     }
78521     function setLabelForEntity() {
78522       var label = {
78523         value: ""
78524       };
78525       if (_wikidataEntity) {
78526         label = entityPropertyForDisplay(_wikidataEntity, "labels");
78527         if (label.value.length === 0) {
78528           label.value = _wikidataEntity.id.toString();
78529         }
78530       }
78531       utilGetSetValue(_searchInput, label.value).attr("lang", label.language);
78532     }
78533     wiki.tags = function(tags) {
78534       var isMixed = Array.isArray(tags[field.key]);
78535       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
78536       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
78537       if (!/^Q[0-9]*$/.test(_qid)) {
78538         unrecognized();
78539         return;
78540       }
78541       _wikiURL = "https://wikidata.org/wiki/" + _qid;
78542       wikidata.entityByQID(_qid, function(err, entity) {
78543         if (err) {
78544           unrecognized();
78545           return;
78546         }
78547         _wikidataEntity = entity;
78548         setLabelForEntity();
78549         var description = entityPropertyForDisplay(entity, "descriptions");
78550         _selection.select("button.wiki-link").classed("disabled", false);
78551         _selection.select(".preset-wikidata-description").style("display", function() {
78552           return description.value.length > 0 ? "flex" : "none";
78553         }).select("input").attr("value", description.value).attr("lang", description.language);
78554         _selection.select(".preset-wikidata-identifier").style("display", function() {
78555           return entity.id ? "flex" : "none";
78556         }).select("input").attr("value", entity.id);
78557       });
78558       function unrecognized() {
78559         _wikidataEntity = null;
78560         setLabelForEntity();
78561         _selection.select(".preset-wikidata-description").style("display", "none");
78562         _selection.select(".preset-wikidata-identifier").style("display", "none");
78563         _selection.select("button.wiki-link").classed("disabled", true);
78564         if (_qid && _qid !== "") {
78565           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
78566         } else {
78567           _wikiURL = "";
78568         }
78569       }
78570     };
78571     function entityPropertyForDisplay(wikidataEntity, propKey) {
78572       var blankResponse = { value: "" };
78573       if (!wikidataEntity[propKey]) return blankResponse;
78574       var propObj = wikidataEntity[propKey];
78575       var langKeys = Object.keys(propObj);
78576       if (langKeys.length === 0) return blankResponse;
78577       var langs = wikidata.languagesToQuery();
78578       for (var i3 in langs) {
78579         var lang = langs[i3];
78580         var valueObj = propObj[lang];
78581         if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj;
78582       }
78583       return propObj[langKeys[0]];
78584     }
78585     wiki.entityIDs = function(val) {
78586       if (!arguments.length) return _entityIDs;
78587       _entityIDs = val;
78588       return wiki;
78589     };
78590     wiki.focus = function() {
78591       _searchInput.node().focus();
78592     };
78593     return utilRebind(wiki, dispatch14, "on");
78594   }
78595   var init_wikidata = __esm({
78596     "modules/ui/fields/wikidata.js"() {
78597       "use strict";
78598       init_src4();
78599       init_src5();
78600       init_change_tags();
78601       init_services();
78602       init_icon();
78603       init_util();
78604       init_combobox();
78605       init_localizer();
78606     }
78607   });
78608
78609   // modules/ui/fields/wikipedia.js
78610   var wikipedia_exports = {};
78611   __export(wikipedia_exports, {
78612     uiFieldWikipedia: () => uiFieldWikipedia
78613   });
78614   function uiFieldWikipedia(field, context) {
78615     const scheme = "https://";
78616     const domain = "wikipedia.org";
78617     const dispatch14 = dispatch_default("change");
78618     const wikipedia = services.wikipedia;
78619     const wikidata = services.wikidata;
78620     let _langInput = select_default2(null);
78621     let _titleInput = select_default2(null);
78622     let _wikiURL = "";
78623     let _entityIDs;
78624     let _tags;
78625     let _dataWikipedia = [];
78626     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
78627       _dataWikipedia = d2;
78628       if (_tags) updateForTags(_tags);
78629     }).catch(() => {
78630     });
78631     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
78632       const v2 = value.toLowerCase();
78633       callback(
78634         _dataWikipedia.filter((d2) => {
78635           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
78636         }).map((d2) => ({ value: d2[1] }))
78637       );
78638     });
78639     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
78640       if (!value) {
78641         value = "";
78642         for (let i3 in _entityIDs) {
78643           let entity = context.hasEntity(_entityIDs[i3]);
78644           if (entity.tags.name) {
78645             value = entity.tags.name;
78646             break;
78647           }
78648         }
78649       }
78650       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
78651       searchfn(language()[2], value, (query, data) => {
78652         callback(data.map((d2) => ({ value: d2 })));
78653       });
78654     });
78655     function wiki(selection2) {
78656       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
78657       wrap2 = wrap2.enter().append("div").attr("class", `form-field-input-wrap form-field-input-${field.type}`).merge(wrap2);
78658       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
78659       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
78660       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
78661       _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);
78662       _langInput.on("blur", changeLang).on("change", changeLang);
78663       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
78664       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
78665       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
78666       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
78667       _titleInput.on("blur", function() {
78668         change(true);
78669       }).on("change", function() {
78670         change(false);
78671       });
78672       let link3 = titleContainer.selectAll(".wiki-link").data([0]);
78673       link3 = link3.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link3);
78674       link3.on("click", (d3_event) => {
78675         d3_event.preventDefault();
78676         if (_wikiURL) window.open(_wikiURL, "_blank");
78677       });
78678     }
78679     function defaultLanguageInfo(skipEnglishFallback) {
78680       const langCode = _mainLocalizer.languageCode().toLowerCase();
78681       for (let i3 in _dataWikipedia) {
78682         let d2 = _dataWikipedia[i3];
78683         if (d2[2] === langCode) return d2;
78684       }
78685       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
78686     }
78687     function language(skipEnglishFallback) {
78688       const value = utilGetSetValue(_langInput).toLowerCase();
78689       for (let i3 in _dataWikipedia) {
78690         let d2 = _dataWikipedia[i3];
78691         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
78692       }
78693       return defaultLanguageInfo(skipEnglishFallback);
78694     }
78695     function changeLang() {
78696       utilGetSetValue(_langInput, language()[1]);
78697       change(true);
78698     }
78699     function change(skipWikidata) {
78700       let value = utilGetSetValue(_titleInput);
78701       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
78702       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
78703       let syncTags = {};
78704       if (langInfo) {
78705         const nativeLangName = langInfo[1];
78706         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
78707         if (m2[3]) {
78708           let anchor;
78709           anchor = decodeURIComponent(m2[3]);
78710           value += "#" + anchor.replace(/_/g, " ");
78711         }
78712         value = value.slice(0, 1).toUpperCase() + value.slice(1);
78713         utilGetSetValue(_langInput, nativeLangName).attr("lang", langInfo[2]);
78714         utilGetSetValue(_titleInput, value);
78715       }
78716       if (value) {
78717         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
78718       } else {
78719         syncTags.wikipedia = void 0;
78720       }
78721       dispatch14.call("change", this, syncTags);
78722       if (skipWikidata || !value || !language()[2]) return;
78723       const initGraph = context.graph();
78724       const initEntityIDs = _entityIDs;
78725       wikidata.itemsByTitle(language()[2], value, (err, data) => {
78726         if (err || !data || !Object.keys(data).length) return;
78727         if (context.graph() !== initGraph) return;
78728         const qids = Object.keys(data);
78729         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
78730         let actions = initEntityIDs.map((entityID) => {
78731           let entity = context.entity(entityID).tags;
78732           let currTags = Object.assign({}, entity);
78733           if (currTags.wikidata !== value2) {
78734             currTags.wikidata = value2;
78735             return actionChangeTags(entityID, currTags);
78736           }
78737           return null;
78738         }).filter(Boolean);
78739         if (!actions.length) return;
78740         context.overwrite(
78741           function actionUpdateWikidataTags(graph) {
78742             actions.forEach(function(action) {
78743               graph = action(graph);
78744             });
78745             return graph;
78746           },
78747           context.history().undoAnnotation()
78748         );
78749       });
78750     }
78751     wiki.tags = (tags) => {
78752       _tags = tags;
78753       updateForTags(tags);
78754     };
78755     function updateForTags(tags) {
78756       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
78757       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
78758       const tagLang = m2 && m2[1];
78759       const tagArticleTitle = m2 && m2[2];
78760       let anchor = m2 && m2[3];
78761       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
78762       if (tagLangInfo) {
78763         const nativeLangName = tagLangInfo[1];
78764         utilGetSetValue(_langInput, nativeLangName);
78765         _titleInput.attr("lang", tagLangInfo[2]);
78766         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
78767         _wikiURL = `${scheme}${tagLang}.${domain}/wiki/${wiki.encodePath(tagArticleTitle, anchor)}`;
78768       } else {
78769         utilGetSetValue(_titleInput, value);
78770         if (value && value !== "") {
78771           utilGetSetValue(_langInput, "");
78772           const defaultLangInfo = defaultLanguageInfo();
78773           _wikiURL = `${scheme}${defaultLangInfo[2]}.${domain}/w/index.php?fulltext=1&search=${value}`;
78774         } else {
78775           const shownOrDefaultLangInfo = language(
78776             true
78777             /* skipEnglishFallback */
78778           );
78779           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
78780           _wikiURL = "";
78781         }
78782       }
78783     }
78784     wiki.encodePath = (tagArticleTitle, anchor) => {
78785       const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
78786       const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
78787       const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
78788       return `${uriEncodedUnderscoredTitle}${uriEncodedAnchorFragment}`;
78789     };
78790     wiki.encodeURIAnchorFragment = (anchor) => {
78791       if (!anchor) return "";
78792       const underscoredAnchor = anchor.replace(/ /g, "_");
78793       return "#" + encodeURIComponent(underscoredAnchor);
78794     };
78795     wiki.entityIDs = (val) => {
78796       if (!arguments.length) return _entityIDs;
78797       _entityIDs = val;
78798       return wiki;
78799     };
78800     wiki.focus = () => {
78801       _titleInput.node().focus();
78802     };
78803     return utilRebind(wiki, dispatch14, "on");
78804   }
78805   var init_wikipedia = __esm({
78806     "modules/ui/fields/wikipedia.js"() {
78807       "use strict";
78808       init_src4();
78809       init_src5();
78810       init_file_fetcher();
78811       init_localizer();
78812       init_change_tags();
78813       init_services();
78814       init_icon();
78815       init_combobox();
78816       init_util();
78817       uiFieldWikipedia.supportsMultiselection = false;
78818     }
78819   });
78820
78821   // modules/ui/fields/index.js
78822   var fields_exports = {};
78823   __export(fields_exports, {
78824     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
78825     likelyRawNumberFormat: () => likelyRawNumberFormat,
78826     uiFieldAccess: () => uiFieldAccess,
78827     uiFieldAddress: () => uiFieldAddress,
78828     uiFieldCheck: () => uiFieldCheck,
78829     uiFieldColour: () => uiFieldText,
78830     uiFieldCombo: () => uiFieldCombo,
78831     uiFieldDefaultCheck: () => uiFieldCheck,
78832     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
78833     uiFieldEmail: () => uiFieldText,
78834     uiFieldIdentifier: () => uiFieldText,
78835     uiFieldLanes: () => uiFieldLanes,
78836     uiFieldLocalized: () => uiFieldLocalized,
78837     uiFieldManyCombo: () => uiFieldCombo,
78838     uiFieldMultiCombo: () => uiFieldCombo,
78839     uiFieldNetworkCombo: () => uiFieldCombo,
78840     uiFieldNumber: () => uiFieldText,
78841     uiFieldOnewayCheck: () => uiFieldCheck,
78842     uiFieldRadio: () => uiFieldRadio,
78843     uiFieldRestrictions: () => uiFieldRestrictions,
78844     uiFieldRoadheight: () => uiFieldRoadheight,
78845     uiFieldRoadspeed: () => uiFieldRoadspeed,
78846     uiFieldSemiCombo: () => uiFieldCombo,
78847     uiFieldStructureRadio: () => uiFieldRadio,
78848     uiFieldTel: () => uiFieldText,
78849     uiFieldText: () => uiFieldText,
78850     uiFieldTextarea: () => uiFieldTextarea,
78851     uiFieldTypeCombo: () => uiFieldCombo,
78852     uiFieldUrl: () => uiFieldText,
78853     uiFieldWikidata: () => uiFieldWikidata,
78854     uiFieldWikipedia: () => uiFieldWikipedia,
78855     uiFields: () => uiFields
78856   });
78857   var uiFields;
78858   var init_fields = __esm({
78859     "modules/ui/fields/index.js"() {
78860       "use strict";
78861       init_check();
78862       init_combo();
78863       init_input();
78864       init_access();
78865       init_address();
78866       init_directional_combo();
78867       init_lanes2();
78868       init_localized();
78869       init_roadheight();
78870       init_roadspeed();
78871       init_radio();
78872       init_restrictions();
78873       init_textarea();
78874       init_wikidata();
78875       init_wikipedia();
78876       init_check();
78877       init_combo();
78878       init_input();
78879       init_radio();
78880       init_access();
78881       init_address();
78882       init_directional_combo();
78883       init_lanes2();
78884       init_localized();
78885       init_roadheight();
78886       init_roadspeed();
78887       init_restrictions();
78888       init_textarea();
78889       init_wikidata();
78890       init_wikipedia();
78891       uiFields = {
78892         access: uiFieldAccess,
78893         address: uiFieldAddress,
78894         check: uiFieldCheck,
78895         colour: uiFieldText,
78896         combo: uiFieldCombo,
78897         cycleway: uiFieldDirectionalCombo,
78898         date: uiFieldText,
78899         defaultCheck: uiFieldCheck,
78900         directionalCombo: uiFieldDirectionalCombo,
78901         email: uiFieldText,
78902         identifier: uiFieldText,
78903         lanes: uiFieldLanes,
78904         localized: uiFieldLocalized,
78905         roadheight: uiFieldRoadheight,
78906         roadspeed: uiFieldRoadspeed,
78907         manyCombo: uiFieldCombo,
78908         multiCombo: uiFieldCombo,
78909         networkCombo: uiFieldCombo,
78910         number: uiFieldText,
78911         onewayCheck: uiFieldCheck,
78912         radio: uiFieldRadio,
78913         restrictions: uiFieldRestrictions,
78914         semiCombo: uiFieldCombo,
78915         structureRadio: uiFieldRadio,
78916         tel: uiFieldText,
78917         text: uiFieldText,
78918         textarea: uiFieldTextarea,
78919         typeCombo: uiFieldCombo,
78920         url: uiFieldText,
78921         wikidata: uiFieldWikidata,
78922         wikipedia: uiFieldWikipedia
78923       };
78924     }
78925   });
78926
78927   // modules/ui/field.js
78928   var field_exports2 = {};
78929   __export(field_exports2, {
78930     uiField: () => uiField
78931   });
78932   function uiField(context, presetField2, entityIDs, options2) {
78933     options2 = Object.assign({
78934       show: true,
78935       wrap: true,
78936       remove: true,
78937       revert: true,
78938       info: true
78939     }, options2);
78940     var dispatch14 = dispatch_default("change", "revert");
78941     var field = Object.assign({}, presetField2);
78942     field.domId = utilUniqueDomId("form-field-" + field.safeid);
78943     var _show = options2.show;
78944     var _state = "";
78945     var _tags = {};
78946     var _entityExtent;
78947     if (entityIDs && entityIDs.length) {
78948       _entityExtent = entityIDs.reduce(function(extent, entityID) {
78949         var entity = context.graph().entity(entityID);
78950         return extent.extend(entity.extent(context.graph()));
78951       }, geoExtent());
78952     }
78953     var _locked = false;
78954     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
78955     if (_show && !field.impl) {
78956       createField();
78957     }
78958     function createField() {
78959       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
78960         dispatch14.call("change", field, t2, onInput);
78961       });
78962       if (entityIDs) {
78963         field.entityIDs = entityIDs;
78964         if (field.impl.entityIDs) {
78965           field.impl.entityIDs(entityIDs);
78966         }
78967       }
78968     }
78969     function allKeys() {
78970       let keys2 = field.keys || [field.key];
78971       if (field.type === "directionalCombo" && field.key) {
78972         const baseKey = field.key.replace(/:both$/, "");
78973         keys2 = keys2.concat(baseKey, `${baseKey}:both`);
78974       }
78975       return keys2;
78976     }
78977     function isModified() {
78978       if (!entityIDs || !entityIDs.length) return false;
78979       return entityIDs.some(function(entityID) {
78980         var original = context.graph().base().entities[entityID];
78981         var latest = context.graph().entity(entityID);
78982         return allKeys().some(function(key) {
78983           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
78984         });
78985       });
78986     }
78987     function tagsContainFieldKey() {
78988       return allKeys().some(function(key) {
78989         if (field.type === "multiCombo") {
78990           for (var tagKey in _tags) {
78991             if (tagKey.indexOf(key) === 0) {
78992               return true;
78993             }
78994           }
78995           return false;
78996         }
78997         if (field.type === "localized") {
78998           for (let tagKey2 in _tags) {
78999             let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
79000             if (match && match[1] === field.key && match[2]) {
79001               return true;
79002             }
79003           }
79004         }
79005         return _tags[key] !== void 0;
79006       });
79007     }
79008     function revert(d3_event, d2) {
79009       d3_event.stopPropagation();
79010       d3_event.preventDefault();
79011       if (!entityIDs || _locked) return;
79012       dispatch14.call("revert", d2, allKeys());
79013     }
79014     function remove2(d3_event, d2) {
79015       d3_event.stopPropagation();
79016       d3_event.preventDefault();
79017       if (_locked) return;
79018       var t2 = {};
79019       allKeys().forEach(function(key) {
79020         t2[key] = void 0;
79021       });
79022       dispatch14.call("change", d2, t2);
79023     }
79024     field.render = function(selection2) {
79025       var container = selection2.selectAll(".form-field").data([field]);
79026       var enter = container.enter().append("div").attr("class", function(d2) {
79027         return "form-field form-field-" + d2.safeid;
79028       }).classed("nowrap", !options2.wrap);
79029       if (options2.wrap) {
79030         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
79031           return d2.domId;
79032         });
79033         var textEnter = labelEnter.append("span").attr("class", "label-text");
79034         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
79035           d2.label()(select_default2(this));
79036         });
79037         textEnter.append("span").attr("class", "label-textannotation");
79038         if (options2.remove) {
79039           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
79040         }
79041         if (options2.revert) {
79042           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
79043         }
79044       }
79045       container = container.merge(enter);
79046       container.select(".field-label > .remove-icon").on("click", remove2);
79047       container.select(".field-label > .modified-icon").on("click", revert);
79048       container.each(function(d2) {
79049         var selection3 = select_default2(this);
79050         if (!d2.impl) {
79051           createField();
79052         }
79053         var reference, help;
79054         if (options2.wrap && field.type === "restrictions") {
79055           help = uiFieldHelp(context, "restrictions");
79056         }
79057         if (options2.wrap && options2.info) {
79058           var referenceKey = d2.key || "";
79059           if (d2.type === "multiCombo") {
79060             referenceKey = referenceKey.replace(/:$/, "");
79061           }
79062           var referenceOptions = d2.reference || {
79063             key: referenceKey,
79064             value: _tags[referenceKey]
79065           };
79066           reference = uiTagReference(referenceOptions, context);
79067           if (_state === "hover") {
79068             reference.showing(false);
79069           }
79070         }
79071         selection3.call(d2.impl);
79072         if (help) {
79073           selection3.call(help.body).select(".field-label").call(help.button);
79074         }
79075         if (reference) {
79076           selection3.call(reference.body).select(".field-label").call(reference.button);
79077         }
79078         d2.impl.tags(_tags);
79079       });
79080       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
79081       var annotation = container.selectAll(".field-label .label-textannotation");
79082       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
79083       icon2.exit().remove();
79084       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
79085       container.call(_locked ? _lockedTip : _lockedTip.destroy);
79086     };
79087     field.state = function(val) {
79088       if (!arguments.length) return _state;
79089       _state = val;
79090       return field;
79091     };
79092     field.tags = function(val) {
79093       if (!arguments.length) return _tags;
79094       _tags = val;
79095       if (tagsContainFieldKey() && !_show) {
79096         _show = true;
79097         if (!field.impl) {
79098           createField();
79099         }
79100       }
79101       return field;
79102     };
79103     field.locked = function(val) {
79104       if (!arguments.length) return _locked;
79105       _locked = val;
79106       return field;
79107     };
79108     field.show = function() {
79109       _show = true;
79110       if (!field.impl) {
79111         createField();
79112       }
79113       if (field.default && field.key && _tags[field.key] !== field.default) {
79114         var t2 = {};
79115         t2[field.key] = field.default;
79116         dispatch14.call("change", this, t2);
79117       }
79118     };
79119     field.isShown = function() {
79120       return _show;
79121     };
79122     field.isAllowed = function() {
79123       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
79124       if (field.geometry && !entityIDs.every(function(entityID) {
79125         return field.matchGeometry(context.graph().geometry(entityID));
79126       })) return false;
79127       if (entityIDs && _entityExtent && field.locationSetID) {
79128         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
79129         if (!validHere[field.locationSetID]) return false;
79130       }
79131       var prerequisiteTag = field.prerequisiteTag;
79132       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
79133       prerequisiteTag) {
79134         if (!entityIDs.every(function(entityID) {
79135           var entity = context.graph().entity(entityID);
79136           if (prerequisiteTag.key) {
79137             var value = entity.tags[prerequisiteTag.key];
79138             if (!value) return false;
79139             if (prerequisiteTag.valueNot) {
79140               return prerequisiteTag.valueNot !== value;
79141             }
79142             if (prerequisiteTag.value) {
79143               return prerequisiteTag.value === value;
79144             }
79145           } else if (prerequisiteTag.keyNot) {
79146             if (entity.tags[prerequisiteTag.keyNot]) return false;
79147           }
79148           return true;
79149         })) return false;
79150       }
79151       return true;
79152     };
79153     field.focus = function() {
79154       if (field.impl) {
79155         field.impl.focus();
79156       }
79157     };
79158     return utilRebind(field, dispatch14, "on");
79159   }
79160   var init_field2 = __esm({
79161     "modules/ui/field.js"() {
79162       "use strict";
79163       init_src4();
79164       init_src5();
79165       init_localizer();
79166       init_LocationManager();
79167       init_icon();
79168       init_tooltip();
79169       init_extent();
79170       init_field_help();
79171       init_fields();
79172       init_localized();
79173       init_tag_reference();
79174       init_util();
79175     }
79176   });
79177
79178   // modules/ui/changeset_editor.js
79179   var changeset_editor_exports = {};
79180   __export(changeset_editor_exports, {
79181     uiChangesetEditor: () => uiChangesetEditor
79182   });
79183   function uiChangesetEditor(context) {
79184     var dispatch14 = dispatch_default("change");
79185     var formFields = uiFormFields(context);
79186     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
79187     var _fieldsArr;
79188     var _tags;
79189     var _changesetID;
79190     function changesetEditor(selection2) {
79191       render(selection2);
79192     }
79193     function render(selection2) {
79194       var _a3;
79195       var initial = false;
79196       if (!_fieldsArr) {
79197         initial = true;
79198         var presets = _mainPresetIndex;
79199         _fieldsArr = [
79200           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
79201           uiField(context, presets.field("source"), null, { show: true, revert: false }),
79202           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
79203         ];
79204         _fieldsArr.forEach(function(field) {
79205           field.on("change", function(t2, onInput) {
79206             dispatch14.call("change", field, void 0, t2, onInput);
79207           });
79208         });
79209       }
79210       _fieldsArr.forEach(function(field) {
79211         field.tags(_tags);
79212       });
79213       selection2.call(formFields.fieldsArr(_fieldsArr));
79214       if (initial) {
79215         var commentField = selection2.select(".form-field-comment textarea");
79216         const sourceField = _fieldsArr.find((field) => field.id === "source");
79217         var commentNode = commentField.node();
79218         if (commentNode) {
79219           commentNode.focus();
79220           commentNode.select();
79221         }
79222         utilTriggerEvent(commentField, "blur");
79223         var osm = context.connection();
79224         if (osm) {
79225           osm.userChangesets(function(err, changesets) {
79226             if (err) return;
79227             var comments = changesets.map(function(changeset) {
79228               var comment = changeset.tags.comment;
79229               return comment ? { title: comment, value: comment } : null;
79230             }).filter(Boolean);
79231             commentField.call(
79232               commentCombo.data(utilArrayUniqBy(comments, "title"))
79233             );
79234             const recentSources = changesets.flatMap((changeset) => {
79235               var _a4;
79236               return (_a4 = changeset.tags.source) == null ? void 0 : _a4.split(";");
79237             }).filter((value) => !sourceField.options.includes(value)).filter(Boolean).map((title) => ({ title, value: title, klass: "raw-option" }));
79238             sourceField.impl.setCustomOptions(utilArrayUniqBy(recentSources, "title"));
79239           });
79240         }
79241       }
79242       const warnings = [];
79243       if ((_a3 = _tags.comment) == null ? void 0 : _a3.match(/google/i)) {
79244         warnings.push({
79245           id: 'contains "google"',
79246           msg: _t.append("commit.google_warning"),
79247           link: _t("commit.google_warning_link")
79248         });
79249       }
79250       const maxChars = context.maxCharsForTagValue();
79251       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
79252       if (strLen > maxChars || false) {
79253         warnings.push({
79254           id: "message too long",
79255           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
79256         });
79257       }
79258       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
79259       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
79260       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
79261       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
79262       commentEnter.transition().duration(200).style("opacity", 1);
79263       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
79264         let selection3 = select_default2(this);
79265         if (d2.link) {
79266           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
79267         }
79268         selection3.call(d2.msg);
79269       });
79270     }
79271     changesetEditor.tags = function(_2) {
79272       if (!arguments.length) return _tags;
79273       _tags = _2;
79274       return changesetEditor;
79275     };
79276     changesetEditor.changesetID = function(_2) {
79277       if (!arguments.length) return _changesetID;
79278       if (_changesetID === _2) return changesetEditor;
79279       _changesetID = _2;
79280       _fieldsArr = null;
79281       return changesetEditor;
79282     };
79283     return utilRebind(changesetEditor, dispatch14, "on");
79284   }
79285   var init_changeset_editor = __esm({
79286     "modules/ui/changeset_editor.js"() {
79287       "use strict";
79288       init_src4();
79289       init_src5();
79290       init_presets();
79291       init_localizer();
79292       init_icon();
79293       init_combobox();
79294       init_field2();
79295       init_form_fields();
79296       init_util();
79297     }
79298   });
79299
79300   // modules/ui/sections/changes.js
79301   var changes_exports = {};
79302   __export(changes_exports, {
79303     uiSectionChanges: () => uiSectionChanges
79304   });
79305   function uiSectionChanges(context) {
79306     var _discardTags = {};
79307     _mainFileFetcher.get("discarded").then(function(d2) {
79308       _discardTags = d2;
79309     }).catch(function() {
79310     });
79311     var section = uiSection("changes-list", context).label(function() {
79312       var history = context.history();
79313       var summary = history.difference().summary();
79314       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
79315     }).disclosureContent(renderDisclosureContent);
79316     function renderDisclosureContent(selection2) {
79317       var history = context.history();
79318       var summary = history.difference().summary();
79319       var container = selection2.selectAll(".commit-section").data([0]);
79320       var containerEnter = container.enter().append("div").attr("class", "commit-section");
79321       containerEnter.append("ul").attr("class", "changeset-list");
79322       container = containerEnter.merge(container);
79323       var items = container.select("ul").selectAll("li").data(summary);
79324       var itemsEnter = items.enter().append("li").attr("class", "change-item");
79325       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
79326       buttons.each(function(d2) {
79327         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
79328       });
79329       buttons.append("span").attr("class", "change-type").html(function(d2) {
79330         return _t.html("commit." + d2.changeType) + " ";
79331       });
79332       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
79333         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
79334         return matched && matched.name() || utilDisplayType(d2.entity.id);
79335       });
79336       buttons.append("span").attr("class", "entity-name").text(function(d2) {
79337         var name = utilDisplayName(d2.entity) || "", string = "";
79338         if (name !== "") {
79339           string += ":";
79340         }
79341         return string += " " + name;
79342       });
79343       items = itemsEnter.merge(items);
79344       var changeset = new osmChangeset().update({ id: void 0 });
79345       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
79346       delete changeset.id;
79347       var data = JXON.stringify(changeset.osmChangeJXON(changes));
79348       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
79349       var fileName = "changes.osc";
79350       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
79351       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
79352       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
79353       function mouseover(d3_event, d2) {
79354         if (d2.entity) {
79355           context.surface().selectAll(
79356             utilEntityOrMemberSelector([d2.entity.id], context.graph())
79357           ).classed("hover", true);
79358         }
79359       }
79360       function mouseout() {
79361         context.surface().selectAll(".hover").classed("hover", false);
79362       }
79363       function click(d3_event, change) {
79364         if (change.changeType !== "deleted") {
79365           var entity = change.entity;
79366           context.map().zoomToEase(entity);
79367           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
79368         }
79369       }
79370     }
79371     return section;
79372   }
79373   var init_changes = __esm({
79374     "modules/ui/sections/changes.js"() {
79375       "use strict";
79376       init_src5();
79377       init_presets();
79378       init_file_fetcher();
79379       init_localizer();
79380       init_jxon();
79381       init_discard_tags();
79382       init_osm();
79383       init_icon();
79384       init_section();
79385       init_util();
79386     }
79387   });
79388
79389   // modules/ui/commit.js
79390   var commit_exports = {};
79391   __export(commit_exports, {
79392     uiCommit: () => uiCommit
79393   });
79394   function uiCommit(context) {
79395     var dispatch14 = dispatch_default("cancel");
79396     var _userDetails2;
79397     var _selection;
79398     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
79399     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
79400     var commitChanges = uiSectionChanges(context);
79401     var commitWarnings = uiCommitWarnings(context);
79402     function commit(selection2) {
79403       _selection = selection2;
79404       if (!context.changeset) initChangeset();
79405       loadDerivedChangesetTags();
79406       selection2.call(render);
79407     }
79408     function initChangeset() {
79409       var commentDate = +corePreferences("commentDate") || 0;
79410       var currDate = Date.now();
79411       var cutoff = 2 * 86400 * 1e3;
79412       if (commentDate > currDate || currDate - commentDate > cutoff) {
79413         corePreferences("comment", null);
79414         corePreferences("hashtags", null);
79415         corePreferences("source", null);
79416       }
79417       if (context.defaultChangesetComment()) {
79418         corePreferences("comment", context.defaultChangesetComment());
79419         corePreferences("commentDate", Date.now());
79420       }
79421       if (context.defaultChangesetSource()) {
79422         corePreferences("source", context.defaultChangesetSource());
79423         corePreferences("commentDate", Date.now());
79424       }
79425       if (context.defaultChangesetHashtags()) {
79426         corePreferences("hashtags", context.defaultChangesetHashtags());
79427         corePreferences("commentDate", Date.now());
79428       }
79429       var detected = utilDetect();
79430       var tags = {
79431         comment: corePreferences("comment") || "",
79432         created_by: context.cleanTagValue("iD " + context.version),
79433         host: context.cleanTagValue(detected.host),
79434         locale: context.cleanTagValue(_mainLocalizer.localeCode())
79435       };
79436       findHashtags(tags, true);
79437       var hashtags = corePreferences("hashtags");
79438       if (hashtags) {
79439         tags.hashtags = hashtags;
79440       }
79441       var source = corePreferences("source");
79442       if (source) {
79443         tags.source = source;
79444       }
79445       var photoOverlaysUsed = context.history().photoOverlaysUsed();
79446       if (photoOverlaysUsed.length) {
79447         var sources = (tags.source || "").split(";");
79448         if (sources.indexOf("streetlevel imagery") === -1) {
79449           sources.push("streetlevel imagery");
79450         }
79451         photoOverlaysUsed.forEach(function(photoOverlay) {
79452           if (sources.indexOf(photoOverlay) === -1) {
79453             sources.push(photoOverlay);
79454           }
79455         });
79456         tags.source = context.cleanTagValue(sources.filter(Boolean).join(";"));
79457       }
79458       context.changeset = new osmChangeset({ tags });
79459     }
79460     function loadDerivedChangesetTags() {
79461       var osm = context.connection();
79462       if (!osm) return;
79463       var tags = Object.assign({}, context.changeset.tags);
79464       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
79465       tags.imagery_used = imageryUsed || "None";
79466       var osmClosed = osm.getClosedIDs();
79467       var itemType;
79468       if (osmClosed.length) {
79469         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
79470       }
79471       if (services.keepRight) {
79472         var krClosed = services.keepRight.getClosedIDs();
79473         if (krClosed.length) {
79474           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
79475         }
79476       }
79477       if (services.osmose) {
79478         var osmoseClosed = services.osmose.getClosedCounts();
79479         for (itemType in osmoseClosed) {
79480           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
79481         }
79482       }
79483       for (var key in tags) {
79484         if (key.match(/(^warnings:)|(^resolved:)/)) {
79485           delete tags[key];
79486         }
79487       }
79488       function addIssueCounts(issues, prefix) {
79489         var issuesByType = utilArrayGroupBy(issues, "type");
79490         for (var issueType in issuesByType) {
79491           var issuesOfType = issuesByType[issueType];
79492           if (issuesOfType[0].subtype) {
79493             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
79494             for (var issueSubtype in issuesBySubtype) {
79495               var issuesOfSubtype = issuesBySubtype[issueSubtype];
79496               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
79497             }
79498           } else {
79499             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
79500           }
79501         }
79502       }
79503       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
79504         return issue.type !== "help_request";
79505       });
79506       addIssueCounts(warnings, "warnings");
79507       var resolvedIssues = context.validator().getResolvedIssues();
79508       addIssueCounts(resolvedIssues, "resolved");
79509       context.changeset = context.changeset.update({ tags });
79510     }
79511     function render(selection2) {
79512       var osm = context.connection();
79513       if (!osm) return;
79514       var header = selection2.selectAll(".header").data([0]);
79515       var headerTitle = header.enter().append("div").attr("class", "header fillL");
79516       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
79517       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
79518         dispatch14.call("cancel", this);
79519       }).call(svgIcon("#iD-icon-close"));
79520       var body = selection2.selectAll(".body").data([0]);
79521       body = body.enter().append("div").attr("class", "body").merge(body);
79522       var changesetSection = body.selectAll(".changeset-editor").data([0]);
79523       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
79524       changesetSection.call(
79525         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
79526       );
79527       body.call(commitWarnings);
79528       var saveSection = body.selectAll(".save-section").data([0]);
79529       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
79530       var prose = saveSection.selectAll(".commit-info").data([0]);
79531       if (prose.enter().size()) {
79532         _userDetails2 = null;
79533       }
79534       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
79535       osm.userDetails(function(err, user) {
79536         if (err) return;
79537         if (_userDetails2 === user) return;
79538         _userDetails2 = user;
79539         var userLink = select_default2(document.createElement("div"));
79540         if (user.image_url) {
79541           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
79542         }
79543         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
79544         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
79545       });
79546       var requestReview = saveSection.selectAll(".request-review").data([0]);
79547       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
79548       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
79549       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
79550       if (!labelEnter.empty()) {
79551         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
79552       }
79553       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
79554       labelEnter.append("span").call(_t.append("commit.request_review"));
79555       requestReview = requestReview.merge(requestReviewEnter);
79556       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
79557       var buttonSection = saveSection.selectAll(".buttons").data([0]);
79558       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
79559       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
79560       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
79561       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
79562       var uploadBlockerTooltipText = getUploadBlockerMessage();
79563       buttonSection = buttonSection.merge(buttonEnter);
79564       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
79565         dispatch14.call("cancel", this);
79566       });
79567       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
79568         if (!select_default2(this).classed("disabled")) {
79569           this.blur();
79570           for (var key in context.changeset.tags) {
79571             if (!key) delete context.changeset.tags[key];
79572           }
79573           context.uploader().save(context.changeset);
79574         }
79575       });
79576       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
79577       if (uploadBlockerTooltipText) {
79578         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
79579       }
79580       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
79581       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
79582       tagSection.call(
79583         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
79584       );
79585       var changesSection = body.selectAll(".commit-changes-section").data([0]);
79586       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
79587       changesSection.call(commitChanges.render);
79588       function toggleRequestReview() {
79589         var rr = requestReviewInput.property("checked");
79590         updateChangeset({ review_requested: rr ? "yes" : void 0 });
79591         tagSection.call(
79592           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
79593         );
79594       }
79595     }
79596     function getUploadBlockerMessage() {
79597       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
79598       if (errors.length) {
79599         return _t.append("commit.outstanding_errors_message", { count: errors.length });
79600       } else {
79601         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
79602         if (!hasChangesetComment) {
79603           return _t.append("commit.comment_needed_message");
79604         }
79605       }
79606       return null;
79607     }
79608     function changeTags(_2, changed, onInput) {
79609       if (changed.hasOwnProperty("comment")) {
79610         if (!onInput) {
79611           corePreferences("comment", changed.comment);
79612           corePreferences("commentDate", Date.now());
79613         }
79614       }
79615       if (changed.hasOwnProperty("source")) {
79616         if (changed.source === void 0) {
79617           corePreferences("source", null);
79618         } else if (!onInput) {
79619           corePreferences("source", changed.source);
79620           corePreferences("commentDate", Date.now());
79621         }
79622       }
79623       updateChangeset(changed, onInput);
79624       if (_selection) {
79625         _selection.call(render);
79626       }
79627     }
79628     function findHashtags(tags, commentOnly) {
79629       var detectedHashtags = commentHashtags();
79630       if (detectedHashtags.length) {
79631         corePreferences("hashtags", null);
79632       }
79633       if (!detectedHashtags.length || !commentOnly) {
79634         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
79635       }
79636       var allLowerCase = /* @__PURE__ */ new Set();
79637       return detectedHashtags.filter(function(hashtag) {
79638         var lowerCase = hashtag.toLowerCase();
79639         if (!allLowerCase.has(lowerCase)) {
79640           allLowerCase.add(lowerCase);
79641           return true;
79642         }
79643         return false;
79644       });
79645       function commentHashtags() {
79646         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
79647         return matches || [];
79648       }
79649       function hashtagHashtags() {
79650         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
79651           if (s2[0] !== "#") {
79652             s2 = "#" + s2;
79653           }
79654           var matched = s2.match(hashtagRegex);
79655           return matched && matched[0];
79656         }).filter(Boolean);
79657         return matches || [];
79658       }
79659     }
79660     function isReviewRequested(tags) {
79661       var rr = tags.review_requested;
79662       if (rr === void 0) return false;
79663       rr = rr.trim().toLowerCase();
79664       return !(rr === "" || rr === "no");
79665     }
79666     function updateChangeset(changed, onInput) {
79667       var tags = Object.assign({}, context.changeset.tags);
79668       Object.keys(changed).forEach(function(k2) {
79669         var v2 = changed[k2];
79670         k2 = context.cleanTagKey(k2);
79671         if (readOnlyTags.indexOf(k2) !== -1) return;
79672         if (v2 === void 0) {
79673           delete tags[k2];
79674         } else if (onInput) {
79675           tags[k2] = v2;
79676         } else {
79677           tags[k2] = context.cleanTagValue(v2);
79678         }
79679       });
79680       if (!onInput) {
79681         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
79682         var arr = findHashtags(tags, commentOnly);
79683         if (arr.length) {
79684           tags.hashtags = context.cleanTagValue(arr.join(";"));
79685           corePreferences("hashtags", tags.hashtags);
79686         } else {
79687           delete tags.hashtags;
79688           corePreferences("hashtags", null);
79689         }
79690       }
79691       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
79692         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
79693         tags.changesets_count = String(changesetsCount);
79694         if (changesetsCount <= 100) {
79695           var s2;
79696           s2 = corePreferences("walkthrough_completed");
79697           if (s2) {
79698             tags["ideditor:walkthrough_completed"] = s2;
79699           }
79700           s2 = corePreferences("walkthrough_progress");
79701           if (s2) {
79702             tags["ideditor:walkthrough_progress"] = s2;
79703           }
79704           s2 = corePreferences("walkthrough_started");
79705           if (s2) {
79706             tags["ideditor:walkthrough_started"] = s2;
79707           }
79708         }
79709       } else {
79710         delete tags.changesets_count;
79711       }
79712       if (!(0, import_fast_deep_equal10.default)(context.changeset.tags, tags)) {
79713         context.changeset = context.changeset.update({ tags });
79714       }
79715     }
79716     commit.reset = function() {
79717       context.changeset = null;
79718     };
79719     return utilRebind(commit, dispatch14, "on");
79720   }
79721   var import_fast_deep_equal10, readOnlyTags, hashtagRegex;
79722   var init_commit = __esm({
79723     "modules/ui/commit.js"() {
79724       "use strict";
79725       init_src4();
79726       init_src5();
79727       import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
79728       init_preferences();
79729       init_localizer();
79730       init_osm();
79731       init_icon();
79732       init_services();
79733       init_tooltip();
79734       init_changeset_editor();
79735       init_changes();
79736       init_commit_warnings();
79737       init_raw_tag_editor();
79738       init_util();
79739       init_detect();
79740       readOnlyTags = [
79741         /^changesets_count$/,
79742         /^created_by$/,
79743         /^ideditor:/,
79744         /^imagery_used$/,
79745         /^host$/,
79746         /^locale$/,
79747         /^warnings:/,
79748         /^resolved:/,
79749         /^closed:note$/,
79750         /^closed:keepright$/,
79751         /^closed:osmose:/
79752       ];
79753       hashtagRegex = /([##][^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
79754     }
79755   });
79756
79757   // modules/modes/save.js
79758   var save_exports2 = {};
79759   __export(save_exports2, {
79760     modeSave: () => modeSave
79761   });
79762   function modeSave(context) {
79763     var mode = { id: "save" };
79764     var keybinding = utilKeybinding("modeSave");
79765     var commit = uiCommit(context).on("cancel", cancel);
79766     var _conflictsUi;
79767     var _location;
79768     var _success;
79769     var uploader = context.uploader().on("saveStarted.modeSave", function() {
79770       keybindingOff();
79771     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
79772       cancel();
79773     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
79774     function cancel() {
79775       context.enter(modeBrowse(context));
79776     }
79777     function showProgress(num, total) {
79778       var modal = context.container().select(".loading-modal .modal-section");
79779       var progress = modal.selectAll(".progress").data([0]);
79780       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
79781     }
79782     function showConflicts(changeset, conflicts, origChanges) {
79783       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
79784       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
79785       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
79786         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79787         selection2.remove();
79788         keybindingOn();
79789         uploader.cancelConflictResolution();
79790       }).on("save", function() {
79791         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79792         selection2.remove();
79793         uploader.processResolvedConflicts(changeset);
79794       });
79795       selection2.call(_conflictsUi);
79796     }
79797     function showErrors(errors) {
79798       keybindingOn();
79799       var selection2 = uiConfirm(context.container());
79800       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
79801       addErrors(selection2, errors);
79802       selection2.okButton();
79803     }
79804     function addErrors(selection2, data) {
79805       var message = selection2.select(".modal-section.message-text");
79806       var items = message.selectAll(".error-container").data(data);
79807       var enter = items.enter().append("div").attr("class", "error-container");
79808       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
79809         return d2.msg || _t("save.unknown_error_details");
79810       }).on("click", function(d3_event) {
79811         d3_event.preventDefault();
79812         var error = select_default2(this);
79813         var detail = select_default2(this.nextElementSibling);
79814         var exp2 = error.classed("expanded");
79815         detail.style("display", exp2 ? "none" : "block");
79816         error.classed("expanded", !exp2);
79817       });
79818       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
79819       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
79820         return d2.details || [];
79821       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
79822         return d2;
79823       });
79824       items.exit().remove();
79825     }
79826     function showSuccess(changeset) {
79827       commit.reset();
79828       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
79829         context.ui().sidebar.hide();
79830       });
79831       context.enter(modeBrowse(context).sidebar(ui));
79832     }
79833     function keybindingOn() {
79834       select_default2(document).call(keybinding.on("\u238B", cancel, true));
79835     }
79836     function keybindingOff() {
79837       select_default2(document).call(keybinding.unbind);
79838     }
79839     function prepareForSuccess() {
79840       _success = uiSuccess(context);
79841       _location = null;
79842       if (!services.geocoder) return;
79843       services.geocoder.reverse(context.map().center(), function(err, result) {
79844         if (err || !result || !result.address) return;
79845         var addr = result.address;
79846         var place = addr && (addr.town || addr.city || addr.county) || "";
79847         var region = addr && (addr.state || addr.country) || "";
79848         var separator = place && region ? _t("success.thank_you_where.separator") : "";
79849         _location = _t(
79850           "success.thank_you_where.format",
79851           { place, separator, region }
79852         );
79853       });
79854     }
79855     mode.selectedIDs = function() {
79856       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
79857     };
79858     mode.enter = function() {
79859       context.ui().sidebar.expand();
79860       function done() {
79861         context.ui().sidebar.show(commit);
79862       }
79863       keybindingOn();
79864       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
79865       var osm = context.connection();
79866       if (!osm) {
79867         cancel();
79868         return;
79869       }
79870       if (osm.authenticated()) {
79871         done();
79872       } else {
79873         osm.authenticate(function(err) {
79874           if (err) {
79875             cancel();
79876           } else {
79877             done();
79878           }
79879         });
79880       }
79881     };
79882     mode.exit = function() {
79883       keybindingOff();
79884       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
79885       context.ui().sidebar.hide();
79886     };
79887     return mode;
79888   }
79889   var init_save2 = __esm({
79890     "modules/modes/save.js"() {
79891       "use strict";
79892       init_src5();
79893       init_localizer();
79894       init_browse();
79895       init_services();
79896       init_conflicts();
79897       init_confirm();
79898       init_commit();
79899       init_success();
79900       init_util();
79901     }
79902   });
79903
79904   // modules/modes/select_error.js
79905   var select_error_exports = {};
79906   __export(select_error_exports, {
79907     modeSelectError: () => modeSelectError
79908   });
79909   function modeSelectError(context, selectedErrorID, selectedErrorService) {
79910     var mode = {
79911       id: "select-error",
79912       button: "browse"
79913     };
79914     var keybinding = utilKeybinding("select-error");
79915     var errorService = services[selectedErrorService];
79916     var errorEditor;
79917     switch (selectedErrorService) {
79918       case "keepRight":
79919         errorEditor = uiKeepRightEditor(context).on("change", function() {
79920           context.map().pan([0, 0]);
79921           var error = checkSelectedID();
79922           if (!error) return;
79923           context.ui().sidebar.show(errorEditor.error(error));
79924         });
79925         break;
79926       case "osmose":
79927         errorEditor = uiOsmoseEditor(context).on("change", function() {
79928           context.map().pan([0, 0]);
79929           var error = checkSelectedID();
79930           if (!error) return;
79931           context.ui().sidebar.show(errorEditor.error(error));
79932         });
79933         break;
79934     }
79935     var behaviors = [
79936       behaviorBreathe(context),
79937       behaviorHover(context),
79938       behaviorSelect(context),
79939       behaviorLasso(context),
79940       modeDragNode(context).behavior,
79941       modeDragNote(context).behavior
79942     ];
79943     function checkSelectedID() {
79944       if (!errorService) return;
79945       var error = errorService.getError(selectedErrorID);
79946       if (!error) {
79947         context.enter(modeBrowse(context));
79948       }
79949       return error;
79950     }
79951     mode.zoomToSelected = function() {
79952       if (!errorService) return;
79953       var error = errorService.getError(selectedErrorID);
79954       if (error) {
79955         context.map().centerZoomEase(error.loc, 20);
79956       }
79957     };
79958     mode.enter = function() {
79959       var error = checkSelectedID();
79960       if (!error) return;
79961       behaviors.forEach(context.install);
79962       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
79963       select_default2(document).call(keybinding);
79964       selectError();
79965       var sidebar = context.ui().sidebar;
79966       sidebar.show(errorEditor.error(error));
79967       context.map().on("drawn.select-error", selectError);
79968       function selectError(d3_event, drawn) {
79969         if (!checkSelectedID()) return;
79970         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
79971         if (selection2.empty()) {
79972           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
79973           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
79974             context.enter(modeBrowse(context));
79975           }
79976         } else {
79977           selection2.classed("selected", true);
79978           context.selectedErrorID(selectedErrorID);
79979         }
79980       }
79981       function esc() {
79982         if (context.container().select(".combobox").size()) return;
79983         context.enter(modeBrowse(context));
79984       }
79985     };
79986     mode.exit = function() {
79987       behaviors.forEach(context.uninstall);
79988       select_default2(document).call(keybinding.unbind);
79989       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
79990       context.map().on("drawn.select-error", null);
79991       context.ui().sidebar.hide();
79992       context.selectedErrorID(null);
79993       context.features().forceVisible([]);
79994     };
79995     return mode;
79996   }
79997   var init_select_error = __esm({
79998     "modules/modes/select_error.js"() {
79999       "use strict";
80000       init_src5();
80001       init_breathe();
80002       init_hover();
80003       init_lasso2();
80004       init_select4();
80005       init_localizer();
80006       init_services();
80007       init_browse();
80008       init_drag_node();
80009       init_drag_note();
80010       init_keepRight_editor();
80011       init_osmose_editor();
80012       init_util();
80013     }
80014   });
80015
80016   // modules/modes/index.js
80017   var modes_exports2 = {};
80018   __export(modes_exports2, {
80019     modeAddArea: () => modeAddArea,
80020     modeAddLine: () => modeAddLine,
80021     modeAddNote: () => modeAddNote,
80022     modeAddPoint: () => modeAddPoint,
80023     modeBrowse: () => modeBrowse,
80024     modeDragNode: () => modeDragNode,
80025     modeDragNote: () => modeDragNote,
80026     modeDrawArea: () => modeDrawArea,
80027     modeDrawLine: () => modeDrawLine,
80028     modeMove: () => modeMove,
80029     modeRotate: () => modeRotate,
80030     modeSave: () => modeSave,
80031     modeSelect: () => modeSelect,
80032     modeSelectData: () => modeSelectData,
80033     modeSelectError: () => modeSelectError,
80034     modeSelectNote: () => modeSelectNote
80035   });
80036   var init_modes2 = __esm({
80037     "modules/modes/index.js"() {
80038       "use strict";
80039       init_add_area();
80040       init_add_line();
80041       init_add_point();
80042       init_add_note();
80043       init_browse();
80044       init_drag_node();
80045       init_drag_note();
80046       init_draw_area();
80047       init_draw_line();
80048       init_move3();
80049       init_rotate2();
80050       init_save2();
80051       init_select5();
80052       init_select_data();
80053       init_select_error();
80054       init_select_note();
80055     }
80056   });
80057
80058   // modules/core/context.js
80059   var context_exports = {};
80060   __export(context_exports, {
80061     coreContext: () => coreContext
80062   });
80063   function coreContext() {
80064     const dispatch14 = dispatch_default("enter", "exit", "change");
80065     const context = {};
80066     let _deferred2 = /* @__PURE__ */ new Set();
80067     context.version = package_default.version;
80068     context.privacyVersion = "20201202";
80069     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
80070     context.changeset = null;
80071     let _defaultChangesetComment = context.initialHashParams.comment;
80072     let _defaultChangesetSource = context.initialHashParams.source;
80073     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
80074     context.defaultChangesetComment = function(val) {
80075       if (!arguments.length) return _defaultChangesetComment;
80076       _defaultChangesetComment = val;
80077       return context;
80078     };
80079     context.defaultChangesetSource = function(val) {
80080       if (!arguments.length) return _defaultChangesetSource;
80081       _defaultChangesetSource = val;
80082       return context;
80083     };
80084     context.defaultChangesetHashtags = function(val) {
80085       if (!arguments.length) return _defaultChangesetHashtags;
80086       _defaultChangesetHashtags = val;
80087       return context;
80088     };
80089     let _setsDocumentTitle = true;
80090     context.setsDocumentTitle = function(val) {
80091       if (!arguments.length) return _setsDocumentTitle;
80092       _setsDocumentTitle = val;
80093       return context;
80094     };
80095     let _documentTitleBase = document.title;
80096     context.documentTitleBase = function(val) {
80097       if (!arguments.length) return _documentTitleBase;
80098       _documentTitleBase = val;
80099       return context;
80100     };
80101     let _ui;
80102     context.ui = () => _ui;
80103     context.lastPointerType = () => _ui.lastPointerType();
80104     let _keybinding = utilKeybinding("context");
80105     context.keybinding = () => _keybinding;
80106     select_default2(document).call(_keybinding);
80107     let _connection = services.osm;
80108     let _history;
80109     let _validator;
80110     let _uploader;
80111     context.connection = () => _connection;
80112     context.history = () => _history;
80113     context.validator = () => _validator;
80114     context.uploader = () => _uploader;
80115     context.preauth = (options2) => {
80116       if (_connection) {
80117         _connection.switch(options2);
80118       }
80119       return context;
80120     };
80121     context.locale = function(locale3) {
80122       if (!arguments.length) return _mainLocalizer.localeCode();
80123       _mainLocalizer.preferredLocaleCodes(locale3);
80124       return context;
80125     };
80126     function afterLoad(cid, callback) {
80127       return (err, result) => {
80128         if (err) {
80129           if (typeof callback === "function") {
80130             callback(err);
80131           }
80132           return;
80133         } else if (_connection && _connection.getConnectionId() !== cid) {
80134           if (typeof callback === "function") {
80135             callback({ message: "Connection Switched", status: -1 });
80136           }
80137           return;
80138         } else {
80139           _history.merge(result.data, result.extent);
80140           if (typeof callback === "function") {
80141             callback(err, result);
80142           }
80143           return;
80144         }
80145       };
80146     }
80147     context.loadTiles = (projection2, callback) => {
80148       const handle = window.requestIdleCallback(() => {
80149         _deferred2.delete(handle);
80150         if (_connection && context.editableDataEnabled()) {
80151           const cid = _connection.getConnectionId();
80152           _connection.loadTiles(projection2, afterLoad(cid, callback));
80153         }
80154       });
80155       _deferred2.add(handle);
80156     };
80157     context.loadTileAtLoc = (loc, callback) => {
80158       const handle = window.requestIdleCallback(() => {
80159         _deferred2.delete(handle);
80160         if (_connection && context.editableDataEnabled()) {
80161           const cid = _connection.getConnectionId();
80162           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
80163         }
80164       });
80165       _deferred2.add(handle);
80166     };
80167     context.loadEntity = (entityID, callback) => {
80168       if (_connection) {
80169         const cid = _connection.getConnectionId();
80170         _connection.loadEntity(entityID, afterLoad(cid, callback));
80171         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
80172       }
80173     };
80174     context.loadNote = (entityID, callback) => {
80175       if (_connection) {
80176         const cid = _connection.getConnectionId();
80177         _connection.loadEntityNote(entityID, afterLoad(cid, callback));
80178       }
80179     };
80180     context.zoomToEntity = (entityID, zoomTo) => {
80181       context.zoomToEntities([entityID], zoomTo);
80182     };
80183     context.zoomToEntities = (entityIDs, zoomTo) => {
80184       let loadedEntities = [];
80185       const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
80186       entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
80187         if (err) return;
80188         const entity = result.data.find((e3) => e3.id === entityID);
80189         if (!entity) return;
80190         loadedEntities.push(entity);
80191         if (zoomTo !== false) {
80192           throttledZoomTo();
80193         }
80194       }));
80195       _map.on("drawn.zoomToEntity", () => {
80196         if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
80197         _map.on("drawn.zoomToEntity", null);
80198         context.on("enter.zoomToEntity", null);
80199         context.enter(modeSelect(context, entityIDs));
80200       });
80201       context.on("enter.zoomToEntity", () => {
80202         if (_mode.id !== "browse") {
80203           _map.on("drawn.zoomToEntity", null);
80204           context.on("enter.zoomToEntity", null);
80205         }
80206       });
80207     };
80208     context.moveToNote = (noteId, moveTo) => {
80209       context.loadNote(noteId, (err, result) => {
80210         if (err) return;
80211         const entity = result.data.find((e3) => e3.id === noteId);
80212         if (!entity) return;
80213         const note = services.osm.getNote(noteId);
80214         if (moveTo !== false) {
80215           context.map().center(note.loc);
80216         }
80217         const noteLayer = context.layers().layer("notes");
80218         noteLayer.enabled(true);
80219         context.enter(modeSelectNote(context, noteId));
80220       });
80221     };
80222     let _minEditableZoom = 16;
80223     context.minEditableZoom = function(val) {
80224       if (!arguments.length) return _minEditableZoom;
80225       _minEditableZoom = val;
80226       if (_connection) {
80227         _connection.tileZoom(val);
80228       }
80229       return context;
80230     };
80231     context.maxCharsForTagKey = () => 255;
80232     context.maxCharsForTagValue = () => 255;
80233     context.maxCharsForRelationRole = () => 255;
80234     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
80235     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
80236     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
80237     let _inIntro = false;
80238     context.inIntro = function(val) {
80239       if (!arguments.length) return _inIntro;
80240       _inIntro = val;
80241       return context;
80242     };
80243     context.save = () => {
80244       if (_inIntro || context.container().select(".modal").size()) return;
80245       let canSave;
80246       if (_mode && _mode.id === "save") {
80247         canSave = false;
80248         if (services.osm && services.osm.isChangesetInflight()) {
80249           _history.clearSaved();
80250           return;
80251         }
80252       } else {
80253         canSave = context.selectedIDs().every((id2) => {
80254           const entity = context.hasEntity(id2);
80255           return entity && !entity.isDegenerate();
80256         });
80257       }
80258       if (canSave) {
80259         _history.save();
80260       }
80261       if (_history.hasChanges()) {
80262         return _t("save.unsaved_changes");
80263       }
80264     };
80265     context.debouncedSave = debounce_default(context.save, 350);
80266     function withDebouncedSave(fn) {
80267       return function() {
80268         const result = fn.apply(_history, arguments);
80269         context.debouncedSave();
80270         return result;
80271       };
80272     }
80273     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
80274     context.entity = (id2) => _history.graph().entity(id2);
80275     let _mode;
80276     context.mode = () => _mode;
80277     context.enter = (newMode) => {
80278       if (_mode) {
80279         _mode.exit();
80280         dispatch14.call("exit", this, _mode);
80281       }
80282       _mode = newMode;
80283       _mode.enter();
80284       dispatch14.call("enter", this, _mode);
80285     };
80286     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
80287     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
80288     let _selectedNoteID;
80289     context.selectedNoteID = function(noteID) {
80290       if (!arguments.length) return _selectedNoteID;
80291       _selectedNoteID = noteID;
80292       return context;
80293     };
80294     let _selectedErrorID;
80295     context.selectedErrorID = function(errorID) {
80296       if (!arguments.length) return _selectedErrorID;
80297       _selectedErrorID = errorID;
80298       return context;
80299     };
80300     context.install = (behavior) => context.surface().call(behavior);
80301     context.uninstall = (behavior) => context.surface().call(behavior.off);
80302     let _copyGraph;
80303     context.copyGraph = () => _copyGraph;
80304     let _copyIDs = [];
80305     context.copyIDs = function(val) {
80306       if (!arguments.length) return _copyIDs;
80307       _copyIDs = val;
80308       _copyGraph = _history.graph();
80309       return context;
80310     };
80311     let _copyLonLat;
80312     context.copyLonLat = function(val) {
80313       if (!arguments.length) return _copyLonLat;
80314       _copyLonLat = val;
80315       return context;
80316     };
80317     let _background;
80318     context.background = () => _background;
80319     let _features;
80320     context.features = () => _features;
80321     context.hasHiddenConnections = (id2) => {
80322       const graph = _history.graph();
80323       const entity = graph.entity(id2);
80324       return _features.hasHiddenConnections(entity, graph);
80325     };
80326     let _photos;
80327     context.photos = () => _photos;
80328     let _map;
80329     context.map = () => _map;
80330     context.layers = () => _map.layers();
80331     context.surface = () => _map.surface;
80332     context.editableDataEnabled = () => _map.editableDataEnabled();
80333     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
80334     context.editable = () => {
80335       const mode = context.mode();
80336       if (!mode || mode.id === "save") return false;
80337       return _map.editableDataEnabled();
80338     };
80339     let _debugFlags = {
80340       tile: false,
80341       // tile boundaries
80342       collision: false,
80343       // label collision bounding boxes
80344       imagery: false,
80345       // imagery bounding polygons
80346       target: false,
80347       // touch targets
80348       downloaded: false
80349       // downloaded data from osm
80350     };
80351     context.debugFlags = () => _debugFlags;
80352     context.getDebug = (flag) => flag && _debugFlags[flag];
80353     context.setDebug = function(flag, val) {
80354       if (arguments.length === 1) val = true;
80355       _debugFlags[flag] = val;
80356       dispatch14.call("change");
80357       return context;
80358     };
80359     let _container = select_default2(null);
80360     context.container = function(val) {
80361       if (!arguments.length) return _container;
80362       _container = val;
80363       _container.classed("ideditor", true);
80364       return context;
80365     };
80366     context.containerNode = function(val) {
80367       if (!arguments.length) return context.container().node();
80368       context.container(select_default2(val));
80369       return context;
80370     };
80371     let _embed;
80372     context.embed = function(val) {
80373       if (!arguments.length) return _embed;
80374       _embed = val;
80375       return context;
80376     };
80377     let _assetPath = "";
80378     context.assetPath = function(val) {
80379       if (!arguments.length) return _assetPath;
80380       _assetPath = val;
80381       _mainFileFetcher.assetPath(val);
80382       return context;
80383     };
80384     let _assetMap = {};
80385     context.assetMap = function(val) {
80386       if (!arguments.length) return _assetMap;
80387       _assetMap = val;
80388       _mainFileFetcher.assetMap(val);
80389       return context;
80390     };
80391     context.asset = (val) => {
80392       if (/^http(s)?:\/\//i.test(val)) return val;
80393       const filename = _assetPath + val;
80394       return _assetMap[filename] || filename;
80395     };
80396     context.imagePath = (val) => context.asset(`img/${val}`);
80397     context.reset = context.flush = () => {
80398       context.debouncedSave.cancel();
80399       Array.from(_deferred2).forEach((handle) => {
80400         window.cancelIdleCallback(handle);
80401         _deferred2.delete(handle);
80402       });
80403       Object.values(services).forEach((service) => {
80404         if (service && typeof service.reset === "function") {
80405           service.reset(context);
80406         }
80407       });
80408       context.changeset = null;
80409       _validator.reset();
80410       _features.reset();
80411       _history.reset();
80412       _uploader.reset();
80413       context.container().select(".inspector-wrap *").remove();
80414       return context;
80415     };
80416     context.projection = geoRawMercator();
80417     context.curtainProjection = geoRawMercator();
80418     context.init = () => {
80419       instantiateInternal();
80420       initializeDependents();
80421       return context;
80422       function instantiateInternal() {
80423         _history = coreHistory(context);
80424         context.graph = _history.graph;
80425         context.pauseChangeDispatch = _history.pauseChangeDispatch;
80426         context.resumeChangeDispatch = _history.resumeChangeDispatch;
80427         context.perform = withDebouncedSave(_history.perform);
80428         context.replace = withDebouncedSave(_history.replace);
80429         context.pop = withDebouncedSave(_history.pop);
80430         context.overwrite = withDebouncedSave(_history.overwrite);
80431         context.undo = withDebouncedSave(_history.undo);
80432         context.redo = withDebouncedSave(_history.redo);
80433         _validator = coreValidator(context);
80434         _uploader = coreUploader(context);
80435         _background = rendererBackground(context);
80436         _features = rendererFeatures(context);
80437         _map = rendererMap(context);
80438         _photos = rendererPhotos(context);
80439         _ui = uiInit(context);
80440       }
80441       function initializeDependents() {
80442         if (context.initialHashParams.presets) {
80443           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
80444         }
80445         if (context.initialHashParams.locale) {
80446           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
80447         }
80448         _mainLocalizer.ensureLoaded();
80449         _mainPresetIndex.ensureLoaded();
80450         _background.ensureLoaded();
80451         Object.values(services).forEach((service) => {
80452           if (service && typeof service.init === "function") {
80453             service.init();
80454           }
80455         });
80456         _map.init();
80457         _validator.init();
80458         _features.init();
80459         if (services.maprules && context.initialHashParams.maprules) {
80460           json_default(context.initialHashParams.maprules).then((mapcss) => {
80461             services.maprules.init();
80462             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
80463           }).catch(() => {
80464           });
80465         }
80466         if (!context.container().empty()) {
80467           _ui.ensureLoaded().then(() => {
80468             _background.init();
80469             _photos.init();
80470           });
80471         }
80472       }
80473     };
80474     return utilRebind(context, dispatch14, "on");
80475   }
80476   var init_context2 = __esm({
80477     "modules/core/context.js"() {
80478       "use strict";
80479       init_debounce();
80480       init_throttle();
80481       init_src4();
80482       init_src18();
80483       init_src5();
80484       init_package();
80485       init_localizer();
80486       init_file_fetcher();
80487       init_localizer();
80488       init_history();
80489       init_validator();
80490       init_uploader();
80491       init_raw_mercator();
80492       init_modes2();
80493       init_presets();
80494       init_renderer();
80495       init_services();
80496       init_init2();
80497       init_util();
80498     }
80499   });
80500
80501   // modules/core/index.js
80502   var core_exports = {};
80503   __export(core_exports, {
80504     LocationManager: () => LocationManager,
80505     coreContext: () => coreContext,
80506     coreDifference: () => coreDifference,
80507     coreFileFetcher: () => coreFileFetcher,
80508     coreGraph: () => coreGraph,
80509     coreHistory: () => coreHistory,
80510     coreLocalizer: () => coreLocalizer,
80511     coreTree: () => coreTree,
80512     coreUploader: () => coreUploader,
80513     coreValidator: () => coreValidator,
80514     fileFetcher: () => _mainFileFetcher,
80515     localizer: () => _mainLocalizer,
80516     locationManager: () => _sharedLocationManager,
80517     prefs: () => corePreferences,
80518     t: () => _t
80519   });
80520   var init_core = __esm({
80521     "modules/core/index.js"() {
80522       "use strict";
80523       init_context2();
80524       init_file_fetcher();
80525       init_difference();
80526       init_graph();
80527       init_history();
80528       init_localizer();
80529       init_LocationManager();
80530       init_preferences();
80531       init_tree();
80532       init_uploader();
80533       init_validator();
80534     }
80535   });
80536
80537   // modules/services/nominatim.js
80538   var nominatim_exports = {};
80539   __export(nominatim_exports, {
80540     default: () => nominatim_default
80541   });
80542   var apibase, _inflight, _nominatimCache, nominatim_default;
80543   var init_nominatim = __esm({
80544     "modules/services/nominatim.js"() {
80545       "use strict";
80546       init_src18();
80547       init_rbush();
80548       init_geo2();
80549       init_util();
80550       init_core();
80551       init_id();
80552       apibase = nominatimApiUrl;
80553       _inflight = {};
80554       nominatim_default = {
80555         init: function() {
80556           _inflight = {};
80557           _nominatimCache = new RBush();
80558         },
80559         reset: function() {
80560           Object.values(_inflight).forEach(function(controller) {
80561             controller.abort();
80562           });
80563           _inflight = {};
80564           _nominatimCache = new RBush();
80565         },
80566         countryCode: function(location, callback) {
80567           this.reverse(location, function(err, result) {
80568             if (err) {
80569               return callback(err);
80570             } else if (result.address) {
80571               return callback(null, result.address.country_code);
80572             } else {
80573               return callback("Unable to geocode", null);
80574             }
80575           });
80576         },
80577         reverse: function(loc, callback) {
80578           var cached = _nominatimCache.search(
80579             { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
80580           );
80581           if (cached.length > 0) {
80582             if (callback) callback(null, cached[0].data);
80583             return;
80584           }
80585           var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
80586           var url = apibase + "reverse?" + utilQsString(params);
80587           if (_inflight[url]) return;
80588           var controller = new AbortController();
80589           _inflight[url] = controller;
80590           json_default(url, {
80591             signal: controller.signal,
80592             headers: {
80593               "Accept-Language": _mainLocalizer.localeCodes().join(",")
80594             }
80595           }).then(function(result) {
80596             delete _inflight[url];
80597             if (result && result.error) {
80598               throw new Error(result.error);
80599             }
80600             var extent = geoExtent(loc).padByMeters(200);
80601             _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
80602             if (callback) callback(null, result);
80603           }).catch(function(err) {
80604             delete _inflight[url];
80605             if (err.name === "AbortError") return;
80606             if (callback) callback(err.message);
80607           });
80608         },
80609         search: function(val, callback) {
80610           const params = {
80611             q: val,
80612             limit: 10,
80613             format: "json"
80614           };
80615           var url = apibase + "search?" + utilQsString(params);
80616           if (_inflight[url]) return;
80617           var controller = new AbortController();
80618           _inflight[url] = controller;
80619           json_default(url, {
80620             signal: controller.signal,
80621             headers: {
80622               "Accept-Language": _mainLocalizer.localeCodes().join(",")
80623             }
80624           }).then(function(result) {
80625             delete _inflight[url];
80626             if (result && result.error) {
80627               throw new Error(result.error);
80628             }
80629             if (callback) callback(null, result);
80630           }).catch(function(err) {
80631             delete _inflight[url];
80632             if (err.name === "AbortError") return;
80633             if (callback) callback(err.message);
80634           });
80635         }
80636       };
80637     }
80638   });
80639
80640   // node_modules/name-suggestion-index/lib/simplify.js
80641   function simplify2(str) {
80642     if (typeof str !== "string") return "";
80643     return import_diacritics2.default.remove(
80644       str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
80645     );
80646   }
80647   var import_diacritics2;
80648   var init_simplify2 = __esm({
80649     "node_modules/name-suggestion-index/lib/simplify.js"() {
80650       import_diacritics2 = __toESM(require_diacritics(), 1);
80651     }
80652   });
80653
80654   // node_modules/name-suggestion-index/config/matchGroups.json
80655   var matchGroups_default;
80656   var init_matchGroups = __esm({
80657     "node_modules/name-suggestion-index/config/matchGroups.json"() {
80658       matchGroups_default = {
80659         matchGroups: {
80660           adult_gaming_centre: [
80661             "amenity/casino",
80662             "amenity/gambling",
80663             "leisure/adult_gaming_centre"
80664           ],
80665           bar: [
80666             "amenity/bar",
80667             "amenity/pub",
80668             "amenity/restaurant"
80669           ],
80670           beauty: [
80671             "shop/beauty",
80672             "shop/hairdresser_supply"
80673           ],
80674           bed: [
80675             "shop/bed",
80676             "shop/furniture"
80677           ],
80678           beverages: [
80679             "shop/alcohol",
80680             "shop/beer",
80681             "shop/beverages",
80682             "shop/kiosk",
80683             "shop/wine"
80684           ],
80685           camping: [
80686             "tourism/camp_site",
80687             "tourism/caravan_site"
80688           ],
80689           car_parts: [
80690             "shop/car_parts",
80691             "shop/car_repair",
80692             "shop/tires",
80693             "shop/tyres"
80694           ],
80695           clinic: [
80696             "amenity/clinic",
80697             "amenity/doctors",
80698             "healthcare/clinic",
80699             "healthcare/laboratory",
80700             "healthcare/physiotherapist",
80701             "healthcare/sample_collection",
80702             "healthcare/dialysis"
80703           ],
80704           convenience: [
80705             "shop/beauty",
80706             "shop/chemist",
80707             "shop/convenience",
80708             "shop/cosmetics",
80709             "shop/grocery",
80710             "shop/kiosk",
80711             "shop/newsagent",
80712             "shop/perfumery"
80713           ],
80714           coworking: [
80715             "amenity/coworking_space",
80716             "office/coworking",
80717             "office/coworking_space"
80718           ],
80719           dentist: [
80720             "amenity/dentist",
80721             "amenity/doctors",
80722             "healthcare/dentist"
80723           ],
80724           electronics: [
80725             "office/telecommunication",
80726             "shop/appliance",
80727             "shop/computer",
80728             "shop/electronics",
80729             "shop/hifi",
80730             "shop/kiosk",
80731             "shop/mobile",
80732             "shop/mobile_phone",
80733             "shop/telecommunication",
80734             "shop/video_games"
80735           ],
80736           estate_agents: [
80737             "office/estate_agent",
80738             "shop/estate_agent",
80739             "office/mortgage",
80740             "office/financial"
80741           ],
80742           fabric: [
80743             "shop/fabric",
80744             "shop/haberdashery",
80745             "shop/sewing"
80746           ],
80747           fashion: [
80748             "shop/accessories",
80749             "shop/bag",
80750             "shop/boutique",
80751             "shop/clothes",
80752             "shop/department_store",
80753             "shop/fashion",
80754             "shop/fashion_accessories",
80755             "shop/sports",
80756             "shop/shoes"
80757           ],
80758           financial: [
80759             "amenity/bank",
80760             "office/accountant",
80761             "office/financial",
80762             "office/financial_advisor",
80763             "office/tax_advisor",
80764             "shop/tax"
80765           ],
80766           fitness: [
80767             "leisure/fitness_centre",
80768             "leisure/fitness_center",
80769             "leisure/sports_centre",
80770             "leisure/sports_center"
80771           ],
80772           food: [
80773             "amenity/cafe",
80774             "amenity/fast_food",
80775             "amenity/ice_cream",
80776             "amenity/restaurant",
80777             "shop/bakery",
80778             "shop/candy",
80779             "shop/chocolate",
80780             "shop/coffee",
80781             "shop/confectionary",
80782             "shop/confectionery",
80783             "shop/deli",
80784             "shop/food",
80785             "shop/kiosk",
80786             "shop/ice_cream",
80787             "shop/pastry",
80788             "shop/tea"
80789           ],
80790           fuel: [
80791             "amenity/fuel",
80792             "shop/gas",
80793             "shop/convenience;gas",
80794             "shop/gas;convenience"
80795           ],
80796           gift: [
80797             "shop/gift",
80798             "shop/card",
80799             "shop/cards",
80800             "shop/kiosk",
80801             "shop/stationery"
80802           ],
80803           glass: [
80804             "craft/window_construction",
80805             "craft/glaziery",
80806             "shop/car_repair"
80807           ],
80808           hardware: [
80809             "shop/bathroom_furnishing",
80810             "shop/carpet",
80811             "shop/diy",
80812             "shop/doityourself",
80813             "shop/doors",
80814             "shop/electrical",
80815             "shop/flooring",
80816             "shop/hardware",
80817             "shop/hardware_store",
80818             "shop/power_tools",
80819             "shop/tool_hire",
80820             "shop/tools",
80821             "shop/trade"
80822           ],
80823           health_food: [
80824             "shop/health",
80825             "shop/health_food",
80826             "shop/herbalist",
80827             "shop/nutrition_supplements"
80828           ],
80829           hobby: [
80830             "shop/electronics",
80831             "shop/hobby",
80832             "shop/books",
80833             "shop/games",
80834             "shop/collector",
80835             "shop/toys",
80836             "shop/model",
80837             "shop/video_games",
80838             "shop/anime"
80839           ],
80840           hospital: [
80841             "amenity/doctors",
80842             "amenity/hospital",
80843             "healthcare/hospital"
80844           ],
80845           houseware: [
80846             "shop/houseware",
80847             "shop/interior_decoration"
80848           ],
80849           water_rescue: [
80850             "amenity/lifeboat_station",
80851             "emergency/lifeboat_station",
80852             "emergency/marine_rescue",
80853             "emergency/water_rescue"
80854           ],
80855           locksmith: [
80856             "craft/key_cutter",
80857             "craft/locksmith",
80858             "shop/locksmith"
80859           ],
80860           lodging: [
80861             "tourism/guest_house",
80862             "tourism/hotel",
80863             "tourism/motel"
80864           ],
80865           money_transfer: [
80866             "amenity/money_transfer",
80867             "shop/money_transfer"
80868           ],
80869           music: ["shop/music", "shop/musical_instrument"],
80870           office_supplies: [
80871             "shop/office_supplies",
80872             "shop/stationary",
80873             "shop/stationery"
80874           ],
80875           outdoor: [
80876             "shop/clothes",
80877             "shop/outdoor",
80878             "shop/sports"
80879           ],
80880           parcel_locker: [
80881             "amenity/parcel_locker",
80882             "amenity/vending_machine"
80883           ],
80884           pharmacy: [
80885             "amenity/doctors",
80886             "amenity/pharmacy",
80887             "healthcare/pharmacy",
80888             "shop/chemist"
80889           ],
80890           playground: [
80891             "amenity/theme_park",
80892             "leisure/amusement_arcade",
80893             "leisure/playground"
80894           ],
80895           rental: [
80896             "amenity/bicycle_rental",
80897             "amenity/boat_rental",
80898             "amenity/car_rental",
80899             "amenity/truck_rental",
80900             "amenity/vehicle_rental",
80901             "shop/kiosk",
80902             "shop/plant_hire",
80903             "shop/rental",
80904             "shop/tool_hire"
80905           ],
80906           school: [
80907             "amenity/childcare",
80908             "amenity/college",
80909             "amenity/kindergarten",
80910             "amenity/language_school",
80911             "amenity/prep_school",
80912             "amenity/school",
80913             "amenity/university"
80914           ],
80915           storage: [
80916             "shop/storage_units",
80917             "shop/storage_rental"
80918           ],
80919           substation: [
80920             "power/station",
80921             "power/substation",
80922             "power/sub_station"
80923           ],
80924           supermarket: [
80925             "shop/food",
80926             "shop/frozen_food",
80927             "shop/greengrocer",
80928             "shop/grocery",
80929             "shop/supermarket",
80930             "shop/wholesale"
80931           ],
80932           thrift: [
80933             "shop/charity",
80934             "shop/clothes",
80935             "shop/second_hand"
80936           ],
80937           tobacco: [
80938             "shop/e-cigarette",
80939             "shop/tobacco"
80940           ],
80941           variety_store: [
80942             "shop/variety_store",
80943             "shop/discount",
80944             "shop/convenience"
80945           ],
80946           vending: [
80947             "amenity/vending_machine",
80948             "shop/kiosk",
80949             "shop/vending_machine"
80950           ],
80951           weight_loss: [
80952             "amenity/clinic",
80953             "amenity/doctors",
80954             "amenity/weight_clinic",
80955             "healthcare/counselling",
80956             "leisure/fitness_centre",
80957             "office/therapist",
80958             "shop/beauty",
80959             "shop/diet",
80960             "shop/food",
80961             "shop/health_food",
80962             "shop/herbalist",
80963             "shop/nutrition",
80964             "shop/nutrition_supplements",
80965             "shop/weight_loss"
80966           ],
80967           wholesale: [
80968             "shop/wholesale",
80969             "shop/supermarket",
80970             "shop/department_store"
80971           ]
80972         }
80973       };
80974     }
80975   });
80976
80977   // node_modules/name-suggestion-index/config/genericWords.json
80978   var genericWords_default;
80979   var init_genericWords = __esm({
80980     "node_modules/name-suggestion-index/config/genericWords.json"() {
80981       genericWords_default = {
80982         genericWords: [
80983           "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
80984           "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
80985           "^(club|green|out|ware)\\s?house$",
80986           "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
80987           "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
80988           "^(hofladen|librairie|magazine?|maison|toko)$",
80989           "^(mobile home|skate)?\\s?park$",
80990           "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
80991           "^\\?+$",
80992           "^private$",
80993           "^tattoo( studio)?$",
80994           "^windmill$",
80995           "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
80996         ]
80997       };
80998     }
80999   });
81000
81001   // node_modules/name-suggestion-index/config/trees.json
81002   var trees_default;
81003   var init_trees = __esm({
81004     "node_modules/name-suggestion-index/config/trees.json"() {
81005       trees_default = {
81006         trees: {
81007           brands: {
81008             emoji: "\u{1F354}",
81009             mainTag: "brand:wikidata",
81010             sourceTags: ["brand", "name"],
81011             nameTags: {
81012               primary: "^(name|name:\\w+)$",
81013               alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
81014             }
81015           },
81016           flags: {
81017             emoji: "\u{1F6A9}",
81018             mainTag: "flag:wikidata",
81019             nameTags: {
81020               primary: "^(flag:name|flag:name:\\w+)$",
81021               alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
81022             }
81023           },
81024           operators: {
81025             emoji: "\u{1F4BC}",
81026             mainTag: "operator:wikidata",
81027             sourceTags: ["operator"],
81028             nameTags: {
81029               primary: "^(name|name:\\w+|operator|operator:\\w+)$",
81030               alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
81031             }
81032           },
81033           transit: {
81034             emoji: "\u{1F687}",
81035             mainTag: "network:wikidata",
81036             sourceTags: ["network"],
81037             nameTags: {
81038               primary: "^network$",
81039               alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
81040             }
81041           }
81042         }
81043       };
81044     }
81045   });
81046
81047   // node_modules/name-suggestion-index/lib/matcher.js
81048   var import_which_polygon4, matchGroups, trees, Matcher;
81049   var init_matcher2 = __esm({
81050     "node_modules/name-suggestion-index/lib/matcher.js"() {
81051       import_which_polygon4 = __toESM(require_which_polygon(), 1);
81052       init_simplify2();
81053       init_matchGroups();
81054       init_genericWords();
81055       init_trees();
81056       matchGroups = matchGroups_default.matchGroups;
81057       trees = trees_default.trees;
81058       Matcher = class {
81059         //
81060         // `constructor`
81061         // initialize the genericWords regexes
81062         constructor() {
81063           this.matchIndex = void 0;
81064           this.genericWords = /* @__PURE__ */ new Map();
81065           (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
81066           this.itemLocation = void 0;
81067           this.locationSets = void 0;
81068           this.locationIndex = void 0;
81069           this.warnings = [];
81070         }
81071         //
81072         // `buildMatchIndex()`
81073         // Call this to prepare the matcher for use
81074         //
81075         // `data` needs to be an Object indexed on a 'tree/key/value' path.
81076         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
81077         // {
81078         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
81079         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
81080         //    …
81081         // }
81082         //
81083         buildMatchIndex(data) {
81084           const that = this;
81085           if (that.matchIndex) return;
81086           that.matchIndex = /* @__PURE__ */ new Map();
81087           const seenTree = /* @__PURE__ */ new Map();
81088           Object.keys(data).forEach((tkv) => {
81089             const category = data[tkv];
81090             const parts = tkv.split("/", 3);
81091             const t2 = parts[0];
81092             const k2 = parts[1];
81093             const v2 = parts[2];
81094             const thiskv = `${k2}/${v2}`;
81095             const tree = trees[t2];
81096             let branch = that.matchIndex.get(thiskv);
81097             if (!branch) {
81098               branch = {
81099                 primary: /* @__PURE__ */ new Map(),
81100                 alternate: /* @__PURE__ */ new Map(),
81101                 excludeGeneric: /* @__PURE__ */ new Map(),
81102                 excludeNamed: /* @__PURE__ */ new Map()
81103               };
81104               that.matchIndex.set(thiskv, branch);
81105             }
81106             const properties = category.properties || {};
81107             const exclude = properties.exclude || {};
81108             (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
81109             (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
81110             const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
81111             let items = category.items;
81112             if (!Array.isArray(items) || !items.length) return;
81113             const primaryName = new RegExp(tree.nameTags.primary, "i");
81114             const alternateName = new RegExp(tree.nameTags.alternate, "i");
81115             const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
81116             const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
81117             const genericKV = /* @__PURE__ */ new Set([`${k2}/yes`, `building/yes`]);
81118             const matchGroupKV = /* @__PURE__ */ new Set();
81119             Object.values(matchGroups).forEach((matchGroup) => {
81120               const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
81121               if (!inGroup) return;
81122               matchGroup.forEach((otherkv) => {
81123                 if (otherkv === thiskv) return;
81124                 matchGroupKV.add(otherkv);
81125                 const otherk = otherkv.split("/", 2)[0];
81126                 genericKV.add(`${otherk}/yes`);
81127               });
81128             });
81129             items.forEach((item) => {
81130               if (!item.id) return;
81131               if (Array.isArray(item.matchTags) && item.matchTags.length) {
81132                 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && matchTag !== thiskv && !genericKV.has(matchTag));
81133                 if (!item.matchTags.length) delete item.matchTags;
81134               }
81135               let kvTags = [`${thiskv}`].concat(item.matchTags || []);
81136               if (!skipGenericKV) {
81137                 kvTags = kvTags.concat(Array.from(genericKV));
81138               }
81139               Object.keys(item.tags).forEach((osmkey) => {
81140                 if (notName.test(osmkey)) return;
81141                 const osmvalue = item.tags[osmkey];
81142                 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
81143                 if (primaryName.test(osmkey)) {
81144                   kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
81145                 } else if (alternateName.test(osmkey)) {
81146                   kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
81147                 }
81148               });
81149               let keepMatchNames = /* @__PURE__ */ new Set();
81150               (item.matchNames || []).forEach((matchName) => {
81151                 const nsimple = simplify2(matchName);
81152                 kvTags.forEach((kv) => {
81153                   const branch2 = that.matchIndex.get(kv);
81154                   const primaryLeaf = branch2 && branch2.primary.get(nsimple);
81155                   const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
81156                   const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
81157                   const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
81158                   if (!inPrimary && !inAlternate) {
81159                     insertName("alternate", t2, kv, nsimple, item.id);
81160                     keepMatchNames.add(matchName);
81161                   }
81162                 });
81163               });
81164               if (keepMatchNames.size) {
81165                 item.matchNames = Array.from(keepMatchNames);
81166               } else {
81167                 delete item.matchNames;
81168               }
81169             });
81170           });
81171           function insertName(which, t2, kv, nsimple, itemID) {
81172             if (!nsimple) {
81173               that.warnings.push(`Warning: skipping empty ${which} name for item ${t2}/${kv}: ${itemID}`);
81174               return;
81175             }
81176             let branch = that.matchIndex.get(kv);
81177             if (!branch) {
81178               branch = {
81179                 primary: /* @__PURE__ */ new Map(),
81180                 alternate: /* @__PURE__ */ new Map(),
81181                 excludeGeneric: /* @__PURE__ */ new Map(),
81182                 excludeNamed: /* @__PURE__ */ new Map()
81183               };
81184               that.matchIndex.set(kv, branch);
81185             }
81186             let leaf = branch[which].get(nsimple);
81187             if (!leaf) {
81188               leaf = /* @__PURE__ */ new Set();
81189               branch[which].set(nsimple, leaf);
81190             }
81191             leaf.add(itemID);
81192             if (!/yes$/.test(kv)) {
81193               const kvnsimple = `${kv}/${nsimple}`;
81194               const existing = seenTree.get(kvnsimple);
81195               if (existing && existing !== t2) {
81196                 const items = Array.from(leaf);
81197                 that.warnings.push(`Duplicate cache key "${kvnsimple}" in trees "${t2}" and "${existing}", check items: ${items}`);
81198                 return;
81199               }
81200               seenTree.set(kvnsimple, t2);
81201             }
81202           }
81203           function skipGenericKVMatches(t2, k2, v2) {
81204             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";
81205           }
81206         }
81207         //
81208         // `buildLocationIndex()`
81209         // Call this to prepare a which-polygon location index.
81210         // This *resolves* all the locationSets into GeoJSON, which takes some time.
81211         // You can skip this step if you don't care about matching within a location.
81212         //
81213         // `data` needs to be an Object indexed on a 'tree/key/value' path.
81214         // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
81215         // {
81216         //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
81217         //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
81218         //    …
81219         // }
81220         //
81221         buildLocationIndex(data, loco) {
81222           const that = this;
81223           if (that.locationIndex) return;
81224           that.itemLocation = /* @__PURE__ */ new Map();
81225           that.locationSets = /* @__PURE__ */ new Map();
81226           Object.keys(data).forEach((tkv) => {
81227             const items = data[tkv].items;
81228             if (!Array.isArray(items) || !items.length) return;
81229             items.forEach((item) => {
81230               if (that.itemLocation.has(item.id)) return;
81231               let resolved;
81232               try {
81233                 resolved = loco.resolveLocationSet(item.locationSet);
81234               } catch (err) {
81235                 console.warn(`buildLocationIndex: ${err.message}`);
81236               }
81237               if (!resolved || !resolved.id) return;
81238               that.itemLocation.set(item.id, resolved.id);
81239               if (that.locationSets.has(resolved.id)) return;
81240               let feature3 = _cloneDeep2(resolved.feature);
81241               feature3.id = resolved.id;
81242               feature3.properties.id = resolved.id;
81243               if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
81244                 console.warn(`buildLocationIndex: locationSet ${resolved.id} for ${item.id} resolves to an empty feature:`);
81245                 console.warn(JSON.stringify(feature3));
81246                 return;
81247               }
81248               that.locationSets.set(resolved.id, feature3);
81249             });
81250           });
81251           that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
81252           function _cloneDeep2(obj) {
81253             return JSON.parse(JSON.stringify(obj));
81254           }
81255         }
81256         //
81257         // `match()`
81258         // Pass parts and return an Array of matches.
81259         // `k` - key
81260         // `v` - value
81261         // `n` - namelike
81262         // `loc` - optional - [lon,lat] location to search
81263         //
81264         // 1. If the [k,v,n] tuple matches a canonical item…
81265         // Return an Array of match results.
81266         // Each result will include the area in km² that the item is valid.
81267         //
81268         // Order of results:
81269         // Primary ordering will be on the "match" column:
81270         //   "primary" - where the query matches the `name` tag, followed by
81271         //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
81272         // Secondary ordering will be on the "area" column:
81273         //   "area descending" if no location was provided, (worldwide before local)
81274         //   "area ascending" if location was provided (local before worldwide)
81275         //
81276         // [
81277         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
81278         //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
81279         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
81280         //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
81281         //   …
81282         // ]
81283         //
81284         // -or-
81285         //
81286         // 2. If the [k,v,n] tuple matches an exclude pattern…
81287         // Return an Array with a single exclude result, either
81288         //
81289         // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
81290         //   or
81291         // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
81292         //
81293         // About results
81294         //   "generic" - a generic word that is probably not really a name.
81295         //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
81296         //   "named" - a real name like "Kebabai" that is just common, but not a brand.
81297         //     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.
81298         //
81299         // -or-
81300         //
81301         // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
81302         //
81303         //
81304         match(k2, v2, n3, loc) {
81305           const that = this;
81306           if (!that.matchIndex) {
81307             throw new Error("match:  matchIndex not built.");
81308           }
81309           let matchLocations;
81310           if (Array.isArray(loc) && that.locationIndex) {
81311             matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
81312           }
81313           const nsimple = simplify2(n3);
81314           let seen = /* @__PURE__ */ new Set();
81315           let results = [];
81316           gatherResults("primary");
81317           gatherResults("alternate");
81318           if (results.length) return results;
81319           gatherResults("exclude");
81320           return results.length ? results : null;
81321           function gatherResults(which) {
81322             const kv = `${k2}/${v2}`;
81323             let didMatch = tryMatch(which, kv);
81324             if (didMatch) return;
81325             for (let mg in matchGroups) {
81326               const matchGroup = matchGroups[mg];
81327               const inGroup = matchGroup.some((otherkv) => otherkv === kv);
81328               if (!inGroup) continue;
81329               for (let i3 = 0; i3 < matchGroup.length; i3++) {
81330                 const otherkv = matchGroup[i3];
81331                 if (otherkv === kv) continue;
81332                 didMatch = tryMatch(which, otherkv);
81333                 if (didMatch) return;
81334               }
81335             }
81336             if (which === "exclude") {
81337               const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
81338               if (regex) {
81339                 results.push({ match: "excludeGeneric", pattern: String(regex) });
81340                 return;
81341               }
81342             }
81343           }
81344           function tryMatch(which, kv) {
81345             const branch = that.matchIndex.get(kv);
81346             if (!branch) return;
81347             if (which === "exclude") {
81348               let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
81349               if (regex) {
81350                 results.push({ match: "excludeNamed", pattern: String(regex), kv });
81351                 return;
81352               }
81353               regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
81354               if (regex) {
81355                 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
81356                 return;
81357               }
81358               return;
81359             }
81360             const leaf = branch[which].get(nsimple);
81361             if (!leaf || !leaf.size) return;
81362             let hits = Array.from(leaf).map((itemID) => {
81363               let area = Infinity;
81364               if (that.itemLocation && that.locationSets) {
81365                 const location = that.locationSets.get(that.itemLocation.get(itemID));
81366                 area = location && location.properties.area || Infinity;
81367               }
81368               return { match: which, itemID, area, kv, nsimple };
81369             });
81370             let sortFn = byAreaDescending;
81371             if (matchLocations) {
81372               hits = hits.filter(isValidLocation);
81373               sortFn = byAreaAscending;
81374             }
81375             if (!hits.length) return;
81376             hits.sort(sortFn).forEach((hit) => {
81377               if (seen.has(hit.itemID)) return;
81378               seen.add(hit.itemID);
81379               results.push(hit);
81380             });
81381             return true;
81382             function isValidLocation(hit) {
81383               if (!that.itemLocation) return true;
81384               return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
81385             }
81386             function byAreaAscending(hitA, hitB) {
81387               return hitA.area - hitB.area;
81388             }
81389             function byAreaDescending(hitA, hitB) {
81390               return hitB.area - hitA.area;
81391             }
81392           }
81393         }
81394         //
81395         // `getWarnings()`
81396         // Return any warnings discovered when buiding the index.
81397         // (currently this does nothing)
81398         //
81399         getWarnings() {
81400           return this.warnings;
81401         }
81402       };
81403     }
81404   });
81405
81406   // node_modules/name-suggestion-index/lib/stemmer.js
81407   var init_stemmer = __esm({
81408     "node_modules/name-suggestion-index/lib/stemmer.js"() {
81409       init_simplify2();
81410     }
81411   });
81412
81413   // node_modules/name-suggestion-index/index.mjs
81414   var init_name_suggestion_index = __esm({
81415     "node_modules/name-suggestion-index/index.mjs"() {
81416       init_matcher2();
81417       init_simplify2();
81418       init_stemmer();
81419     }
81420   });
81421
81422   // modules/services/nsi.js
81423   var nsi_exports = {};
81424   __export(nsi_exports, {
81425     default: () => nsi_default
81426   });
81427   function setNsiSources() {
81428     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
81429     const v2 = (0, import_vparse.default)(nsiVersion);
81430     const vMinor = `${v2.major}.${v2.minor}`;
81431     const cdn = nsiCdnUrl.replace("{version}", vMinor);
81432     const sources = {
81433       "nsi_data": cdn + "dist/nsi.min.json",
81434       "nsi_dissolved": cdn + "dist/dissolved.min.json",
81435       "nsi_features": cdn + "dist/featureCollection.min.json",
81436       "nsi_generics": cdn + "dist/genericWords.min.json",
81437       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
81438       "nsi_replacements": cdn + "dist/replacements.min.json",
81439       "nsi_trees": cdn + "dist/trees.min.json"
81440     };
81441     let fileMap = _mainFileFetcher.fileMap();
81442     for (const k2 in sources) {
81443       if (!fileMap[k2]) fileMap[k2] = sources[k2];
81444     }
81445   }
81446   function loadNsiPresets() {
81447     return Promise.all([
81448       _mainFileFetcher.get("nsi_presets"),
81449       _mainFileFetcher.get("nsi_features")
81450     ]).then((vals) => {
81451       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
81452       Object.values(vals[0].presets).forEach((preset) => {
81453         if (preset.tags["brand:wikidata"]) {
81454           preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81455         }
81456         if (preset.tags["operator:wikidata"]) {
81457           preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81458         }
81459         if (preset.tags["network:wikidata"]) {
81460           preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
81461         }
81462       });
81463       _mainPresetIndex.merge({
81464         presets: vals[0].presets,
81465         featureCollection: vals[1]
81466       });
81467     });
81468   }
81469   function loadNsiData() {
81470     return Promise.all([
81471       _mainFileFetcher.get("nsi_data"),
81472       _mainFileFetcher.get("nsi_dissolved"),
81473       _mainFileFetcher.get("nsi_replacements"),
81474       _mainFileFetcher.get("nsi_trees")
81475     ]).then((vals) => {
81476       _nsi = {
81477         data: vals[0].nsi,
81478         // the raw name-suggestion-index data
81479         dissolved: vals[1].dissolved,
81480         // list of dissolved items
81481         replacements: vals[2].replacements,
81482         // trivial old->new qid replacements
81483         trees: vals[3].trees,
81484         // metadata about trees, main tags
81485         kvt: /* @__PURE__ */ new Map(),
81486         // Map (k -> Map (v -> t) )
81487         qids: /* @__PURE__ */ new Map(),
81488         // Map (wd/wp tag values -> qids)
81489         ids: /* @__PURE__ */ new Map()
81490         // Map (id -> NSI item)
81491       };
81492       const matcher = _nsi.matcher = new Matcher();
81493       matcher.buildMatchIndex(_nsi.data);
81494       matcher.itemLocation = /* @__PURE__ */ new Map();
81495       matcher.locationSets = /* @__PURE__ */ new Map();
81496       Object.keys(_nsi.data).forEach((tkv) => {
81497         const items = _nsi.data[tkv].items;
81498         if (!Array.isArray(items) || !items.length) return;
81499         items.forEach((item) => {
81500           if (matcher.itemLocation.has(item.id)) return;
81501           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
81502           matcher.itemLocation.set(item.id, locationSetID);
81503           if (matcher.locationSets.has(locationSetID)) return;
81504           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
81505           matcher.locationSets.set(locationSetID, fakeFeature);
81506         });
81507       });
81508       matcher.locationIndex = (bbox2) => {
81509         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
81510         const results = [];
81511         for (const [locationSetID, area] of Object.entries(validHere)) {
81512           const fakeFeature = matcher.locationSets.get(locationSetID);
81513           if (fakeFeature) {
81514             fakeFeature.properties.area = area;
81515             results.push(fakeFeature);
81516           }
81517         }
81518         return results;
81519       };
81520       Object.keys(_nsi.data).forEach((tkv) => {
81521         const category = _nsi.data[tkv];
81522         const parts = tkv.split("/", 3);
81523         const t2 = parts[0];
81524         const k2 = parts[1];
81525         const v2 = parts[2];
81526         let vmap = _nsi.kvt.get(k2);
81527         if (!vmap) {
81528           vmap = /* @__PURE__ */ new Map();
81529           _nsi.kvt.set(k2, vmap);
81530         }
81531         vmap.set(v2, t2);
81532         const tree = _nsi.trees[t2];
81533         const mainTag = tree.mainTag;
81534         const items = category.items || [];
81535         items.forEach((item) => {
81536           item.tkv = tkv;
81537           item.mainTag = mainTag;
81538           _nsi.ids.set(item.id, item);
81539           const wd = item.tags[mainTag];
81540           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
81541           if (wd) _nsi.qids.set(wd, wd);
81542           if (wp && wd) _nsi.qids.set(wp, wd);
81543         });
81544       });
81545     });
81546   }
81547   function gatherKVs(tags) {
81548     let primary = /* @__PURE__ */ new Set();
81549     let alternate = /* @__PURE__ */ new Set();
81550     Object.keys(tags).forEach((osmkey) => {
81551       const osmvalue = tags[osmkey];
81552       if (!osmvalue) return;
81553       if (osmkey === "route_master") osmkey = "route";
81554       const vmap = _nsi.kvt.get(osmkey);
81555       if (!vmap) return;
81556       if (vmap.get(osmvalue)) {
81557         primary.add(`${osmkey}/${osmvalue}`);
81558       } else if (osmvalue === "yes") {
81559         alternate.add(`${osmkey}/${osmvalue}`);
81560       }
81561     });
81562     const preset = _mainPresetIndex.matchTags(tags, "area");
81563     if (buildingPreset[preset.id]) {
81564       alternate.add("building/yes");
81565     }
81566     return { primary, alternate };
81567   }
81568   function identifyTree(tags) {
81569     let unknown;
81570     let t2;
81571     Object.keys(tags).forEach((osmkey) => {
81572       if (t2) return;
81573       const osmvalue = tags[osmkey];
81574       if (!osmvalue) return;
81575       if (osmkey === "route_master") osmkey = "route";
81576       const vmap = _nsi.kvt.get(osmkey);
81577       if (!vmap) return;
81578       if (osmvalue === "yes") {
81579         unknown = "unknown";
81580       } else {
81581         t2 = vmap.get(osmvalue);
81582       }
81583     });
81584     return t2 || unknown || null;
81585   }
81586   function gatherNames(tags) {
81587     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
81588     let primary = /* @__PURE__ */ new Set();
81589     let alternate = /* @__PURE__ */ new Set();
81590     let foundSemi = false;
81591     let testNameFragments = false;
81592     let patterns2;
81593     let t2 = identifyTree(tags);
81594     if (!t2) return empty2;
81595     if (t2 === "transit") {
81596       patterns2 = {
81597         primary: /^network$/i,
81598         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
81599       };
81600     } else if (t2 === "flags") {
81601       patterns2 = {
81602         primary: /^(flag:name|flag:name:\w+)$/i,
81603         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
81604         // note: no `country`, we special-case it below
81605       };
81606     } else if (t2 === "brands") {
81607       testNameFragments = true;
81608       patterns2 = {
81609         primary: /^(name|name:\w+)$/i,
81610         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
81611       };
81612     } else if (t2 === "operators") {
81613       testNameFragments = true;
81614       patterns2 = {
81615         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
81616         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
81617       };
81618     } else {
81619       testNameFragments = true;
81620       patterns2 = {
81621         primary: /^(name|name:\w+)$/i,
81622         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
81623       };
81624     }
81625     if (tags.name && testNameFragments) {
81626       const nameParts = tags.name.split(/[\s\-\/,.]/);
81627       for (let split = nameParts.length; split > 0; split--) {
81628         const name = nameParts.slice(0, split).join(" ");
81629         primary.add(name);
81630       }
81631     }
81632     Object.keys(tags).forEach((osmkey) => {
81633       const osmvalue = tags[osmkey];
81634       if (!osmvalue) return;
81635       if (isNamelike(osmkey, "primary")) {
81636         if (/;/.test(osmvalue)) {
81637           foundSemi = true;
81638         } else {
81639           primary.add(osmvalue);
81640           alternate.delete(osmvalue);
81641         }
81642       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
81643         if (/;/.test(osmvalue)) {
81644           foundSemi = true;
81645         } else {
81646           alternate.add(osmvalue);
81647         }
81648       }
81649     });
81650     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
81651       const osmvalue = tags.country;
81652       if (/;/.test(osmvalue)) {
81653         foundSemi = true;
81654       } else {
81655         alternate.add(osmvalue);
81656       }
81657     }
81658     if (foundSemi) {
81659       return empty2;
81660     } else {
81661       return { primary, alternate };
81662     }
81663     function isNamelike(osmkey, which) {
81664       if (osmkey === "old_name") return false;
81665       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
81666     }
81667   }
81668   function gatherTuples(tryKVs, tryNames) {
81669     let tuples = [];
81670     ["primary", "alternate"].forEach((whichName) => {
81671       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
81672       arr.forEach((n3) => {
81673         ["primary", "alternate"].forEach((whichKV) => {
81674           tryKVs[whichKV].forEach((kv) => {
81675             const parts = kv.split("/", 2);
81676             const k2 = parts[0];
81677             const v2 = parts[1];
81678             tuples.push({ k: k2, v: v2, n: n3 });
81679           });
81680         });
81681       });
81682     });
81683     return tuples;
81684   }
81685   function _upgradeTags(tags, loc) {
81686     let newTags = Object.assign({}, tags);
81687     let changed = false;
81688     Object.keys(newTags).forEach((osmkey) => {
81689       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
81690       if (matchTag) {
81691         const prefix = matchTag[1] || "";
81692         const wd = newTags[osmkey];
81693         const replace = _nsi.replacements[wd];
81694         if (replace && replace.wikidata !== void 0) {
81695           changed = true;
81696           if (replace.wikidata) {
81697             newTags[osmkey] = replace.wikidata;
81698           } else {
81699             delete newTags[osmkey];
81700           }
81701         }
81702         if (replace && replace.wikipedia !== void 0) {
81703           changed = true;
81704           const wpkey = `${prefix}wikipedia`;
81705           if (replace.wikipedia) {
81706             newTags[wpkey] = replace.wikipedia;
81707           } else {
81708             delete newTags[wpkey];
81709           }
81710         }
81711       }
81712     });
81713     const isRouteMaster = tags.type === "route_master";
81714     const tryKVs = gatherKVs(tags);
81715     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
81716       return changed ? { newTags, matched: null } : null;
81717     }
81718     const tryNames = gatherNames(tags);
81719     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
81720     if (foundQID) tryNames.primary.add(foundQID);
81721     if (!tryNames.primary.size && !tryNames.alternate.size) {
81722       return changed ? { newTags, matched: null } : null;
81723     }
81724     const tuples = gatherTuples(tryKVs, tryNames);
81725     for (let i3 = 0; i3 < tuples.length; i3++) {
81726       const tuple = tuples[i3];
81727       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
81728       if (!hits || !hits.length) continue;
81729       if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
81730       let itemID, item;
81731       for (let j2 = 0; j2 < hits.length; j2++) {
81732         const hit = hits[j2];
81733         itemID = hit.itemID;
81734         if (_nsi.dissolved[itemID]) continue;
81735         item = _nsi.ids.get(itemID);
81736         if (!item) continue;
81737         const mainTag = item.mainTag;
81738         const itemQID = item.tags[mainTag];
81739         const notQID = newTags[`not:${mainTag}`];
81740         if (
81741           // Exceptions, skip this hit
81742           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
81743           newTags.office && !item.tags.office
81744         ) {
81745           item = null;
81746           continue;
81747         } else {
81748           break;
81749         }
81750       }
81751       if (!item) continue;
81752       item = JSON.parse(JSON.stringify(item));
81753       const tkv = item.tkv;
81754       const parts = tkv.split("/", 3);
81755       const k2 = parts[1];
81756       const v2 = parts[2];
81757       const category = _nsi.data[tkv];
81758       const properties = category.properties || {};
81759       let preserveTags = item.preserveTags || properties.preserveTags || [];
81760       ["building", "emergency", "internet_access", "opening_hours", "takeaway"].forEach((osmkey) => {
81761         if (k2 !== osmkey) preserveTags.push(`^${osmkey}$`);
81762       });
81763       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
81764       let keepTags = {};
81765       Object.keys(newTags).forEach((osmkey) => {
81766         if (regexes.some((regex) => regex.test(osmkey))) {
81767           keepTags[osmkey] = newTags[osmkey];
81768         }
81769       });
81770       _nsi.kvt.forEach((vmap, k3) => {
81771         if (newTags[k3] === "yes") delete newTags[k3];
81772       });
81773       if (foundQID) {
81774         delete newTags.wikipedia;
81775         delete newTags.wikidata;
81776       }
81777       Object.assign(newTags, item.tags, keepTags);
81778       if (isRouteMaster) {
81779         newTags.route_master = newTags.route;
81780         delete newTags.route;
81781       }
81782       const origName = tags.name;
81783       const newName = newTags.name;
81784       if (newName && origName && newName !== origName && !newTags.branch) {
81785         const newNames = gatherNames(newTags);
81786         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
81787         const isMoved = newSet.has(origName);
81788         if (!isMoved) {
81789           const nameParts = origName.split(/[\s\-\/,.]/);
81790           for (let split = nameParts.length; split > 0; split--) {
81791             const name = nameParts.slice(0, split).join(" ");
81792             const branch = nameParts.slice(split).join(" ");
81793             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
81794             if (!nameHits || !nameHits.length) continue;
81795             if (nameHits.some((hit) => hit.itemID === itemID)) {
81796               if (branch) {
81797                 if (notBranches.test(branch)) {
81798                   newTags.name = origName;
81799                 } else {
81800                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
81801                   if (branchHits && branchHits.length) {
81802                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
81803                       return null;
81804                     }
81805                   } else {
81806                     newTags.branch = branch;
81807                   }
81808                 }
81809               }
81810               break;
81811             }
81812           }
81813         }
81814       }
81815       return { newTags, matched: item };
81816     }
81817     return changed ? { newTags, matched: null } : null;
81818   }
81819   function _isGenericName(tags) {
81820     const n3 = tags.name;
81821     if (!n3) return false;
81822     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
81823     const tryKVs = gatherKVs(tags);
81824     if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
81825     const tuples = gatherTuples(tryKVs, tryNames);
81826     for (let i3 = 0; i3 < tuples.length; i3++) {
81827       const tuple = tuples[i3];
81828       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
81829       if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
81830     }
81831     return false;
81832   }
81833   var import_vparse, _nsiStatus, _nsi, buildingPreset, notNames, notBranches, nsi_default;
81834   var init_nsi = __esm({
81835     "modules/services/nsi.js"() {
81836       "use strict";
81837       init_name_suggestion_index();
81838       import_vparse = __toESM(require_vparse());
81839       init_core();
81840       init_presets();
81841       init_id();
81842       init_package();
81843       _nsiStatus = "loading";
81844       _nsi = {};
81845       buildingPreset = {
81846         "building/commercial": true,
81847         "building/government": true,
81848         "building/hotel": true,
81849         "building/retail": true,
81850         "building/office": true,
81851         "building/supermarket": true,
81852         "building/yes": true
81853       };
81854       notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
81855       notBranches = /(coop|express|wireless|factory|outlet)/i;
81856       nsi_default = {
81857         // `init()`
81858         // On init, start preparing the name-suggestion-index
81859         //
81860         init: () => {
81861           setNsiSources();
81862           _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
81863         },
81864         // `reset()`
81865         // Reset is called when user saves data to OSM (does nothing here)
81866         //
81867         reset: () => {
81868         },
81869         // `status()`
81870         // To let other code know how it's going...
81871         //
81872         // Returns
81873         //   `String`: 'loading', 'ok', 'failed'
81874         //
81875         status: () => _nsiStatus,
81876         // `isGenericName()`
81877         // Is the `name` tag generic?
81878         //
81879         // Arguments
81880         //   `tags`: `Object` containing the feature's OSM tags
81881         // Returns
81882         //   `true` if it is generic, `false` if not
81883         //
81884         isGenericName: (tags) => _isGenericName(tags),
81885         // `upgradeTags()`
81886         // Suggest tag upgrades.
81887         // This function will not modify the input tags, it makes a copy.
81888         //
81889         // Arguments
81890         //   `tags`: `Object` containing the feature's OSM tags
81891         //   `loc`: Location where this feature exists, as a [lon, lat]
81892         // Returns
81893         //   `Object` containing the result, or `null` if no changes needed:
81894         //   {
81895         //     'newTags': `Object` - The tags the the feature should have
81896         //     'matched': `Object` - The matched item
81897         //   }
81898         //
81899         upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
81900         // `cache()`
81901         // Direct access to the NSI cache, useful for testing or breaking things
81902         //
81903         // Returns
81904         //   `Object`: the internal NSI cache
81905         //
81906         cache: () => _nsi
81907       };
81908     }
81909   });
81910
81911   // modules/services/kartaview.js
81912   var kartaview_exports = {};
81913   __export(kartaview_exports, {
81914     default: () => kartaview_default
81915   });
81916   function abortRequest3(controller) {
81917     controller.abort();
81918   }
81919   function maxPageAtZoom(z2) {
81920     if (z2 < 15) return 2;
81921     if (z2 === 15) return 5;
81922     if (z2 === 16) return 10;
81923     if (z2 === 17) return 20;
81924     if (z2 === 18) return 40;
81925     if (z2 > 18) return 80;
81926   }
81927   function loadTiles2(which, url, projection2) {
81928     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
81929     var tiles = tiler3.getTiles(projection2);
81930     var cache = _oscCache[which];
81931     Object.keys(cache.inflight).forEach(function(k2) {
81932       var wanted = tiles.find(function(tile) {
81933         return k2.indexOf(tile.id + ",") === 0;
81934       });
81935       if (!wanted) {
81936         abortRequest3(cache.inflight[k2]);
81937         delete cache.inflight[k2];
81938       }
81939     });
81940     tiles.forEach(function(tile) {
81941       loadNextTilePage(which, currZoom, url, tile);
81942     });
81943   }
81944   function loadNextTilePage(which, currZoom, url, tile) {
81945     var cache = _oscCache[which];
81946     var bbox2 = tile.extent.bbox();
81947     var maxPages = maxPageAtZoom(currZoom);
81948     var nextPage = cache.nextPage[tile.id] || 1;
81949     var params = utilQsString({
81950       ipp: maxResults,
81951       page: nextPage,
81952       // client_id: clientId,
81953       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
81954       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
81955     }, true);
81956     if (nextPage > maxPages) return;
81957     var id2 = tile.id + "," + String(nextPage);
81958     if (cache.loaded[id2] || cache.inflight[id2]) return;
81959     var controller = new AbortController();
81960     cache.inflight[id2] = controller;
81961     var options2 = {
81962       method: "POST",
81963       signal: controller.signal,
81964       body: params,
81965       headers: { "Content-Type": "application/x-www-form-urlencoded" }
81966     };
81967     json_default(url, options2).then(function(data) {
81968       cache.loaded[id2] = true;
81969       delete cache.inflight[id2];
81970       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
81971         throw new Error("No Data");
81972       }
81973       var features = data.currentPageItems.map(function(item) {
81974         var loc = [+item.lng, +item.lat];
81975         var d2;
81976         if (which === "images") {
81977           d2 = {
81978             service: "photo",
81979             loc,
81980             key: item.id,
81981             ca: +item.heading,
81982             captured_at: item.shot_date || item.date_added,
81983             captured_by: item.username,
81984             imagePath: item.name,
81985             sequence_id: item.sequence_id,
81986             sequence_index: +item.sequence_index
81987           };
81988           var seq = _oscCache.sequences[d2.sequence_id];
81989           if (!seq) {
81990             seq = { rotation: 0, images: [] };
81991             _oscCache.sequences[d2.sequence_id] = seq;
81992           }
81993           seq.images[d2.sequence_index] = d2;
81994           _oscCache.images.forImageKey[d2.key] = d2;
81995         }
81996         return {
81997           minX: loc[0],
81998           minY: loc[1],
81999           maxX: loc[0],
82000           maxY: loc[1],
82001           data: d2
82002         };
82003       });
82004       cache.rtree.load(features);
82005       if (data.currentPageItems.length === maxResults) {
82006         cache.nextPage[tile.id] = nextPage + 1;
82007         loadNextTilePage(which, currZoom, url, tile);
82008       } else {
82009         cache.nextPage[tile.id] = Infinity;
82010       }
82011       if (which === "images") {
82012         dispatch6.call("loadedImages");
82013       }
82014     }).catch(function() {
82015       cache.loaded[id2] = true;
82016       delete cache.inflight[id2];
82017     });
82018   }
82019   function partitionViewport2(projection2) {
82020     var z2 = geoScaleToZoom(projection2.scale());
82021     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
82022     var tiler8 = utilTiler().zoomExtent([z22, z22]);
82023     return tiler8.getTiles(projection2).map(function(tile) {
82024       return tile.extent;
82025     });
82026   }
82027   function searchLimited2(limit, projection2, rtree) {
82028     limit = limit || 5;
82029     return partitionViewport2(projection2).reduce(function(result, extent) {
82030       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
82031         return d2.data;
82032       });
82033       return found.length ? result.concat(found) : result;
82034     }, []);
82035   }
82036   var apibase2, maxResults, tileZoom, tiler3, dispatch6, imgZoom, _oscCache, _oscSelectedImage, _loadViewerPromise2, kartaview_default;
82037   var init_kartaview = __esm({
82038     "modules/services/kartaview.js"() {
82039       "use strict";
82040       init_src4();
82041       init_src18();
82042       init_src12();
82043       init_rbush();
82044       init_localizer();
82045       init_geo2();
82046       init_util();
82047       init_services();
82048       apibase2 = "https://kartaview.org";
82049       maxResults = 1e3;
82050       tileZoom = 14;
82051       tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
82052       dispatch6 = dispatch_default("loadedImages");
82053       imgZoom = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
82054       kartaview_default = {
82055         init: function() {
82056           if (!_oscCache) {
82057             this.reset();
82058           }
82059           this.event = utilRebind(this, dispatch6, "on");
82060         },
82061         reset: function() {
82062           if (_oscCache) {
82063             Object.values(_oscCache.images.inflight).forEach(abortRequest3);
82064           }
82065           _oscCache = {
82066             images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
82067             sequences: {}
82068           };
82069         },
82070         images: function(projection2) {
82071           var limit = 5;
82072           return searchLimited2(limit, projection2, _oscCache.images.rtree);
82073         },
82074         sequences: function(projection2) {
82075           var viewport = projection2.clipExtent();
82076           var min3 = [viewport[0][0], viewport[1][1]];
82077           var max3 = [viewport[1][0], viewport[0][1]];
82078           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
82079           var sequenceKeys = {};
82080           _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
82081             sequenceKeys[d2.data.sequence_id] = true;
82082           });
82083           var lineStrings = [];
82084           Object.keys(sequenceKeys).forEach(function(sequenceKey) {
82085             var seq = _oscCache.sequences[sequenceKey];
82086             var images = seq && seq.images;
82087             if (images) {
82088               lineStrings.push({
82089                 type: "LineString",
82090                 coordinates: images.map(function(d2) {
82091                   return d2.loc;
82092                 }).filter(Boolean),
82093                 properties: {
82094                   captured_at: images[0] ? images[0].captured_at : null,
82095                   captured_by: images[0] ? images[0].captured_by : null,
82096                   key: sequenceKey
82097                 }
82098               });
82099             }
82100           });
82101           return lineStrings;
82102         },
82103         cachedImage: function(imageKey) {
82104           return _oscCache.images.forImageKey[imageKey];
82105         },
82106         loadImages: function(projection2) {
82107           var url = apibase2 + "/1.0/list/nearby-photos/";
82108           loadTiles2("images", url, projection2);
82109         },
82110         ensureViewerLoaded: function(context) {
82111           if (_loadViewerPromise2) return _loadViewerPromise2;
82112           var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
82113           var that = this;
82114           var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom.on("zoom", zoomPan2)).on("dblclick.zoom", null);
82115           wrapEnter.append("div").attr("class", "photo-attribution fillD");
82116           var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
82117           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
82118           controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
82119           controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
82120           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
82121           wrapEnter.append("div").attr("class", "kartaview-image-wrap");
82122           context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
82123             imgZoom.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
82124           });
82125           function zoomPan2(d3_event) {
82126             var t2 = d3_event.transform;
82127             context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
82128           }
82129           function rotate(deg) {
82130             return function() {
82131               if (!_oscSelectedImage) return;
82132               var sequenceKey = _oscSelectedImage.sequence_id;
82133               var sequence = _oscCache.sequences[sequenceKey];
82134               if (!sequence) return;
82135               var r2 = sequence.rotation || 0;
82136               r2 += deg;
82137               if (r2 > 180) r2 -= 360;
82138               if (r2 < -180) r2 += 360;
82139               sequence.rotation = r2;
82140               var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
82141               wrap3.transition().duration(100).call(imgZoom.transform, identity2);
82142               wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
82143             };
82144           }
82145           function step(stepBy) {
82146             return function() {
82147               if (!_oscSelectedImage) return;
82148               var sequenceKey = _oscSelectedImage.sequence_id;
82149               var sequence = _oscCache.sequences[sequenceKey];
82150               if (!sequence) return;
82151               var nextIndex = _oscSelectedImage.sequence_index + stepBy;
82152               var nextImage = sequence.images[nextIndex];
82153               if (!nextImage) return;
82154               context.map().centerEase(nextImage.loc);
82155               that.selectImage(context, nextImage.key);
82156             };
82157           }
82158           _loadViewerPromise2 = Promise.resolve();
82159           return _loadViewerPromise2;
82160         },
82161         showViewer: function(context) {
82162           const wrap2 = context.container().select(".photoviewer");
82163           const isHidden = wrap2.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
82164           if (isHidden) {
82165             for (const service of Object.values(services)) {
82166               if (service === this) continue;
82167               if (typeof service.hideViewer === "function") {
82168                 service.hideViewer(context);
82169               }
82170             }
82171             wrap2.classed("hide", false).selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
82172           }
82173           return this;
82174         },
82175         hideViewer: function(context) {
82176           _oscSelectedImage = null;
82177           this.updateUrlImage(null);
82178           var viewer = context.container().select(".photoviewer");
82179           if (!viewer.empty()) viewer.datum(null);
82180           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
82181           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
82182           return this.setStyles(context, null, true);
82183         },
82184         selectImage: function(context, imageKey) {
82185           var d2 = this.cachedImage(imageKey);
82186           _oscSelectedImage = d2;
82187           this.updateUrlImage(imageKey);
82188           var viewer = context.container().select(".photoviewer");
82189           if (!viewer.empty()) viewer.datum(d2);
82190           this.setStyles(context, null, true);
82191           context.container().selectAll(".icon-sign").classed("currentView", false);
82192           if (!d2) return this;
82193           var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
82194           var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
82195           var attribution = wrap2.selectAll(".photo-attribution").text("");
82196           wrap2.transition().duration(100).call(imgZoom.transform, identity2);
82197           imageWrap.selectAll(".kartaview-image").remove();
82198           if (d2) {
82199             var sequence = _oscCache.sequences[d2.sequence_id];
82200             var r2 = sequence && sequence.rotation || 0;
82201             imageWrap.append("img").attr("class", "kartaview-image").attr("src", (apibase2 + "/" + d2.imagePath).replace(/^https:\/\/kartaview\.org\/storage(\d+)\//, "https://storage$1.openstreetcam.org/")).style("transform", "rotate(" + r2 + "deg)");
82202             if (d2.captured_by) {
82203               attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
82204               attribution.append("span").text("|");
82205             }
82206             if (d2.captured_at) {
82207               attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
82208               attribution.append("span").text("|");
82209             }
82210             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");
82211           }
82212           return this;
82213           function localeDateString2(s2) {
82214             if (!s2) return null;
82215             var options2 = { day: "numeric", month: "short", year: "numeric" };
82216             var d4 = new Date(s2);
82217             if (isNaN(d4.getTime())) return null;
82218             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
82219           }
82220         },
82221         getSelectedImage: function() {
82222           return _oscSelectedImage;
82223         },
82224         getSequenceKeyForImage: function(d2) {
82225           return d2 && d2.sequence_id;
82226         },
82227         // Updates the currently highlighted sequence and selected bubble.
82228         // Reset is only necessary when interacting with the viewport because
82229         // this implicitly changes the currently selected bubble/sequence
82230         setStyles: function(context, hovered, reset) {
82231           if (reset) {
82232             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
82233             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
82234           }
82235           var hoveredImageId = hovered && hovered.key;
82236           var hoveredSequenceId = this.getSequenceKeyForImage(hovered);
82237           var viewer = context.container().select(".photoviewer");
82238           var selected = viewer.empty() ? void 0 : viewer.datum();
82239           var selectedImageId = selected && selected.key;
82240           var selectedSequenceId = this.getSequenceKeyForImage(selected);
82241           context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
82242             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
82243           }).classed("hovered", function(d2) {
82244             return d2.key === hoveredImageId;
82245           }).classed("currentView", function(d2) {
82246             return d2.key === selectedImageId;
82247           });
82248           context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
82249             return d2.properties.key === hoveredSequenceId;
82250           }).classed("currentView", function(d2) {
82251             return d2.properties.key === selectedSequenceId;
82252           });
82253           context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
82254           function viewfieldPath() {
82255             var d2 = this.parentNode.__data__;
82256             if (d2.pano && d2.key !== selectedImageId) {
82257               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
82258             } else {
82259               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
82260             }
82261           }
82262           return this;
82263         },
82264         updateUrlImage: function(imageKey) {
82265           const hash2 = utilStringQs(window.location.hash);
82266           if (imageKey) {
82267             hash2.photo = "kartaview/" + imageKey;
82268           } else {
82269             delete hash2.photo;
82270           }
82271           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
82272         },
82273         cache: function() {
82274           return _oscCache;
82275         }
82276       };
82277     }
82278   });
82279
82280   // modules/services/pannellum_photo.js
82281   var pannellum_photo_exports = {};
82282   __export(pannellum_photo_exports, {
82283     default: () => pannellum_photo_default
82284   });
82285   var pannellumViewerCSS, pannellumViewerJS, dispatch7, _currScenes, _pannellumViewer, pannellum_photo_default;
82286   var init_pannellum_photo = __esm({
82287     "modules/services/pannellum_photo.js"() {
82288       "use strict";
82289       init_src5();
82290       init_src4();
82291       init_util();
82292       pannellumViewerCSS = "pannellum/pannellum.css";
82293       pannellumViewerJS = "pannellum/pannellum.js";
82294       dispatch7 = dispatch_default("viewerChanged");
82295       _currScenes = [];
82296       pannellum_photo_default = {
82297         init: async function(context, selection2) {
82298           selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("mousedown", function(e3) {
82299             e3.stopPropagation();
82300           });
82301           if (!window.pannellum) {
82302             await this.loadPannellum(context);
82303           }
82304           const options2 = {
82305             "default": { firstScene: "" },
82306             scenes: {},
82307             minHfov: 20,
82308             disableKeyboardCtrl: true
82309           };
82310           _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
82311           _pannellumViewer.on("mousedown", () => {
82312             select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
82313               dispatch7.call("viewerChanged");
82314             });
82315           }).on("mouseup", () => {
82316             select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
82317           }).on("animatefinished", () => {
82318             dispatch7.call("viewerChanged");
82319           });
82320           context.ui().photoviewer.on("resize.pannellum", () => {
82321             _pannellumViewer.resize();
82322           });
82323           this.event = utilRebind(this, dispatch7, "on");
82324           return this;
82325         },
82326         loadPannellum: function(context) {
82327           const head = select_default2("head");
82328           return Promise.all([
82329             new Promise((resolve, reject) => {
82330               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);
82331             }),
82332             new Promise((resolve, reject) => {
82333               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);
82334             })
82335           ]);
82336         },
82337         /**
82338          * Shows the photo frame if hidden
82339          * @param {*} context the HTML wrap of the frame
82340          */
82341         showPhotoFrame: function(context) {
82342           const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
82343           if (isHidden) {
82344             context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
82345             context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
82346           }
82347           return this;
82348         },
82349         /**
82350          * Hides the photo frame if shown
82351          * @param {*} context the HTML wrap of the frame
82352          */
82353         hidePhotoFrame: function(viewerContext) {
82354           viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
82355           return this;
82356         },
82357         /**
82358          * Renders an image inside the frame
82359          * @param {*} data the image data, it should contain an image_path attribute, a link to the actual image.
82360          * @param {boolean} keepOrientation if true, HFOV, pitch and yaw will be kept between images
82361          */
82362         selectPhoto: function(data, keepOrientation) {
82363           const { key } = data;
82364           if (!(key in _currScenes)) {
82365             let newSceneOptions = {
82366               showFullscreenCtrl: false,
82367               autoLoad: false,
82368               compass: false,
82369               yaw: 0,
82370               type: "equirectangular",
82371               preview: data.preview_path,
82372               panorama: data.image_path,
82373               northOffset: data.ca
82374             };
82375             _currScenes.push(key);
82376             _pannellumViewer.addScene(key, newSceneOptions);
82377           }
82378           let yaw = 0;
82379           let pitch = 0;
82380           let hfov = 0;
82381           if (keepOrientation) {
82382             yaw = this.getYaw();
82383             pitch = this.getPitch();
82384             hfov = this.getHfov();
82385           }
82386           _pannellumViewer.loadScene(key, pitch, yaw, hfov);
82387           dispatch7.call("viewerChanged");
82388           if (_currScenes.length > 3) {
82389             const old_key = _currScenes.shift();
82390             _pannellumViewer.removeScene(old_key);
82391           }
82392           _pannellumViewer.resize();
82393           return this;
82394         },
82395         getYaw: function() {
82396           return _pannellumViewer.getYaw();
82397         },
82398         getPitch: function() {
82399           return _pannellumViewer.getPitch();
82400         },
82401         getHfov: function() {
82402           return _pannellumViewer.getHfov();
82403         }
82404       };
82405     }
82406   });
82407
82408   // modules/services/vegbilder.js
82409   var vegbilder_exports2 = {};
82410   __export(vegbilder_exports2, {
82411     default: () => vegbilder_default
82412   });
82413   async function fetchAvailableLayers() {
82414     var _a3, _b2, _c;
82415     const params = {
82416       service: "WFS",
82417       request: "GetCapabilities",
82418       version: "2.0.0"
82419     };
82420     const urlForRequest = owsEndpoint + utilQsString(params);
82421     const response = await xml_default(urlForRequest);
82422     const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
82423     const availableLayers = [];
82424     for (const node of response.querySelectorAll("FeatureType > Name")) {
82425       const match = (_a3 = node.textContent) == null ? void 0 : _a3.match(regexMatcher);
82426       if (match) {
82427         availableLayers.push({
82428           name: match[0],
82429           is_sphere: !!((_b2 = match.groups) == null ? void 0 : _b2.image_type),
82430           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
82431         });
82432       }
82433     }
82434     return availableLayers;
82435   }
82436   function filterAvailableLayers(photoContex) {
82437     const fromDateString = photoContex.fromDate();
82438     const toDateString = photoContex.toDate();
82439     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
82440     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
82441     const showsFlat = photoContex.showsFlat();
82442     const showsPano = photoContex.showsPanoramic();
82443     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
82444   }
82445   function loadWFSLayers(projection2, margin, wfslayers) {
82446     const tiles = tiler4.margin(margin).getTiles(projection2);
82447     for (const cache of wfslayers) {
82448       loadWFSLayer(projection2, cache, tiles);
82449     }
82450   }
82451   function loadWFSLayer(projection2, cache, tiles) {
82452     for (const [key, controller] of cache.inflight.entries()) {
82453       const wanted = tiles.some((tile) => key === tile.id);
82454       if (!wanted) {
82455         controller.abort();
82456         cache.inflight.delete(key);
82457       }
82458     }
82459     Promise.all(tiles.map(
82460       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
82461     )).then(() => orderSequences(projection2, cache));
82462   }
82463   async function loadTile2(cache, typename, tile) {
82464     const bbox2 = tile.extent.bbox();
82465     const tileid = tile.id;
82466     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
82467     const params = {
82468       service: "WFS",
82469       request: "GetFeature",
82470       version: "2.0.0",
82471       typenames: typename,
82472       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
82473       outputFormat: "json"
82474     };
82475     const controller = new AbortController();
82476     cache.inflight.set(tileid, controller);
82477     const options2 = {
82478       method: "GET",
82479       signal: controller.signal
82480     };
82481     const urlForRequest = owsEndpoint + utilQsString(params);
82482     let featureCollection;
82483     try {
82484       featureCollection = await json_default(urlForRequest, options2);
82485     } catch {
82486       cache.loaded.set(tileid, false);
82487       return;
82488     } finally {
82489       cache.inflight.delete(tileid);
82490     }
82491     cache.loaded.set(tileid, true);
82492     if (featureCollection.features.length === 0) {
82493       return;
82494     }
82495     const features = featureCollection.features.map((feature3) => {
82496       const loc = feature3.geometry.coordinates;
82497       const key = feature3.id;
82498       const properties = feature3.properties;
82499       const {
82500         RETNING: ca,
82501         TIDSPUNKT: captured_at,
82502         URL: image_path,
82503         URLPREVIEW: preview_path,
82504         BILDETYPE: image_type,
82505         METER: metering,
82506         FELTKODE: lane_code
82507       } = properties;
82508       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
82509       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
82510       const data = {
82511         service: "photo",
82512         loc,
82513         key,
82514         ca,
82515         image_path,
82516         preview_path,
82517         road_reference: roadReference(properties),
82518         metering,
82519         lane_code,
82520         direction,
82521         captured_at: new Date(captured_at),
82522         is_sphere: image_type === "360"
82523       };
82524       cache.points.set(key, data);
82525       return {
82526         minX: loc[0],
82527         minY: loc[1],
82528         maxX: loc[0],
82529         maxY: loc[1],
82530         data
82531       };
82532     });
82533     _vegbilderCache.rtree.load(features);
82534     dispatch8.call("loadedImages");
82535   }
82536   function orderSequences(projection2, cache) {
82537     const { points } = cache;
82538     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
82539       const key = image.road_reference;
82540       if (grouped2.has(key)) {
82541         grouped2.get(key).push(image);
82542       } else {
82543         grouped2.set(key, [image]);
82544       }
82545       return grouped2;
82546     }, /* @__PURE__ */ new Map());
82547     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
82548       imageGroup.sort((a2, b2) => {
82549         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
82550           return 1;
82551         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
82552           return -1;
82553         } else {
82554           const { direction } = a2;
82555           if (direction === directionEnum.forward) {
82556             return a2.metering - b2.metering;
82557           } else {
82558             return b2.metering - a2.metering;
82559           }
82560         }
82561       });
82562       let imageSequence = [imageGroup[0]];
82563       let angle2 = null;
82564       for (const [lastImage, image] of pairs(imageGroup)) {
82565         if (lastImage.ca === null) {
82566           const b2 = projection2(lastImage.loc);
82567           const a2 = projection2(image.loc);
82568           if (!geoVecEqual(a2, b2)) {
82569             angle2 = geoVecAngle(a2, b2);
82570             angle2 *= 180 / Math.PI;
82571             angle2 -= 90;
82572             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
82573           }
82574           lastImage.ca = angle2;
82575         }
82576         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
82577           imageSequence.push(image);
82578         } else {
82579           imageSequences2.push(imageSequence);
82580           imageSequence = [image];
82581         }
82582       }
82583       imageSequences2.push(imageSequence);
82584       return imageSequences2;
82585     }, []);
82586     cache.sequences = imageSequences.map((images) => {
82587       const sequence = {
82588         images,
82589         key: images[0].key,
82590         geometry: {
82591           type: "LineString",
82592           coordinates: images.map((image) => image.loc)
82593         }
82594       };
82595       for (const image of images) {
82596         _vegbilderCache.image2sequence_map.set(image.key, sequence);
82597       }
82598       return sequence;
82599     });
82600   }
82601   function roadReference(properties) {
82602     const {
82603       FYLKENUMMER: county_number,
82604       VEGKATEGORI: road_class,
82605       VEGSTATUS: road_status,
82606       VEGNUMMER: road_number,
82607       STREKNING: section,
82608       DELSTREKNING: subsection,
82609       HP: parcel,
82610       KRYSSDEL: junction_part,
82611       SIDEANLEGGSDEL: services_part,
82612       ANKERPUNKT: anker_point,
82613       AAR: year
82614     } = properties;
82615     let reference;
82616     if (year >= 2020) {
82617       reference = `${road_class}${road_status}${road_number} S${section}D${subsection}`;
82618       if (junction_part) {
82619         reference = `${reference} M${anker_point} KD${junction_part}`;
82620       } else if (services_part) {
82621         reference = `${reference} M${anker_point} SD${services_part}`;
82622       }
82623     } else {
82624       reference = `${county_number}${road_class}${road_status}${road_number} HP${parcel}`;
82625     }
82626     return reference;
82627   }
82628   function localeTimestamp(date) {
82629     const options2 = {
82630       day: "2-digit",
82631       month: "2-digit",
82632       year: "numeric",
82633       hour: "numeric",
82634       minute: "numeric",
82635       second: "numeric"
82636     };
82637     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
82638   }
82639   function partitionViewport3(projection2) {
82640     const zoom = geoScaleToZoom(projection2.scale());
82641     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
82642     const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
82643     return tiler8.getTiles(projection2).map((tile) => tile.extent);
82644   }
82645   function searchLimited3(limit, projection2, rtree) {
82646     limit != null ? limit : limit = 5;
82647     return partitionViewport3(projection2).reduce((result, extent) => {
82648       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
82649       return result.concat(found);
82650     }, []);
82651   }
82652   var owsEndpoint, tileZoom2, tiler4, dispatch8, directionEnum, _planeFrame, _pannellumFrame, _currentFrame, _loadViewerPromise3, _vegbilderCache, vegbilder_default;
82653   var init_vegbilder2 = __esm({
82654     "modules/services/vegbilder.js"() {
82655       "use strict";
82656       init_src18();
82657       init_src4();
82658       init_src();
82659       init_rbush();
82660       init_country_coder();
82661       init_localizer();
82662       init_util();
82663       init_geo2();
82664       init_pannellum_photo();
82665       init_plane_photo();
82666       init_services();
82667       owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
82668       tileZoom2 = 14;
82669       tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
82670       dispatch8 = dispatch_default("loadedImages", "viewerChanged");
82671       directionEnum = Object.freeze({
82672         forward: Symbol(0),
82673         backward: Symbol(1)
82674       });
82675       vegbilder_default = {
82676         init: function() {
82677           this.event = utilRebind(this, dispatch8, "on");
82678         },
82679         reset: async function() {
82680           if (_vegbilderCache) {
82681             for (const layer of _vegbilderCache.wfslayers.values()) {
82682               for (const controller of layer.inflight.values()) {
82683                 controller.abort();
82684               }
82685             }
82686           }
82687           _vegbilderCache = {
82688             wfslayers: /* @__PURE__ */ new Map(),
82689             rtree: new RBush(),
82690             image2sequence_map: /* @__PURE__ */ new Map()
82691           };
82692           const availableLayers = await fetchAvailableLayers();
82693           const { wfslayers } = _vegbilderCache;
82694           for (const layerInfo of availableLayers) {
82695             const cache = {
82696               layerInfo,
82697               loaded: /* @__PURE__ */ new Map(),
82698               inflight: /* @__PURE__ */ new Map(),
82699               points: /* @__PURE__ */ new Map(),
82700               sequences: []
82701             };
82702             wfslayers.set(layerInfo.name, cache);
82703           }
82704         },
82705         images: function(projection2) {
82706           const limit = 5;
82707           return searchLimited3(limit, projection2, _vegbilderCache.rtree);
82708         },
82709         sequences: function(projection2) {
82710           const viewport = projection2.clipExtent();
82711           const min3 = [viewport[0][0], viewport[1][1]];
82712           const max3 = [viewport[1][0], viewport[0][1]];
82713           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
82714           const seen = /* @__PURE__ */ new Set();
82715           const line_strings = [];
82716           for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
82717             const sequence = _vegbilderCache.image2sequence_map.get(data.key);
82718             if (!sequence) continue;
82719             const { key, geometry, images } = sequence;
82720             if (seen.has(key)) continue;
82721             seen.add(key);
82722             const line = {
82723               type: "LineString",
82724               coordinates: geometry.coordinates,
82725               key,
82726               images
82727             };
82728             line_strings.push(line);
82729           }
82730           return line_strings;
82731         },
82732         cachedImage: function(key) {
82733           for (const { points } of _vegbilderCache.wfslayers.values()) {
82734             if (points.has(key)) return points.get(key);
82735           }
82736         },
82737         getSequenceForImage: function(image) {
82738           return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
82739         },
82740         loadImages: async function(context, margin) {
82741           if (!_vegbilderCache) {
82742             await this.reset();
82743           }
82744           margin != null ? margin : margin = 1;
82745           const wfslayers = filterAvailableLayers(context.photos());
82746           loadWFSLayers(context.projection, margin, wfslayers);
82747         },
82748         photoFrame: function() {
82749           return _currentFrame;
82750         },
82751         ensureViewerLoaded: function(context) {
82752           if (_loadViewerPromise3) return _loadViewerPromise3;
82753           const step = (stepBy) => () => {
82754             const viewer = context.container().select(".photoviewer");
82755             const selected = viewer.empty() ? void 0 : viewer.datum();
82756             if (!selected) return;
82757             const sequence = this.getSequenceForImage(selected);
82758             const nextIndex = sequence.images.indexOf(selected) + stepBy;
82759             const nextImage = sequence.images[nextIndex];
82760             if (!nextImage) return;
82761             context.map().centerEase(nextImage.loc);
82762             this.selectImage(context, nextImage.key, true);
82763           };
82764           const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
82765           const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
82766           wrapEnter.append("div").attr("class", "photo-attribution fillD");
82767           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
82768           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
82769           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
82770           _loadViewerPromise3 = Promise.all([
82771             pannellum_photo_default.init(context, wrapEnter),
82772             plane_photo_default.init(context, wrapEnter)
82773           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
82774             _pannellumFrame = pannellumPhotoFrame;
82775             _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
82776             _planeFrame = planePhotoFrame;
82777             _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
82778           });
82779           return _loadViewerPromise3;
82780         },
82781         selectImage: function(context, key, keepOrientation) {
82782           const d2 = this.cachedImage(key);
82783           this.updateUrlImage(key);
82784           const viewer = context.container().select(".photoviewer");
82785           if (!viewer.empty()) {
82786             viewer.datum(d2);
82787           }
82788           this.setStyles(context, null, true);
82789           if (!d2) return this;
82790           const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
82791           const attribution = wrap2.selectAll(".photo-attribution").text("");
82792           if (d2.captured_at) {
82793             attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
82794           }
82795           attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
82796           attribution.append("a").attr("target", "_blank").attr("href", `https://vegbilder.atlas.vegvesen.no/?year=${d2.captured_at.getFullYear()}&lat=${d2.loc[1]}&lng=${d2.loc[0]}&view=image&imageId=${d2.key}`).call(_t.append("vegbilder.view_on"));
82797           _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
82798           _currentFrame.showPhotoFrame(wrap2).selectPhoto(d2, keepOrientation);
82799           return this;
82800         },
82801         showViewer: function(context) {
82802           const viewer = context.container().select(".photoviewer");
82803           const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
82804           if (isHidden) {
82805             for (const service of Object.values(services)) {
82806               if (service === this) continue;
82807               if (typeof service.hideViewer === "function") {
82808                 service.hideViewer(context);
82809               }
82810             }
82811             viewer.classed("hide", false).selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
82812           }
82813           return this;
82814         },
82815         hideViewer: function(context) {
82816           this.updateUrlImage(null);
82817           const viewer = context.container().select(".photoviewer");
82818           if (!viewer.empty()) viewer.datum(null);
82819           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
82820           context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
82821           return this.setStyles(context, null, true);
82822         },
82823         // Updates the currently highlighted sequence and selected bubble.
82824         // Reset is only necessary when interacting with the viewport because
82825         // this implicitly changes the currently selected bubble/sequence
82826         setStyles: function(context, hovered, reset) {
82827           var _a3, _b2;
82828           if (reset) {
82829             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
82830             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
82831           }
82832           const hoveredImageKey = hovered == null ? void 0 : hovered.key;
82833           const hoveredSequence = this.getSequenceForImage(hovered);
82834           const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
82835           const hoveredImageKeys = (_a3 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a3 : [];
82836           const viewer = context.container().select(".photoviewer");
82837           const selected = viewer.empty() ? void 0 : viewer.datum();
82838           const selectedImageKey = selected == null ? void 0 : selected.key;
82839           const selectedSequence = this.getSequenceForImage(selected);
82840           const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
82841           const selectedImageKeys = (_b2 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b2 : [];
82842           const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
82843           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);
82844           context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
82845           context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
82846           function viewfieldPath() {
82847             const d2 = this.parentNode.__data__;
82848             if (d2.is_sphere && d2.key !== selectedImageKey) {
82849               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
82850             } else {
82851               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
82852             }
82853           }
82854           return this;
82855         },
82856         updateUrlImage: function(key) {
82857           const hash2 = utilStringQs(window.location.hash);
82858           if (key) {
82859             hash2.photo = "vegbilder/" + key;
82860           } else {
82861             delete hash2.photo;
82862           }
82863           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
82864         },
82865         validHere: function(extent) {
82866           const bbox2 = Object.values(extent.bbox());
82867           return iso1A2Codes(bbox2).includes("NO");
82868         },
82869         cache: function() {
82870           return _vegbilderCache;
82871         }
82872       };
82873     }
82874   });
82875
82876   // node_modules/osm-auth/src/osm-auth.mjs
82877   function osmAuth(o2) {
82878     var oauth2 = {};
82879     var _store = null;
82880     try {
82881       _store = window.localStorage;
82882     } catch (e3) {
82883       var _mock = /* @__PURE__ */ new Map();
82884       _store = {
82885         isMocked: true,
82886         hasItem: (k2) => _mock.has(k2),
82887         getItem: (k2) => _mock.get(k2),
82888         setItem: (k2, v2) => _mock.set(k2, v2),
82889         removeItem: (k2) => _mock.delete(k2),
82890         clear: () => _mock.clear()
82891       };
82892     }
82893     function token(k2, v2) {
82894       var key = o2.url + k2;
82895       if (arguments.length === 1) {
82896         var val = _store.getItem(key) || "";
82897         return val.replace(/"/g, "");
82898       } else if (arguments.length === 2) {
82899         if (v2) {
82900           return _store.setItem(key, v2);
82901         } else {
82902           return _store.removeItem(key);
82903         }
82904       }
82905     }
82906     oauth2.authenticated = function() {
82907       return !!token("oauth2_access_token");
82908     };
82909     oauth2.logout = function() {
82910       token("oauth2_access_token", "");
82911       token("oauth_token", "");
82912       token("oauth_token_secret", "");
82913       token("oauth_request_token_secret", "");
82914       return oauth2;
82915     };
82916     oauth2.authenticate = function(callback, options2) {
82917       if (oauth2.authenticated()) {
82918         callback(null, oauth2);
82919         return;
82920       }
82921       oauth2.logout();
82922       _preopenPopup(function(error, popup) {
82923         if (error) {
82924           callback(error);
82925         } else {
82926           _generatePkceChallenge(function(pkce) {
82927             _authenticate(pkce, options2, popup, callback);
82928           });
82929         }
82930       });
82931     };
82932     oauth2.authenticateAsync = function(options2) {
82933       if (oauth2.authenticated()) {
82934         return Promise.resolve(oauth2);
82935       }
82936       oauth2.logout();
82937       return new Promise((resolve, reject) => {
82938         var errback = (err, result) => {
82939           if (err) {
82940             reject(err);
82941           } else {
82942             resolve(result);
82943           }
82944         };
82945         _preopenPopup((error, popup) => {
82946           if (error) {
82947             errback(error);
82948           } else {
82949             _generatePkceChallenge((pkce) => _authenticate(pkce, options2, popup, errback));
82950           }
82951         });
82952       });
82953     };
82954     function _preopenPopup(callback) {
82955       if (o2.singlepage) {
82956         callback(null, void 0);
82957         return;
82958       }
82959       var w2 = 550;
82960       var h2 = 610;
82961       var settings = [
82962         ["width", w2],
82963         ["height", h2],
82964         ["left", window.screen.width / 2 - w2 / 2],
82965         ["top", window.screen.height / 2 - h2 / 2]
82966       ].map(function(x2) {
82967         return x2.join("=");
82968       }).join(",");
82969       var popup = window.open("about:blank", "oauth_window", settings);
82970       if (popup) {
82971         callback(null, popup);
82972       } else {
82973         var error = new Error("Popup was blocked");
82974         error.status = "popup-blocked";
82975         callback(error);
82976       }
82977     }
82978     function _authenticate(pkce, options2, popup, callback) {
82979       var state = generateState();
82980       var path = "/oauth2/authorize?" + utilQsString2({
82981         client_id: o2.client_id,
82982         redirect_uri: o2.redirect_uri,
82983         response_type: "code",
82984         scope: o2.scope,
82985         state,
82986         code_challenge: pkce.code_challenge,
82987         code_challenge_method: pkce.code_challenge_method,
82988         locale: o2.locale || ""
82989       });
82990       var url = (options2 == null ? void 0 : options2.switchUser) ? `${o2.url}/logout?referer=${encodeURIComponent(`/login?referer=${encodeURIComponent(path)}`)}` : o2.url + path;
82991       if (o2.singlepage) {
82992         if (_store.isMocked) {
82993           var error = new Error("localStorage unavailable, but required in singlepage mode");
82994           error.status = "pkce-localstorage-unavailable";
82995           callback(error);
82996           return;
82997         }
82998         var params = utilStringQs2(window.location.search.slice(1));
82999         if (params.code) {
83000           oauth2.bootstrapToken(params.code, callback);
83001         } else {
83002           token("oauth2_state", state);
83003           token("oauth2_pkce_code_verifier", pkce.code_verifier);
83004           window.location = url;
83005         }
83006       } else {
83007         var popupClosedWatcher = setInterval(function() {
83008           if (popup.closed) {
83009             var error2 = new Error("Popup was closed prematurely");
83010             error2.status = "popup-closed";
83011             callback(error2);
83012             window.clearInterval(popupClosedWatcher);
83013             delete window.authComplete;
83014           }
83015         }, 1e3);
83016         oauth2.popupWindow = popup;
83017         popup.location = url;
83018       }
83019       window.authComplete = function(url2) {
83020         clearTimeout(popupClosedWatcher);
83021         var params2 = utilStringQs2(url2.split("?")[1]);
83022         if (params2.state !== state) {
83023           var error2 = new Error("Invalid state");
83024           error2.status = "invalid-state";
83025           callback(error2);
83026           return;
83027         }
83028         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
83029         delete window.authComplete;
83030       };
83031       function accessTokenDone(err, xhr) {
83032         o2.done();
83033         if (err) {
83034           callback(err);
83035           return;
83036         }
83037         var access_token = JSON.parse(xhr.response);
83038         token("oauth2_access_token", access_token.access_token);
83039         callback(null, oauth2);
83040       }
83041     }
83042     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
83043       var url = o2.url + "/oauth2/token?" + utilQsString2({
83044         client_id: o2.client_id,
83045         redirect_uri: o2.redirect_uri,
83046         grant_type: "authorization_code",
83047         code: auth_code,
83048         code_verifier
83049       });
83050       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
83051       o2.loading();
83052     }
83053     oauth2.bringPopupWindowToFront = function() {
83054       var broughtPopupToFront = false;
83055       try {
83056         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
83057           oauth2.popupWindow.focus();
83058           broughtPopupToFront = true;
83059         }
83060       } catch (err) {
83061       }
83062       return broughtPopupToFront;
83063     };
83064     oauth2.bootstrapToken = function(auth_code, callback) {
83065       var state = token("oauth2_state");
83066       token("oauth2_state", "");
83067       var params = utilStringQs2(window.location.search.slice(1));
83068       if (params.state !== state) {
83069         var error = new Error("Invalid state");
83070         error.status = "invalid-state";
83071         callback(error);
83072         return;
83073       }
83074       var code_verifier = token("oauth2_pkce_code_verifier");
83075       token("oauth2_pkce_code_verifier", "");
83076       _getAccessToken(auth_code, code_verifier, accessTokenDone);
83077       function accessTokenDone(err, xhr) {
83078         o2.done();
83079         if (err) {
83080           callback(err);
83081           return;
83082         }
83083         var access_token = JSON.parse(xhr.response);
83084         token("oauth2_access_token", access_token.access_token);
83085         callback(null, oauth2);
83086       }
83087     };
83088     oauth2.fetch = function(resource, options2) {
83089       if (oauth2.authenticated()) {
83090         return _doFetch();
83091       } else {
83092         if (o2.auto) {
83093           return oauth2.authenticateAsync().then(_doFetch);
83094         } else {
83095           return Promise.reject(new Error("not authenticated"));
83096         }
83097       }
83098       function _doFetch() {
83099         options2 = options2 || {};
83100         if (!options2.headers) {
83101           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
83102         }
83103         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
83104         return fetch(resource, options2);
83105       }
83106     };
83107     oauth2.xhr = function(options2, callback) {
83108       if (oauth2.authenticated()) {
83109         return _doXHR();
83110       } else {
83111         if (o2.auto) {
83112           oauth2.authenticate(_doXHR);
83113           return;
83114         } else {
83115           callback("not authenticated", null);
83116           return;
83117         }
83118       }
83119       function _doXHR() {
83120         var url = options2.prefix !== false ? o2.apiUrl + options2.path : options2.path;
83121         return oauth2.rawxhr(
83122           options2.method,
83123           url,
83124           token("oauth2_access_token"),
83125           options2.content,
83126           options2.headers,
83127           done
83128         );
83129       }
83130       function done(err, xhr) {
83131         if (err) {
83132           callback(err);
83133         } else if (xhr.responseXML) {
83134           callback(err, xhr.responseXML);
83135         } else {
83136           callback(err, xhr.response);
83137         }
83138       }
83139     };
83140     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
83141       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
83142       if (access_token) {
83143         headers.Authorization = "Bearer " + access_token;
83144       }
83145       var xhr = new XMLHttpRequest();
83146       xhr.onreadystatechange = function() {
83147         if (4 === xhr.readyState && 0 !== xhr.status) {
83148           if (/^20\d$/.test(xhr.status)) {
83149             callback(null, xhr);
83150           } else {
83151             callback(xhr, null);
83152           }
83153         }
83154       };
83155       xhr.onerror = function(e3) {
83156         callback(e3, null);
83157       };
83158       xhr.open(method, url, true);
83159       for (var h2 in headers) xhr.setRequestHeader(h2, headers[h2]);
83160       xhr.send(data);
83161       return xhr;
83162     };
83163     oauth2.preauth = function(val) {
83164       if (val && val.access_token) {
83165         token("oauth2_access_token", val.access_token);
83166       }
83167       return oauth2;
83168     };
83169     oauth2.options = function(val) {
83170       if (!arguments.length) return o2;
83171       o2 = val;
83172       o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
83173       o2.url = o2.url || "https://www.openstreetmap.org";
83174       o2.auto = o2.auto || false;
83175       o2.singlepage = o2.singlepage || false;
83176       o2.loading = o2.loading || function() {
83177       };
83178       o2.done = o2.done || function() {
83179       };
83180       return oauth2.preauth(o2);
83181     };
83182     oauth2.options(o2);
83183     return oauth2;
83184   }
83185   function utilQsString2(obj) {
83186     return Object.keys(obj).filter(function(key) {
83187       return obj[key] !== void 0;
83188     }).sort().map(function(key) {
83189       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
83190     }).join("&");
83191   }
83192   function utilStringQs2(str) {
83193     var i3 = 0;
83194     while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
83195     str = str.slice(i3);
83196     return str.split("&").reduce(function(obj, pair3) {
83197       var parts = pair3.split("=");
83198       if (parts.length === 2) {
83199         obj[parts[0]] = decodeURIComponent(parts[1]);
83200       }
83201       return obj;
83202     }, {});
83203   }
83204   function supportsWebCryptoAPI() {
83205     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
83206   }
83207   function _generatePkceChallenge(callback) {
83208     var code_verifier;
83209     if (supportsWebCryptoAPI()) {
83210       var random = window.crypto.getRandomValues(new Uint8Array(32));
83211       code_verifier = base64(random.buffer);
83212       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
83213         return char.charCodeAt(0);
83214       }));
83215       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash2) {
83216         var code_challenge = base64(hash2);
83217         callback({
83218           code_challenge,
83219           code_verifier,
83220           code_challenge_method: "S256"
83221         });
83222       });
83223     } else {
83224       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
83225       code_verifier = "";
83226       for (var i3 = 0; i3 < 64; i3++) {
83227         code_verifier += chars[Math.floor(Math.random() * chars.length)];
83228       }
83229       callback({
83230         code_verifier,
83231         code_challenge: code_verifier,
83232         code_challenge_method: "plain"
83233       });
83234     }
83235   }
83236   function generateState() {
83237     var state;
83238     if (supportsWebCryptoAPI()) {
83239       var random = window.crypto.getRandomValues(new Uint8Array(32));
83240       state = base64(random.buffer);
83241     } else {
83242       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
83243       state = "";
83244       for (var i3 = 0; i3 < 64; i3++) {
83245         state += chars[Math.floor(Math.random() * chars.length)];
83246       }
83247     }
83248     return state;
83249   }
83250   function base64(buffer) {
83251     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
83252   }
83253   var init_osm_auth = __esm({
83254     "node_modules/osm-auth/src/osm-auth.mjs"() {
83255     }
83256   });
83257
83258   // modules/services/osm.js
83259   var osm_exports3 = {};
83260   __export(osm_exports3, {
83261     default: () => osm_default
83262   });
83263   function authLoading() {
83264     dispatch9.call("authLoading");
83265   }
83266   function authDone() {
83267     dispatch9.call("authDone");
83268   }
83269   function abortRequest4(controllerOrXHR) {
83270     if (controllerOrXHR) {
83271       controllerOrXHR.abort();
83272     }
83273   }
83274   function hasInflightRequests(cache) {
83275     return Object.keys(cache.inflight).length;
83276   }
83277   function abortUnwantedRequests3(cache, visibleTiles) {
83278     Object.keys(cache.inflight).forEach(function(k2) {
83279       if (cache.toLoad[k2]) return;
83280       if (visibleTiles.find(function(tile) {
83281         return k2 === tile.id;
83282       })) return;
83283       abortRequest4(cache.inflight[k2]);
83284       delete cache.inflight[k2];
83285     });
83286   }
83287   function getLoc(attrs) {
83288     var lon = attrs.lon && attrs.lon.value;
83289     var lat = attrs.lat && attrs.lat.value;
83290     return [Number(lon), Number(lat)];
83291   }
83292   function getNodes(obj) {
83293     var elems = obj.getElementsByTagName("nd");
83294     var nodes = new Array(elems.length);
83295     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83296       nodes[i3] = "n" + elems[i3].attributes.ref.value;
83297     }
83298     return nodes;
83299   }
83300   function getNodesJSON(obj) {
83301     var elems = obj.nodes;
83302     var nodes = new Array(elems.length);
83303     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83304       nodes[i3] = "n" + elems[i3];
83305     }
83306     return nodes;
83307   }
83308   function getTags(obj) {
83309     var elems = obj.getElementsByTagName("tag");
83310     var tags = {};
83311     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83312       var attrs = elems[i3].attributes;
83313       tags[attrs.k.value] = attrs.v.value;
83314     }
83315     return tags;
83316   }
83317   function getMembers(obj) {
83318     var elems = obj.getElementsByTagName("member");
83319     var members = new Array(elems.length);
83320     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83321       var attrs = elems[i3].attributes;
83322       members[i3] = {
83323         id: attrs.type.value[0] + attrs.ref.value,
83324         type: attrs.type.value,
83325         role: attrs.role.value
83326       };
83327     }
83328     return members;
83329   }
83330   function getMembersJSON(obj) {
83331     var elems = obj.members;
83332     var members = new Array(elems.length);
83333     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
83334       var attrs = elems[i3];
83335       members[i3] = {
83336         id: attrs.type[0] + attrs.ref,
83337         type: attrs.type,
83338         role: attrs.role
83339       };
83340     }
83341     return members;
83342   }
83343   function getVisible(attrs) {
83344     return !attrs.visible || attrs.visible.value !== "false";
83345   }
83346   function parseComments(comments) {
83347     var parsedComments = [];
83348     for (var i3 = 0; i3 < comments.length; i3++) {
83349       var comment = comments[i3];
83350       if (comment.nodeName === "comment") {
83351         var childNodes = comment.childNodes;
83352         var parsedComment = {};
83353         for (var j2 = 0; j2 < childNodes.length; j2++) {
83354           var node = childNodes[j2];
83355           var nodeName = node.nodeName;
83356           if (nodeName === "#text") continue;
83357           parsedComment[nodeName] = node.textContent;
83358           if (nodeName === "uid") {
83359             var uid = node.textContent;
83360             if (uid && !_userCache.user[uid]) {
83361               _userCache.toLoad[uid] = true;
83362             }
83363           }
83364         }
83365         if (parsedComment) {
83366           parsedComments.push(parsedComment);
83367         }
83368       }
83369     }
83370     return parsedComments;
83371   }
83372   function encodeNoteRtree(note) {
83373     return {
83374       minX: note.loc[0],
83375       minY: note.loc[1],
83376       maxX: note.loc[0],
83377       maxY: note.loc[1],
83378       data: note
83379     };
83380   }
83381   function parseJSON(payload, callback, options2) {
83382     options2 = Object.assign({ skipSeen: true }, options2);
83383     if (!payload) {
83384       return callback({ message: "No JSON", status: -1 });
83385     }
83386     var json = payload;
83387     if (typeof json !== "object") json = JSON.parse(payload);
83388     if (!json.elements) return callback({ message: "No JSON", status: -1 });
83389     var children2 = json.elements;
83390     var handle = window.requestIdleCallback(function() {
83391       _deferred.delete(handle);
83392       var results = [];
83393       var result;
83394       for (var i3 = 0; i3 < children2.length; i3++) {
83395         result = parseChild(children2[i3]);
83396         if (result) results.push(result);
83397       }
83398       callback(null, results);
83399     });
83400     _deferred.add(handle);
83401     function parseChild(child) {
83402       var parser3 = jsonparsers[child.type];
83403       if (!parser3) return null;
83404       var uid;
83405       uid = osmEntity.id.fromOSM(child.type, child.id);
83406       if (options2.skipSeen) {
83407         if (_tileCache.seen[uid]) return null;
83408         _tileCache.seen[uid] = true;
83409       }
83410       return parser3(child, uid);
83411     }
83412   }
83413   function parseUserJSON(payload, callback, options2) {
83414     options2 = Object.assign({ skipSeen: true }, options2);
83415     if (!payload) {
83416       return callback({ message: "No JSON", status: -1 });
83417     }
83418     var json = payload;
83419     if (typeof json !== "object") json = JSON.parse(payload);
83420     if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
83421     var objs = json.users || [json];
83422     var handle = window.requestIdleCallback(function() {
83423       _deferred.delete(handle);
83424       var results = [];
83425       var result;
83426       for (var i3 = 0; i3 < objs.length; i3++) {
83427         result = parseObj(objs[i3]);
83428         if (result) results.push(result);
83429       }
83430       callback(null, results);
83431     });
83432     _deferred.add(handle);
83433     function parseObj(obj) {
83434       var uid = obj.user.id && obj.user.id.toString();
83435       if (options2.skipSeen && _userCache.user[uid]) {
83436         delete _userCache.toLoad[uid];
83437         return null;
83438       }
83439       var user = jsonparsers.user(obj.user, uid);
83440       _userCache.user[uid] = user;
83441       delete _userCache.toLoad[uid];
83442       return user;
83443     }
83444   }
83445   function parseXML(xml, callback, options2) {
83446     options2 = Object.assign({ skipSeen: true }, options2);
83447     if (!xml || !xml.childNodes) {
83448       return callback({ message: "No XML", status: -1 });
83449     }
83450     var root3 = xml.childNodes[0];
83451     var children2 = root3.childNodes;
83452     var handle = window.requestIdleCallback(function() {
83453       _deferred.delete(handle);
83454       var results = [];
83455       var result;
83456       for (var i3 = 0; i3 < children2.length; i3++) {
83457         result = parseChild(children2[i3]);
83458         if (result) results.push(result);
83459       }
83460       callback(null, results);
83461     });
83462     _deferred.add(handle);
83463     function parseChild(child) {
83464       var parser3 = parsers[child.nodeName];
83465       if (!parser3) return null;
83466       var uid;
83467       if (child.nodeName === "user") {
83468         uid = child.attributes.id.value;
83469         if (options2.skipSeen && _userCache.user[uid]) {
83470           delete _userCache.toLoad[uid];
83471           return null;
83472         }
83473       } else if (child.nodeName === "note") {
83474         uid = child.getElementsByTagName("id")[0].textContent;
83475       } else {
83476         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
83477         if (options2.skipSeen) {
83478           if (_tileCache.seen[uid]) return null;
83479           _tileCache.seen[uid] = true;
83480         }
83481       }
83482       return parser3(child, uid);
83483     }
83484   }
83485   function updateRtree3(item, replace) {
83486     _noteCache.rtree.remove(item, function isEql(a2, b2) {
83487       return a2.data.id === b2.data.id;
83488     });
83489     if (replace) {
83490       _noteCache.rtree.insert(item);
83491     }
83492   }
83493   function wrapcb(thisArg, callback, cid) {
83494     return function(err, result) {
83495       if (err) {
83496         return callback.call(thisArg, err);
83497       } else if (thisArg.getConnectionId() !== cid) {
83498         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
83499       } else {
83500         return callback.call(thisArg, err, result);
83501       }
83502     };
83503   }
83504   var tiler5, dispatch9, urlroot, apiUrlroot, redirectPath, oauth, _apiConnections, _imageryBlocklists, _tileCache, _noteCache, _userCache, _cachedApiStatus, _changeset, _deferred, _connectionID, _tileZoom3, _noteZoom, _rateLimitError, _userChangesets, _userDetails, _off, _maxWayNodes, jsonparsers, parsers, osm_default;
83505   var init_osm3 = __esm({
83506     "modules/services/osm.js"() {
83507       "use strict";
83508       init_throttle();
83509       init_src4();
83510       init_src18();
83511       init_osm_auth();
83512       init_rbush();
83513       init_jxon();
83514       init_geo2();
83515       init_osm();
83516       init_util();
83517       init_localizer();
83518       init_id();
83519       tiler5 = utilTiler();
83520       dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
83521       urlroot = osmApiConnections[0].url;
83522       apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
83523       redirectPath = window.location.origin + window.location.pathname;
83524       oauth = osmAuth({
83525         url: urlroot,
83526         apiUrl: apiUrlroot,
83527         client_id: osmApiConnections[0].client_id,
83528         scope: "read_prefs write_prefs write_api read_gpx write_notes",
83529         redirect_uri: redirectPath + "land.html",
83530         loading: authLoading,
83531         done: authDone
83532       });
83533       _apiConnections = osmApiConnections;
83534       _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
83535       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
83536       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
83537       _userCache = { toLoad: {}, user: {} };
83538       _changeset = {};
83539       _deferred = /* @__PURE__ */ new Set();
83540       _connectionID = 1;
83541       _tileZoom3 = 16;
83542       _noteZoom = 12;
83543       _maxWayNodes = 2e3;
83544       jsonparsers = {
83545         node: function nodeData(obj, uid) {
83546           return new osmNode({
83547             id: uid,
83548             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83549             version: obj.version && obj.version.toString(),
83550             changeset: obj.changeset && obj.changeset.toString(),
83551             timestamp: obj.timestamp,
83552             user: obj.user,
83553             uid: obj.uid && obj.uid.toString(),
83554             loc: [Number(obj.lon), Number(obj.lat)],
83555             tags: obj.tags
83556           });
83557         },
83558         way: function wayData(obj, uid) {
83559           return new osmWay({
83560             id: uid,
83561             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83562             version: obj.version && obj.version.toString(),
83563             changeset: obj.changeset && obj.changeset.toString(),
83564             timestamp: obj.timestamp,
83565             user: obj.user,
83566             uid: obj.uid && obj.uid.toString(),
83567             tags: obj.tags,
83568             nodes: getNodesJSON(obj)
83569           });
83570         },
83571         relation: function relationData(obj, uid) {
83572           return new osmRelation({
83573             id: uid,
83574             visible: typeof obj.visible === "boolean" ? obj.visible : true,
83575             version: obj.version && obj.version.toString(),
83576             changeset: obj.changeset && obj.changeset.toString(),
83577             timestamp: obj.timestamp,
83578             user: obj.user,
83579             uid: obj.uid && obj.uid.toString(),
83580             tags: obj.tags,
83581             members: getMembersJSON(obj)
83582           });
83583         },
83584         user: function parseUser(obj, uid) {
83585           return {
83586             id: uid,
83587             display_name: obj.display_name,
83588             account_created: obj.account_created,
83589             image_url: obj.img && obj.img.href,
83590             changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
83591             active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
83592           };
83593         }
83594       };
83595       parsers = {
83596         node: function nodeData2(obj, uid) {
83597           var attrs = obj.attributes;
83598           return new osmNode({
83599             id: uid,
83600             visible: getVisible(attrs),
83601             version: attrs.version.value,
83602             changeset: attrs.changeset && attrs.changeset.value,
83603             timestamp: attrs.timestamp && attrs.timestamp.value,
83604             user: attrs.user && attrs.user.value,
83605             uid: attrs.uid && attrs.uid.value,
83606             loc: getLoc(attrs),
83607             tags: getTags(obj)
83608           });
83609         },
83610         way: function wayData2(obj, uid) {
83611           var attrs = obj.attributes;
83612           return new osmWay({
83613             id: uid,
83614             visible: getVisible(attrs),
83615             version: attrs.version.value,
83616             changeset: attrs.changeset && attrs.changeset.value,
83617             timestamp: attrs.timestamp && attrs.timestamp.value,
83618             user: attrs.user && attrs.user.value,
83619             uid: attrs.uid && attrs.uid.value,
83620             tags: getTags(obj),
83621             nodes: getNodes(obj)
83622           });
83623         },
83624         relation: function relationData2(obj, uid) {
83625           var attrs = obj.attributes;
83626           return new osmRelation({
83627             id: uid,
83628             visible: getVisible(attrs),
83629             version: attrs.version.value,
83630             changeset: attrs.changeset && attrs.changeset.value,
83631             timestamp: attrs.timestamp && attrs.timestamp.value,
83632             user: attrs.user && attrs.user.value,
83633             uid: attrs.uid && attrs.uid.value,
83634             tags: getTags(obj),
83635             members: getMembers(obj)
83636           });
83637         },
83638         note: function parseNote(obj, uid) {
83639           var attrs = obj.attributes;
83640           var childNodes = obj.childNodes;
83641           var props = {};
83642           props.id = uid;
83643           props.loc = getLoc(attrs);
83644           if (!_noteCache.note[uid]) {
83645             let coincident = false;
83646             const epsilon3 = 1e-5;
83647             do {
83648               if (coincident) {
83649                 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
83650               }
83651               const bbox2 = geoExtent(props.loc).bbox();
83652               coincident = _noteCache.rtree.search(bbox2).length;
83653             } while (coincident);
83654           } else {
83655             props.loc = _noteCache.note[uid].loc;
83656           }
83657           for (var i3 = 0; i3 < childNodes.length; i3++) {
83658             var node = childNodes[i3];
83659             var nodeName = node.nodeName;
83660             if (nodeName === "#text") continue;
83661             if (nodeName === "comments") {
83662               props[nodeName] = parseComments(node.childNodes);
83663             } else {
83664               props[nodeName] = node.textContent;
83665             }
83666           }
83667           var note = new osmNote(props);
83668           var item = encodeNoteRtree(note);
83669           _noteCache.note[note.id] = note;
83670           updateRtree3(item, true);
83671           return note;
83672         },
83673         user: function parseUser2(obj, uid) {
83674           var attrs = obj.attributes;
83675           var user = {
83676             id: uid,
83677             display_name: attrs.display_name && attrs.display_name.value,
83678             account_created: attrs.account_created && attrs.account_created.value,
83679             changesets_count: "0",
83680             active_blocks: "0"
83681           };
83682           var img = obj.getElementsByTagName("img");
83683           if (img && img[0] && img[0].getAttribute("href")) {
83684             user.image_url = img[0].getAttribute("href");
83685           }
83686           var changesets = obj.getElementsByTagName("changesets");
83687           if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
83688             user.changesets_count = changesets[0].getAttribute("count");
83689           }
83690           var blocks = obj.getElementsByTagName("blocks");
83691           if (blocks && blocks[0]) {
83692             var received = blocks[0].getElementsByTagName("received");
83693             if (received && received[0] && received[0].getAttribute("active")) {
83694               user.active_blocks = received[0].getAttribute("active");
83695             }
83696           }
83697           _userCache.user[uid] = user;
83698           delete _userCache.toLoad[uid];
83699           return user;
83700         }
83701       };
83702       osm_default = {
83703         init: function() {
83704           utilRebind(this, dispatch9, "on");
83705         },
83706         reset: function() {
83707           Array.from(_deferred).forEach(function(handle) {
83708             window.cancelIdleCallback(handle);
83709             _deferred.delete(handle);
83710           });
83711           _connectionID++;
83712           _userChangesets = void 0;
83713           _userDetails = void 0;
83714           _rateLimitError = void 0;
83715           Object.values(_tileCache.inflight).forEach(abortRequest4);
83716           Object.values(_noteCache.inflight).forEach(abortRequest4);
83717           Object.values(_noteCache.inflightPost).forEach(abortRequest4);
83718           if (_changeset.inflight) abortRequest4(_changeset.inflight);
83719           _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
83720           _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
83721           _userCache = { toLoad: {}, user: {} };
83722           _cachedApiStatus = void 0;
83723           _changeset = {};
83724           return this;
83725         },
83726         getConnectionId: function() {
83727           return _connectionID;
83728         },
83729         getUrlRoot: function() {
83730           return urlroot;
83731         },
83732         getApiUrlRoot: function() {
83733           return apiUrlroot;
83734         },
83735         changesetURL: function(changesetID) {
83736           return urlroot + "/changeset/" + changesetID;
83737         },
83738         changesetsURL: function(center, zoom) {
83739           var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83740           return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
83741         },
83742         entityURL: function(entity) {
83743           return urlroot + "/" + entity.type + "/" + entity.osmId();
83744         },
83745         historyURL: function(entity) {
83746           return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
83747         },
83748         userURL: function(username) {
83749           return urlroot + "/user/" + encodeURIComponent(username);
83750         },
83751         noteURL: function(note) {
83752           return urlroot + "/note/" + note.id;
83753         },
83754         noteReportURL: function(note) {
83755           return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
83756         },
83757         // Generic method to load data from the OSM API
83758         // Can handle either auth or unauth calls.
83759         loadFromAPI: function(path, callback, options2) {
83760           options2 = Object.assign({ skipSeen: true }, options2);
83761           var that = this;
83762           var cid = _connectionID;
83763           function done(err, payload) {
83764             if (that.getConnectionId() !== cid) {
83765               if (callback) callback({ message: "Connection Switched", status: -1 });
83766               return;
83767             }
83768             if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
83769               that.reloadApiStatus();
83770             }
83771             if (callback) {
83772               if (err) {
83773                 console.error("API error:", err);
83774                 return callback(err);
83775               } else {
83776                 if (path.indexOf(".json") !== -1) {
83777                   return parseJSON(payload, callback, options2);
83778                 } else {
83779                   return parseXML(payload, callback, options2);
83780                 }
83781               }
83782             }
83783           }
83784           if (this.authenticated()) {
83785             return oauth.xhr({
83786               method: "GET",
83787               path
83788             }, done);
83789           } else {
83790             var url = apiUrlroot + path;
83791             var controller = new AbortController();
83792             var fn;
83793             if (path.indexOf(".json") !== -1) {
83794               fn = json_default;
83795             } else {
83796               fn = xml_default;
83797             }
83798             fn(url, { signal: controller.signal }).then(function(data) {
83799               done(null, data);
83800             }).catch(function(err) {
83801               if (err.name === "AbortError") return;
83802               var match = err.message.match(/^\d{3}/);
83803               if (match) {
83804                 done({ status: +match[0], statusText: err.message });
83805               } else {
83806                 done(err.message);
83807               }
83808             });
83809             return controller;
83810           }
83811         },
83812         // Load a single entity by id (ways and relations use the `/full` call to include
83813         // nodes and members). Parent relations are not included, see `loadEntityRelations`.
83814         // GET /api/0.6/node/#id
83815         // GET /api/0.6/[way|relation]/#id/full
83816         loadEntity: function(id2, callback) {
83817           var type2 = osmEntity.id.type(id2);
83818           var osmID = osmEntity.id.toOSM(id2);
83819           var options2 = { skipSeen: false };
83820           this.loadFromAPI(
83821             "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
83822             function(err, entities) {
83823               if (callback) callback(err, { data: entities });
83824             },
83825             options2
83826           );
83827         },
83828         // Load a single note by id , XML format
83829         // GET /api/0.6/notes/#id
83830         loadEntityNote: function(id2, callback) {
83831           var options2 = { skipSeen: false };
83832           this.loadFromAPI(
83833             "/api/0.6/notes/" + id2,
83834             function(err, entities) {
83835               if (callback) callback(err, { data: entities });
83836             },
83837             options2
83838           );
83839         },
83840         // Load a single entity with a specific version
83841         // GET /api/0.6/[node|way|relation]/#id/#version
83842         loadEntityVersion: function(id2, version, callback) {
83843           var type2 = osmEntity.id.type(id2);
83844           var osmID = osmEntity.id.toOSM(id2);
83845           var options2 = { skipSeen: false };
83846           this.loadFromAPI(
83847             "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
83848             function(err, entities) {
83849               if (callback) callback(err, { data: entities });
83850             },
83851             options2
83852           );
83853         },
83854         // Load the relations of a single entity with the given.
83855         // GET /api/0.6/[node|way|relation]/#id/relations
83856         loadEntityRelations: function(id2, callback) {
83857           var type2 = osmEntity.id.type(id2);
83858           var osmID = osmEntity.id.toOSM(id2);
83859           var options2 = { skipSeen: false };
83860           this.loadFromAPI(
83861             "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
83862             function(err, entities) {
83863               if (callback) callback(err, { data: entities });
83864             },
83865             options2
83866           );
83867         },
83868         // Load multiple entities in chunks
83869         // (note: callback may be called multiple times)
83870         // Unlike `loadEntity`, child nodes and members are not fetched
83871         // GET /api/0.6/[nodes|ways|relations]?#parameters
83872         loadMultiple: function(ids, callback) {
83873           var that = this;
83874           var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
83875           Object.keys(groups).forEach(function(k2) {
83876             var type2 = k2 + "s";
83877             var osmIDs = groups[k2].map(function(id2) {
83878               return osmEntity.id.toOSM(id2);
83879             });
83880             var options2 = { skipSeen: false };
83881             utilArrayChunk(osmIDs, 150).forEach(function(arr) {
83882               that.loadFromAPI(
83883                 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
83884                 function(err, entities) {
83885                   if (callback) callback(err, { data: entities });
83886                 },
83887                 options2
83888               );
83889             });
83890           });
83891         },
83892         // Create, upload, and close a changeset
83893         // PUT /api/0.6/changeset/create
83894         // POST /api/0.6/changeset/#id/upload
83895         // PUT /api/0.6/changeset/#id/close
83896         putChangeset: function(changeset, changes, callback) {
83897           var cid = _connectionID;
83898           if (_changeset.inflight) {
83899             return callback({ message: "Changeset already inflight", status: -2 }, changeset);
83900           } else if (_changeset.open) {
83901             return createdChangeset.call(this, null, _changeset.open);
83902           } else {
83903             var options2 = {
83904               method: "PUT",
83905               path: "/api/0.6/changeset/create",
83906               headers: { "Content-Type": "text/xml" },
83907               content: JXON.stringify(changeset.asJXON())
83908             };
83909             _changeset.inflight = oauth.xhr(
83910               options2,
83911               wrapcb(this, createdChangeset, cid)
83912             );
83913           }
83914           function createdChangeset(err, changesetID) {
83915             _changeset.inflight = null;
83916             if (err) {
83917               return callback(err, changeset);
83918             }
83919             _changeset.open = changesetID;
83920             changeset = changeset.update({ id: changesetID });
83921             var options3 = {
83922               method: "POST",
83923               path: "/api/0.6/changeset/" + changesetID + "/upload",
83924               headers: { "Content-Type": "text/xml" },
83925               content: JXON.stringify(changeset.osmChangeJXON(changes))
83926             };
83927             _changeset.inflight = oauth.xhr(
83928               options3,
83929               wrapcb(this, uploadedChangeset, cid)
83930             );
83931           }
83932           function uploadedChangeset(err) {
83933             _changeset.inflight = null;
83934             if (err) return callback(err, changeset);
83935             window.setTimeout(function() {
83936               callback(null, changeset);
83937             }, 2500);
83938             _changeset.open = null;
83939             if (this.getConnectionId() === cid) {
83940               oauth.xhr({
83941                 method: "PUT",
83942                 path: "/api/0.6/changeset/" + changeset.id + "/close",
83943                 headers: { "Content-Type": "text/xml" }
83944               }, function() {
83945                 return true;
83946               });
83947             }
83948           }
83949         },
83950         /** updates the tags on an existing unclosed changeset */
83951         // PUT /api/0.6/changeset/#id
83952         updateChangesetTags: (changeset) => {
83953           return oauth.fetch(`${oauth.options().apiUrl}/api/0.6/changeset/${changeset.id}`, {
83954             method: "PUT",
83955             headers: { "Content-Type": "text/xml" },
83956             body: JXON.stringify(changeset.asJXON())
83957           });
83958         },
83959         // Load multiple users in chunks
83960         // (note: callback may be called multiple times)
83961         // GET /api/0.6/users?users=#id1,#id2,...,#idn
83962         loadUsers: function(uids, callback) {
83963           var toLoad = [];
83964           var cached = [];
83965           utilArrayUniq(uids).forEach(function(uid) {
83966             if (_userCache.user[uid]) {
83967               delete _userCache.toLoad[uid];
83968               cached.push(_userCache.user[uid]);
83969             } else {
83970               toLoad.push(uid);
83971             }
83972           });
83973           if (cached.length || !this.authenticated()) {
83974             callback(void 0, cached);
83975             if (!this.authenticated()) return;
83976           }
83977           utilArrayChunk(toLoad, 150).forEach((function(arr) {
83978             oauth.xhr({
83979               method: "GET",
83980               path: "/api/0.6/users.json?users=" + arr.join()
83981             }, wrapcb(this, done, _connectionID));
83982           }).bind(this));
83983           function done(err, payload) {
83984             if (err) return callback(err);
83985             var options2 = { skipSeen: true };
83986             return parseUserJSON(payload, function(err2, results) {
83987               if (err2) return callback(err2);
83988               return callback(void 0, results);
83989             }, options2);
83990           }
83991         },
83992         // Load a given user by id
83993         // GET /api/0.6/user/#id
83994         loadUser: function(uid, callback) {
83995           if (_userCache.user[uid] || !this.authenticated()) {
83996             delete _userCache.toLoad[uid];
83997             return callback(void 0, _userCache.user[uid]);
83998           }
83999           oauth.xhr({
84000             method: "GET",
84001             path: "/api/0.6/user/" + uid + ".json"
84002           }, wrapcb(this, done, _connectionID));
84003           function done(err, payload) {
84004             if (err) return callback(err);
84005             var options2 = { skipSeen: true };
84006             return parseUserJSON(payload, function(err2, results) {
84007               if (err2) return callback(err2);
84008               return callback(void 0, results[0]);
84009             }, options2);
84010           }
84011         },
84012         // Load the details of the logged-in user
84013         // GET /api/0.6/user/details
84014         userDetails: function(callback) {
84015           if (_userDetails) {
84016             return callback(void 0, _userDetails);
84017           }
84018           oauth.xhr({
84019             method: "GET",
84020             path: "/api/0.6/user/details.json"
84021           }, wrapcb(this, done, _connectionID));
84022           function done(err, payload) {
84023             if (err) return callback(err);
84024             var options2 = { skipSeen: false };
84025             return parseUserJSON(payload, function(err2, results) {
84026               if (err2) return callback(err2);
84027               _userDetails = results[0];
84028               return callback(void 0, _userDetails);
84029             }, options2);
84030           }
84031         },
84032         // Load previous changesets for the logged in user
84033         // GET /api/0.6/changesets?user=#id
84034         userChangesets: function(callback) {
84035           if (_userChangesets) {
84036             return callback(void 0, _userChangesets);
84037           }
84038           this.userDetails(
84039             wrapcb(this, gotDetails, _connectionID)
84040           );
84041           function gotDetails(err, user) {
84042             if (err) {
84043               return callback(err);
84044             }
84045             oauth.xhr({
84046               method: "GET",
84047               path: "/api/0.6/changesets?user=" + user.id
84048             }, wrapcb(this, done, _connectionID));
84049           }
84050           function done(err, xml) {
84051             if (err) {
84052               return callback(err);
84053             }
84054             _userChangesets = Array.prototype.map.call(
84055               xml.getElementsByTagName("changeset"),
84056               function(changeset) {
84057                 return { tags: getTags(changeset) };
84058               }
84059             ).filter(function(changeset) {
84060               var comment = changeset.tags.comment;
84061               return comment && comment !== "";
84062             });
84063             return callback(void 0, _userChangesets);
84064           }
84065         },
84066         // Fetch the status of the OSM API
84067         // GET /api/capabilities
84068         status: function(callback) {
84069           var url = apiUrlroot + "/api/capabilities";
84070           var errback = wrapcb(this, done, _connectionID);
84071           xml_default(url).then(function(data) {
84072             errback(null, data);
84073           }).catch(function(err) {
84074             errback(err.message);
84075           });
84076           function done(err, xml) {
84077             if (err) {
84078               return callback(err, null);
84079             }
84080             var elements = xml.getElementsByTagName("blacklist");
84081             var regexes = [];
84082             for (var i3 = 0; i3 < elements.length; i3++) {
84083               var regexString = elements[i3].getAttribute("regex");
84084               if (regexString) {
84085                 try {
84086                   var regex = new RegExp(regexString);
84087                   regexes.push(regex);
84088                 } catch {
84089                 }
84090               }
84091             }
84092             if (regexes.length) {
84093               _imageryBlocklists = regexes;
84094             }
84095             if (_rateLimitError) {
84096               return callback(_rateLimitError, "rateLimited");
84097             } else {
84098               var waynodes = xml.getElementsByTagName("waynodes");
84099               var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
84100               if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
84101               var apiStatus = xml.getElementsByTagName("status");
84102               var val = apiStatus[0].getAttribute("api");
84103               return callback(void 0, val);
84104             }
84105           }
84106         },
84107         // Calls `status` and dispatches an `apiStatusChange` event if the returned
84108         // status differs from the cached status.
84109         reloadApiStatus: function() {
84110           if (!this.throttledReloadApiStatus) {
84111             var that = this;
84112             this.throttledReloadApiStatus = throttle_default(function() {
84113               that.status(function(err, status) {
84114                 if (status !== _cachedApiStatus) {
84115                   _cachedApiStatus = status;
84116                   dispatch9.call("apiStatusChange", that, err, status);
84117                 }
84118               });
84119             }, 500);
84120           }
84121           this.throttledReloadApiStatus();
84122         },
84123         // Returns the maximum number of nodes a single way can have
84124         maxWayNodes: function() {
84125           return _maxWayNodes;
84126         },
84127         // Load data (entities) from the API in tiles
84128         // GET /api/0.6/map?bbox=
84129         loadTiles: function(projection2, callback) {
84130           if (_off) return;
84131           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
84132           var hadRequests = hasInflightRequests(_tileCache);
84133           abortUnwantedRequests3(_tileCache, tiles);
84134           if (hadRequests && !hasInflightRequests(_tileCache)) {
84135             if (_rateLimitError) {
84136               _rateLimitError = void 0;
84137               dispatch9.call("change");
84138               this.reloadApiStatus();
84139             }
84140             dispatch9.call("loaded");
84141           }
84142           tiles.forEach(function(tile) {
84143             this.loadTile(tile, callback);
84144           }, this);
84145         },
84146         // Load a single data tile
84147         // GET /api/0.6/map?bbox=
84148         loadTile: function(tile, callback) {
84149           if (_off) return;
84150           if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
84151           if (!hasInflightRequests(_tileCache)) {
84152             dispatch9.call("loading");
84153           }
84154           var path = "/api/0.6/map.json?bbox=";
84155           var options2 = { skipSeen: true };
84156           _tileCache.inflight[tile.id] = this.loadFromAPI(
84157             path + tile.extent.toParam(),
84158             tileCallback.bind(this),
84159             options2
84160           );
84161           function tileCallback(err, parsed) {
84162             if (!err) {
84163               delete _tileCache.inflight[tile.id];
84164               delete _tileCache.toLoad[tile.id];
84165               _tileCache.loaded[tile.id] = true;
84166               var bbox2 = tile.extent.bbox();
84167               bbox2.id = tile.id;
84168               _tileCache.rtree.insert(bbox2);
84169             } else {
84170               if (!_rateLimitError && err.status === 509 || err.status === 429) {
84171                 _rateLimitError = err;
84172                 dispatch9.call("change");
84173                 this.reloadApiStatus();
84174               }
84175               setTimeout(() => {
84176                 delete _tileCache.inflight[tile.id];
84177                 this.loadTile(tile, callback);
84178               }, 8e3);
84179             }
84180             if (callback) {
84181               callback(err, Object.assign({ data: parsed }, tile));
84182             }
84183             if (!hasInflightRequests(_tileCache)) {
84184               if (_rateLimitError) {
84185                 _rateLimitError = void 0;
84186                 dispatch9.call("change");
84187                 this.reloadApiStatus();
84188               }
84189               dispatch9.call("loaded");
84190             }
84191           }
84192         },
84193         isDataLoaded: function(loc) {
84194           var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
84195           return _tileCache.rtree.collides(bbox2);
84196         },
84197         // load the tile that covers the given `loc`
84198         loadTileAtLoc: function(loc, callback) {
84199           if (Object.keys(_tileCache.toLoad).length > 50) return;
84200           var k2 = geoZoomToScale(_tileZoom3 + 1);
84201           var offset = geoRawMercator().scale(k2)(loc);
84202           var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
84203           var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
84204           tiles.forEach(function(tile) {
84205             if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
84206             _tileCache.toLoad[tile.id] = true;
84207             this.loadTile(tile, callback);
84208           }, this);
84209         },
84210         // Load notes from the API in tiles
84211         // GET /api/0.6/notes?bbox=
84212         loadNotes: function(projection2, noteOptions) {
84213           noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
84214           if (_off) return;
84215           var that = this;
84216           var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
84217           var throttleLoadUsers = throttle_default(function() {
84218             var uids = Object.keys(_userCache.toLoad);
84219             if (!uids.length) return;
84220             that.loadUsers(uids, function() {
84221             });
84222           }, 750);
84223           var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
84224           abortUnwantedRequests3(_noteCache, tiles);
84225           tiles.forEach(function(tile) {
84226             if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
84227             var options2 = { skipSeen: false };
84228             _noteCache.inflight[tile.id] = that.loadFromAPI(
84229               path + tile.extent.toParam(),
84230               function(err) {
84231                 delete _noteCache.inflight[tile.id];
84232                 if (!err) {
84233                   _noteCache.loaded[tile.id] = true;
84234                 }
84235                 throttleLoadUsers();
84236                 dispatch9.call("loadedNotes");
84237               },
84238               options2
84239             );
84240           });
84241         },
84242         // Create a note
84243         // POST /api/0.6/notes?params
84244         postNoteCreate: function(note, callback) {
84245           if (!this.authenticated()) {
84246             return callback({ message: "Not Authenticated", status: -3 }, note);
84247           }
84248           if (_noteCache.inflightPost[note.id]) {
84249             return callback({ message: "Note update already inflight", status: -2 }, note);
84250           }
84251           if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
84252           var comment = note.newComment;
84253           if (note.newCategory && note.newCategory !== "None") {
84254             comment += " #" + note.newCategory;
84255           }
84256           var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
84257           _noteCache.inflightPost[note.id] = oauth.xhr({
84258             method: "POST",
84259             path
84260           }, wrapcb(this, done, _connectionID));
84261           function done(err, xml) {
84262             delete _noteCache.inflightPost[note.id];
84263             if (err) {
84264               return callback(err);
84265             }
84266             this.removeNote(note);
84267             var options2 = { skipSeen: false };
84268             return parseXML(xml, function(err2, results) {
84269               if (err2) {
84270                 return callback(err2);
84271               } else {
84272                 return callback(void 0, results[0]);
84273               }
84274             }, options2);
84275           }
84276         },
84277         // Update a note
84278         // POST /api/0.6/notes/#id/comment?text=comment
84279         // POST /api/0.6/notes/#id/close?text=comment
84280         // POST /api/0.6/notes/#id/reopen?text=comment
84281         postNoteUpdate: function(note, newStatus, callback) {
84282           if (!this.authenticated()) {
84283             return callback({ message: "Not Authenticated", status: -3 }, note);
84284           }
84285           if (_noteCache.inflightPost[note.id]) {
84286             return callback({ message: "Note update already inflight", status: -2 }, note);
84287           }
84288           var action;
84289           if (note.status !== "closed" && newStatus === "closed") {
84290             action = "close";
84291           } else if (note.status !== "open" && newStatus === "open") {
84292             action = "reopen";
84293           } else {
84294             action = "comment";
84295             if (!note.newComment) return;
84296           }
84297           var path = "/api/0.6/notes/" + note.id + "/" + action;
84298           if (note.newComment) {
84299             path += "?" + utilQsString({ text: note.newComment });
84300           }
84301           _noteCache.inflightPost[note.id] = oauth.xhr({
84302             method: "POST",
84303             path
84304           }, wrapcb(this, done, _connectionID));
84305           function done(err, xml) {
84306             delete _noteCache.inflightPost[note.id];
84307             if (err) {
84308               return callback(err);
84309             }
84310             this.removeNote(note);
84311             if (action === "close") {
84312               _noteCache.closed[note.id] = true;
84313             } else if (action === "reopen") {
84314               delete _noteCache.closed[note.id];
84315             }
84316             var options2 = { skipSeen: false };
84317             return parseXML(xml, function(err2, results) {
84318               if (err2) {
84319                 return callback(err2);
84320               } else {
84321                 return callback(void 0, results[0]);
84322               }
84323             }, options2);
84324           }
84325         },
84326         /* connection options for source switcher (optional) */
84327         apiConnections: function(val) {
84328           if (!arguments.length) return _apiConnections;
84329           _apiConnections = val;
84330           return this;
84331         },
84332         switch: function(newOptions) {
84333           urlroot = newOptions.url;
84334           apiUrlroot = newOptions.apiUrl || urlroot;
84335           if (newOptions.url && !newOptions.apiUrl) {
84336             newOptions = {
84337               ...newOptions,
84338               apiUrl: newOptions.url
84339             };
84340           }
84341           const oldOptions = utilObjectOmit(oauth.options(), "access_token");
84342           oauth.options({ ...oldOptions, ...newOptions });
84343           this.reset();
84344           this.userChangesets(function() {
84345           });
84346           dispatch9.call("change");
84347           return this;
84348         },
84349         toggle: function(val) {
84350           _off = !val;
84351           return this;
84352         },
84353         isChangesetInflight: function() {
84354           return !!_changeset.inflight;
84355         },
84356         // get/set cached data
84357         // This is used to save/restore the state when entering/exiting the walkthrough
84358         // Also used for testing purposes.
84359         caches: function(obj) {
84360           function cloneCache(source) {
84361             var target = {};
84362             Object.keys(source).forEach(function(k2) {
84363               if (k2 === "rtree") {
84364                 target.rtree = new RBush().fromJSON(source.rtree.toJSON());
84365               } else if (k2 === "note") {
84366                 target.note = {};
84367                 Object.keys(source.note).forEach(function(id2) {
84368                   target.note[id2] = osmNote(source.note[id2]);
84369                 });
84370               } else {
84371                 target[k2] = JSON.parse(JSON.stringify(source[k2]));
84372               }
84373             });
84374             return target;
84375           }
84376           if (!arguments.length) {
84377             return {
84378               tile: cloneCache(_tileCache),
84379               note: cloneCache(_noteCache),
84380               user: cloneCache(_userCache)
84381             };
84382           }
84383           if (obj === "get") {
84384             return {
84385               tile: _tileCache,
84386               note: _noteCache,
84387               user: _userCache
84388             };
84389           }
84390           if (obj.tile) {
84391             _tileCache = obj.tile;
84392             _tileCache.inflight = {};
84393           }
84394           if (obj.note) {
84395             _noteCache = obj.note;
84396             _noteCache.inflight = {};
84397             _noteCache.inflightPost = {};
84398           }
84399           if (obj.user) {
84400             _userCache = obj.user;
84401           }
84402           return this;
84403         },
84404         logout: function() {
84405           _userChangesets = void 0;
84406           _userDetails = void 0;
84407           oauth.logout();
84408           dispatch9.call("change");
84409           return this;
84410         },
84411         authenticated: function() {
84412           return oauth.authenticated();
84413         },
84414         /** @param {import('osm-auth').LoginOptions} options */
84415         authenticate: function(callback, options2) {
84416           var that = this;
84417           var cid = _connectionID;
84418           _userChangesets = void 0;
84419           _userDetails = void 0;
84420           function done(err, res) {
84421             if (err) {
84422               if (callback) callback(err);
84423               return;
84424             }
84425             if (that.getConnectionId() !== cid) {
84426               if (callback) callback({ message: "Connection Switched", status: -1 });
84427               return;
84428             }
84429             _rateLimitError = void 0;
84430             dispatch9.call("change");
84431             if (callback) callback(err, res);
84432             that.userChangesets(function() {
84433             });
84434           }
84435           oauth.options({
84436             ...oauth.options(),
84437             locale: _mainLocalizer.localeCode()
84438           });
84439           oauth.authenticate(done, options2);
84440         },
84441         imageryBlocklists: function() {
84442           return _imageryBlocklists;
84443         },
84444         tileZoom: function(val) {
84445           if (!arguments.length) return _tileZoom3;
84446           _tileZoom3 = val;
84447           return this;
84448         },
84449         // get all cached notes covering the viewport
84450         notes: function(projection2) {
84451           var viewport = projection2.clipExtent();
84452           var min3 = [viewport[0][0], viewport[1][1]];
84453           var max3 = [viewport[1][0], viewport[0][1]];
84454           var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
84455           return _noteCache.rtree.search(bbox2).map(function(d2) {
84456             return d2.data;
84457           });
84458         },
84459         // get a single note from the cache
84460         getNote: function(id2) {
84461           return _noteCache.note[id2];
84462         },
84463         // remove a single note from the cache
84464         removeNote: function(note) {
84465           if (!(note instanceof osmNote) || !note.id) return;
84466           delete _noteCache.note[note.id];
84467           updateRtree3(encodeNoteRtree(note), false);
84468         },
84469         // replace a single note in the cache
84470         replaceNote: function(note) {
84471           if (!(note instanceof osmNote) || !note.id) return;
84472           _noteCache.note[note.id] = note;
84473           updateRtree3(encodeNoteRtree(note), true);
84474           return note;
84475         },
84476         // Get an array of note IDs closed during this session.
84477         // Used to populate `closed:note` changeset tag
84478         getClosedIDs: function() {
84479           return Object.keys(_noteCache.closed).sort();
84480         }
84481       };
84482     }
84483   });
84484
84485   // modules/services/osm_wikibase.js
84486   var osm_wikibase_exports = {};
84487   __export(osm_wikibase_exports, {
84488     default: () => osm_wikibase_default
84489   });
84490   function request(url, callback) {
84491     if (_inflight2[url]) return;
84492     var controller = new AbortController();
84493     _inflight2[url] = controller;
84494     json_default(url, { signal: controller.signal }).then(function(result) {
84495       delete _inflight2[url];
84496       if (callback) callback(null, result);
84497     }).catch(function(err) {
84498       delete _inflight2[url];
84499       if (err.name === "AbortError") return;
84500       if (callback) callback(err.message);
84501     });
84502   }
84503   var apibase3, _inflight2, _wikibaseCache, _localeIDs, debouncedRequest, osm_wikibase_default;
84504   var init_osm_wikibase = __esm({
84505     "modules/services/osm_wikibase.js"() {
84506       "use strict";
84507       init_debounce();
84508       init_src18();
84509       init_localizer();
84510       init_util();
84511       apibase3 = "https://wiki.openstreetmap.org/w/api.php";
84512       _inflight2 = {};
84513       _wikibaseCache = {};
84514       _localeIDs = { en: false };
84515       debouncedRequest = debounce_default(request, 500, { leading: false });
84516       osm_wikibase_default = {
84517         init: function() {
84518           _inflight2 = {};
84519           _wikibaseCache = {};
84520           _localeIDs = {};
84521         },
84522         reset: function() {
84523           Object.values(_inflight2).forEach(function(controller) {
84524             controller.abort();
84525           });
84526           _inflight2 = {};
84527         },
84528         /**
84529          * Get the best value for the property, or undefined if not found
84530          * @param entity object from wikibase
84531          * @param property string e.g. 'P4' for image
84532          * @param langCode string e.g. 'fr' for French
84533          */
84534         claimToValue: function(entity, property, langCode) {
84535           if (!entity.claims[property]) return void 0;
84536           var locale3 = _localeIDs[langCode];
84537           var preferredPick, localePick;
84538           entity.claims[property].forEach(function(stmt) {
84539             if (!preferredPick && stmt.rank === "preferred") {
84540               preferredPick = stmt;
84541             }
84542             if (locale3 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale3) {
84543               localePick = stmt;
84544             }
84545           });
84546           var result = localePick || preferredPick;
84547           if (result) {
84548             var datavalue = result.mainsnak.datavalue;
84549             return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
84550           } else {
84551             return void 0;
84552           }
84553         },
84554         /**
84555          * Convert monolingual property into a key-value object (language -> value)
84556          * @param entity object from wikibase
84557          * @param property string e.g. 'P31' for monolingual wiki page title
84558          */
84559         monolingualClaimToValueObj: function(entity, property) {
84560           if (!entity || !entity.claims[property]) return void 0;
84561           return entity.claims[property].reduce(function(acc, obj) {
84562             var value = obj.mainsnak.datavalue.value;
84563             acc[value.language] = value.text;
84564             return acc;
84565           }, {});
84566         },
84567         toSitelink: function(key, value) {
84568           var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
84569           return result.replace(/_/g, " ").trim();
84570         },
84571         /**
84572          * Converts text like `tag:...=...` into clickable links
84573          *
84574          * @param {string} unsafeText - unsanitized text
84575          */
84576         linkifyWikiText(unsafeText) {
84577           return (selection2) => {
84578             const segments = unsafeText.split(/(key|tag):([\w-]+)(=([\w-]+))?/g);
84579             for (let i3 = 0; i3 < segments.length; i3 += 5) {
84580               const [plainText, , key, , value] = segments.slice(i3);
84581               if (plainText) {
84582                 selection2.append("span").text(plainText);
84583               }
84584               if (key) {
84585                 selection2.append("a").attr("href", `https://wiki.openstreetmap.org/wiki/${this.toSitelink(key, value)}`).attr("target", "_blank").attr("rel", "noreferrer").append("code").text(`${key}=${value || "*"}`);
84586               }
84587             }
84588           };
84589         },
84590         //
84591         // Pass params object of the form:
84592         // {
84593         //   key: 'string',
84594         //   value: 'string',
84595         //   langCode: 'string'
84596         // }
84597         //
84598         getEntity: function(params, callback) {
84599           var doRequest = params.debounce ? debouncedRequest : request;
84600           var that = this;
84601           var titles = [];
84602           var result = {};
84603           var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
84604           var keySitelink = params.key ? this.toSitelink(params.key) : false;
84605           var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
84606           const localeSitelinks = [];
84607           if (params.langCodes) {
84608             params.langCodes.forEach(function(langCode) {
84609               if (_localeIDs[langCode] === void 0) {
84610                 let localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
84611                 titles.push(localeSitelink);
84612                 that.addLocale(langCode, false);
84613               }
84614             });
84615           }
84616           if (rtypeSitelink) {
84617             if (_wikibaseCache[rtypeSitelink]) {
84618               result.rtype = _wikibaseCache[rtypeSitelink];
84619             } else {
84620               titles.push(rtypeSitelink);
84621             }
84622           }
84623           if (keySitelink) {
84624             if (_wikibaseCache[keySitelink]) {
84625               result.key = _wikibaseCache[keySitelink];
84626             } else {
84627               titles.push(keySitelink);
84628             }
84629           }
84630           if (tagSitelink) {
84631             if (_wikibaseCache[tagSitelink]) {
84632               result.tag = _wikibaseCache[tagSitelink];
84633             } else {
84634               titles.push(tagSitelink);
84635             }
84636           }
84637           if (!titles.length) {
84638             return callback(null, result);
84639           }
84640           var obj = {
84641             action: "wbgetentities",
84642             sites: "wiki",
84643             titles: titles.join("|"),
84644             languages: params.langCodes.join("|"),
84645             languagefallback: 1,
84646             origin: "*",
84647             format: "json"
84648             // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
84649             // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
84650             // formatversion: 2,
84651           };
84652           var url = apibase3 + "?" + utilQsString(obj);
84653           doRequest(url, function(err, d2) {
84654             if (err) {
84655               callback(err);
84656             } else if (!d2.success || d2.error) {
84657               callback(d2.error.messages.map(function(v2) {
84658                 return v2.html["*"];
84659               }).join("<br>"));
84660             } else {
84661               Object.values(d2.entities).forEach(function(res) {
84662                 if (res.missing !== "") {
84663                   var title = res.sitelinks.wiki.title;
84664                   if (title === rtypeSitelink) {
84665                     _wikibaseCache[rtypeSitelink] = res;
84666                     result.rtype = res;
84667                   } else if (title === keySitelink) {
84668                     _wikibaseCache[keySitelink] = res;
84669                     result.key = res;
84670                   } else if (title === tagSitelink) {
84671                     _wikibaseCache[tagSitelink] = res;
84672                     result.tag = res;
84673                   } else if (localeSitelinks.includes(title)) {
84674                     const langCode = title.replace(/ /g, "_").replace(/^Locale:/, "");
84675                     that.addLocale(langCode, res.id);
84676                   } else {
84677                     console.log("Unexpected title " + title);
84678                   }
84679                 }
84680               });
84681               callback(null, result);
84682             }
84683           });
84684         },
84685         //
84686         // Pass params object of the form:
84687         // {
84688         //   key: 'string',     // required
84689         //   value: 'string'    // optional
84690         // }
84691         //
84692         // Get an result object used to display tag documentation
84693         // {
84694         //   title:        'string',
84695         //   description:  'string',
84696         //   editURL:      'string',
84697         //   imageURL:     'string',
84698         //   wiki:         { title: 'string', text: 'string', url: 'string' }
84699         // }
84700         //
84701         getDocs: function(params, callback) {
84702           var that = this;
84703           var langCodes = _mainLocalizer.localeCodes().map(function(code) {
84704             return code.toLowerCase();
84705           });
84706           params.langCodes = langCodes;
84707           this.getEntity(params, function(err, data) {
84708             if (err) {
84709               callback(err);
84710               return;
84711             }
84712             var entity = data.rtype || data.tag || data.key;
84713             if (!entity) {
84714               callback("No entity");
84715               return;
84716             }
84717             var i3;
84718             var description;
84719             for (i3 in langCodes) {
84720               let code2 = langCodes[i3];
84721               if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
84722                 description = entity.descriptions[code2];
84723                 break;
84724               }
84725             }
84726             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
84727             var result = {
84728               title: entity.title,
84729               description: that.linkifyWikiText((description == null ? void 0 : description.value) || ""),
84730               descriptionLocaleCode: description ? description.language : "",
84731               editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
84732             };
84733             if (entity.claims) {
84734               var imageroot;
84735               var image = that.claimToValue(entity, "P4", langCodes[0]);
84736               if (image) {
84737                 imageroot = "https://commons.wikimedia.org/w/index.php";
84738               } else {
84739                 image = that.claimToValue(entity, "P28", langCodes[0]);
84740                 if (image) {
84741                   imageroot = "https://wiki.openstreetmap.org/w/index.php";
84742                 }
84743               }
84744               if (imageroot && image) {
84745                 result.imageURL = imageroot + "?" + utilQsString({
84746                   title: "Special:Redirect/file/" + image,
84747                   width: 400
84748                 });
84749               }
84750             }
84751             var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
84752             var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
84753             var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
84754             var wikis = [rtypeWiki, tagWiki, keyWiki];
84755             for (i3 in wikis) {
84756               var wiki = wikis[i3];
84757               for (var j2 in langCodes) {
84758                 var code = langCodes[j2];
84759                 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
84760                 var info = getWikiInfo(wiki, code, referenceId);
84761                 if (info) {
84762                   result.wiki = info;
84763                   break;
84764                 }
84765               }
84766               if (result.wiki) break;
84767             }
84768             callback(null, result);
84769             function getWikiInfo(wiki2, langCode, tKey) {
84770               if (wiki2 && wiki2[langCode]) {
84771                 return {
84772                   title: wiki2[langCode],
84773                   text: tKey,
84774                   url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
84775                 };
84776               }
84777             }
84778           });
84779         },
84780         addLocale: function(langCode, qid) {
84781           _localeIDs[langCode] = qid;
84782         },
84783         apibase: function(val) {
84784           if (!arguments.length) return apibase3;
84785           apibase3 = val;
84786           return this;
84787         }
84788       };
84789     }
84790   });
84791
84792   // modules/services/streetside.js
84793   var streetside_exports2 = {};
84794   __export(streetside_exports2, {
84795     default: () => streetside_default
84796   });
84797   function abortRequest5(i3) {
84798     i3.abort();
84799   }
84800   function localeTimestamp2(s2) {
84801     if (!s2) return null;
84802     const options2 = { day: "numeric", month: "short", year: "numeric" };
84803     const d2 = new Date(s2);
84804     if (isNaN(d2.getTime())) return null;
84805     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
84806   }
84807   function loadTiles3(which, url, projection2, margin) {
84808     const tiles = tiler6.margin(margin).getTiles(projection2);
84809     const cache = _ssCache[which];
84810     Object.keys(cache.inflight).forEach((k2) => {
84811       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
84812       if (!wanted) {
84813         abortRequest5(cache.inflight[k2]);
84814         delete cache.inflight[k2];
84815       }
84816     });
84817     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
84818   }
84819   function loadNextTilePage2(which, url, tile) {
84820     const cache = _ssCache[which];
84821     const nextPage = cache.nextPage[tile.id] || 0;
84822     const id2 = tile.id + "," + String(nextPage);
84823     if (cache.loaded[id2] || cache.inflight[id2]) return;
84824     cache.inflight[id2] = getBubbles(url, tile, (response) => {
84825       cache.loaded[id2] = true;
84826       delete cache.inflight[id2];
84827       if (!response) return;
84828       if (response.resourceSets[0].resources.length === maxResults2) {
84829         const split = tile.extent.split();
84830         loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
84831         loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
84832         loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
84833         loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
84834       }
84835       const features = response.resourceSets[0].resources.map((bubble) => {
84836         const bubbleId = bubble.imageUrl;
84837         if (cache.points[bubbleId]) return null;
84838         const loc = [
84839           bubble.lon || bubble.longitude,
84840           bubble.lat || bubble.latitude
84841         ];
84842         const d2 = {
84843           service: "photo",
84844           loc,
84845           key: bubbleId,
84846           imageUrl: bubble.imageUrl.replace("{subdomain}", bubble.imageUrlSubdomains[0]),
84847           ca: bubble.he || bubble.heading,
84848           captured_at: bubble.vintageEnd,
84849           captured_by: "microsoft",
84850           pano: true,
84851           sequenceKey: null
84852         };
84853         cache.points[bubbleId] = d2;
84854         return {
84855           minX: loc[0],
84856           minY: loc[1],
84857           maxX: loc[0],
84858           maxY: loc[1],
84859           data: d2
84860         };
84861       }).filter(Boolean);
84862       cache.rtree.load(features);
84863       if (which === "bubbles") {
84864         dispatch10.call("loadedImages");
84865       }
84866     });
84867   }
84868   function getBubbles(url, tile, callback) {
84869     let rect = tile.extent.rectangle();
84870     let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
84871     const controller = new AbortController();
84872     fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
84873       if (!response.ok) {
84874         throw new Error(response.status + " " + response.statusText);
84875       }
84876       return response.json();
84877     }).then(function(result) {
84878       if (!result) {
84879         callback(null);
84880       }
84881       return callback(result || []);
84882     }).catch(function(err) {
84883       if (err.name === "AbortError") {
84884       } else {
84885         throw new Error(err);
84886       }
84887     });
84888     return controller;
84889   }
84890   function partitionViewport4(projection2) {
84891     let z2 = geoScaleToZoom(projection2.scale());
84892     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
84893     let tiler8 = utilTiler().zoomExtent([z22, z22]);
84894     return tiler8.getTiles(projection2).map((tile) => tile.extent);
84895   }
84896   function searchLimited4(limit, projection2, rtree) {
84897     limit = limit || 5;
84898     return partitionViewport4(projection2).reduce((result, extent) => {
84899       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
84900       return found.length ? result.concat(found) : result;
84901     }, []);
84902   }
84903   function loadImage2(imgInfo) {
84904     return new Promise((resolve) => {
84905       let img = new Image();
84906       img.onload = () => {
84907         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
84908         let ctx = canvas.getContext("2d");
84909         ctx.drawImage(img, imgInfo.x, imgInfo.y);
84910         resolve({ imgInfo, status: "ok" });
84911       };
84912       img.onerror = () => {
84913         resolve({ data: imgInfo, status: "error" });
84914       };
84915       img.setAttribute("crossorigin", "");
84916       img.src = imgInfo.url;
84917     });
84918   }
84919   function loadCanvas(imageGroup) {
84920     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
84921       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
84922       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
84923       let face = data[0].imgInfo.face;
84924       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
84925       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
84926     });
84927   }
84928   function loadFaces(faceGroup) {
84929     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
84930       return { status: "loadFaces done" };
84931     });
84932   }
84933   function setupCanvas(selection2, reset) {
84934     if (reset) {
84935       selection2.selectAll("#ideditor-stitcher-canvases").remove();
84936     }
84937     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);
84938   }
84939   function qkToXY(qk) {
84940     let x2 = 0;
84941     let y2 = 0;
84942     let scale = 256;
84943     for (let i3 = qk.length; i3 > 0; i3--) {
84944       const key = qk[i3 - 1];
84945       x2 += +(key === "1" || key === "3") * scale;
84946       y2 += +(key === "2" || key === "3") * scale;
84947       scale *= 2;
84948     }
84949     return [x2, y2];
84950   }
84951   function getQuadKeys() {
84952     let dim = _resolution / 256;
84953     let quadKeys;
84954     if (dim === 16) {
84955       quadKeys = [
84956         "0000",
84957         "0001",
84958         "0010",
84959         "0011",
84960         "0100",
84961         "0101",
84962         "0110",
84963         "0111",
84964         "1000",
84965         "1001",
84966         "1010",
84967         "1011",
84968         "1100",
84969         "1101",
84970         "1110",
84971         "1111",
84972         "0002",
84973         "0003",
84974         "0012",
84975         "0013",
84976         "0102",
84977         "0103",
84978         "0112",
84979         "0113",
84980         "1002",
84981         "1003",
84982         "1012",
84983         "1013",
84984         "1102",
84985         "1103",
84986         "1112",
84987         "1113",
84988         "0020",
84989         "0021",
84990         "0030",
84991         "0031",
84992         "0120",
84993         "0121",
84994         "0130",
84995         "0131",
84996         "1020",
84997         "1021",
84998         "1030",
84999         "1031",
85000         "1120",
85001         "1121",
85002         "1130",
85003         "1131",
85004         "0022",
85005         "0023",
85006         "0032",
85007         "0033",
85008         "0122",
85009         "0123",
85010         "0132",
85011         "0133",
85012         "1022",
85013         "1023",
85014         "1032",
85015         "1033",
85016         "1122",
85017         "1123",
85018         "1132",
85019         "1133",
85020         "0200",
85021         "0201",
85022         "0210",
85023         "0211",
85024         "0300",
85025         "0301",
85026         "0310",
85027         "0311",
85028         "1200",
85029         "1201",
85030         "1210",
85031         "1211",
85032         "1300",
85033         "1301",
85034         "1310",
85035         "1311",
85036         "0202",
85037         "0203",
85038         "0212",
85039         "0213",
85040         "0302",
85041         "0303",
85042         "0312",
85043         "0313",
85044         "1202",
85045         "1203",
85046         "1212",
85047         "1213",
85048         "1302",
85049         "1303",
85050         "1312",
85051         "1313",
85052         "0220",
85053         "0221",
85054         "0230",
85055         "0231",
85056         "0320",
85057         "0321",
85058         "0330",
85059         "0331",
85060         "1220",
85061         "1221",
85062         "1230",
85063         "1231",
85064         "1320",
85065         "1321",
85066         "1330",
85067         "1331",
85068         "0222",
85069         "0223",
85070         "0232",
85071         "0233",
85072         "0322",
85073         "0323",
85074         "0332",
85075         "0333",
85076         "1222",
85077         "1223",
85078         "1232",
85079         "1233",
85080         "1322",
85081         "1323",
85082         "1332",
85083         "1333",
85084         "2000",
85085         "2001",
85086         "2010",
85087         "2011",
85088         "2100",
85089         "2101",
85090         "2110",
85091         "2111",
85092         "3000",
85093         "3001",
85094         "3010",
85095         "3011",
85096         "3100",
85097         "3101",
85098         "3110",
85099         "3111",
85100         "2002",
85101         "2003",
85102         "2012",
85103         "2013",
85104         "2102",
85105         "2103",
85106         "2112",
85107         "2113",
85108         "3002",
85109         "3003",
85110         "3012",
85111         "3013",
85112         "3102",
85113         "3103",
85114         "3112",
85115         "3113",
85116         "2020",
85117         "2021",
85118         "2030",
85119         "2031",
85120         "2120",
85121         "2121",
85122         "2130",
85123         "2131",
85124         "3020",
85125         "3021",
85126         "3030",
85127         "3031",
85128         "3120",
85129         "3121",
85130         "3130",
85131         "3131",
85132         "2022",
85133         "2023",
85134         "2032",
85135         "2033",
85136         "2122",
85137         "2123",
85138         "2132",
85139         "2133",
85140         "3022",
85141         "3023",
85142         "3032",
85143         "3033",
85144         "3122",
85145         "3123",
85146         "3132",
85147         "3133",
85148         "2200",
85149         "2201",
85150         "2210",
85151         "2211",
85152         "2300",
85153         "2301",
85154         "2310",
85155         "2311",
85156         "3200",
85157         "3201",
85158         "3210",
85159         "3211",
85160         "3300",
85161         "3301",
85162         "3310",
85163         "3311",
85164         "2202",
85165         "2203",
85166         "2212",
85167         "2213",
85168         "2302",
85169         "2303",
85170         "2312",
85171         "2313",
85172         "3202",
85173         "3203",
85174         "3212",
85175         "3213",
85176         "3302",
85177         "3303",
85178         "3312",
85179         "3313",
85180         "2220",
85181         "2221",
85182         "2230",
85183         "2231",
85184         "2320",
85185         "2321",
85186         "2330",
85187         "2331",
85188         "3220",
85189         "3221",
85190         "3230",
85191         "3231",
85192         "3320",
85193         "3321",
85194         "3330",
85195         "3331",
85196         "2222",
85197         "2223",
85198         "2232",
85199         "2233",
85200         "2322",
85201         "2323",
85202         "2332",
85203         "2333",
85204         "3222",
85205         "3223",
85206         "3232",
85207         "3233",
85208         "3322",
85209         "3323",
85210         "3332",
85211         "3333"
85212       ];
85213     } else if (dim === 8) {
85214       quadKeys = [
85215         "000",
85216         "001",
85217         "010",
85218         "011",
85219         "100",
85220         "101",
85221         "110",
85222         "111",
85223         "002",
85224         "003",
85225         "012",
85226         "013",
85227         "102",
85228         "103",
85229         "112",
85230         "113",
85231         "020",
85232         "021",
85233         "030",
85234         "031",
85235         "120",
85236         "121",
85237         "130",
85238         "131",
85239         "022",
85240         "023",
85241         "032",
85242         "033",
85243         "122",
85244         "123",
85245         "132",
85246         "133",
85247         "200",
85248         "201",
85249         "210",
85250         "211",
85251         "300",
85252         "301",
85253         "310",
85254         "311",
85255         "202",
85256         "203",
85257         "212",
85258         "213",
85259         "302",
85260         "303",
85261         "312",
85262         "313",
85263         "220",
85264         "221",
85265         "230",
85266         "231",
85267         "320",
85268         "321",
85269         "330",
85270         "331",
85271         "222",
85272         "223",
85273         "232",
85274         "233",
85275         "322",
85276         "323",
85277         "332",
85278         "333"
85279       ];
85280     } else if (dim === 4) {
85281       quadKeys = [
85282         "00",
85283         "01",
85284         "10",
85285         "11",
85286         "02",
85287         "03",
85288         "12",
85289         "13",
85290         "20",
85291         "21",
85292         "30",
85293         "31",
85294         "22",
85295         "23",
85296         "32",
85297         "33"
85298       ];
85299     } else {
85300       quadKeys = [
85301         "0",
85302         "1",
85303         "2",
85304         "3"
85305       ];
85306     }
85307     return quadKeys;
85308   }
85309   var streetsideApi, maxResults2, bubbleAppKey, pannellumViewerCSS2, pannellumViewerJS2, tileZoom3, tiler6, dispatch10, minHfov, maxHfov, defaultHfov, _hires, _resolution, _currScene, _ssCache, _pannellumViewer2, _sceneOptions, _loadViewerPromise4, streetside_default;
85310   var init_streetside2 = __esm({
85311     "modules/services/streetside.js"() {
85312       "use strict";
85313       init_src4();
85314       init_src9();
85315       init_src5();
85316       init_rbush();
85317       init_localizer();
85318       init_geo2();
85319       init_util();
85320       init_services();
85321       streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}&uriScheme=https";
85322       maxResults2 = 500;
85323       bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
85324       pannellumViewerCSS2 = "pannellum/pannellum.css";
85325       pannellumViewerJS2 = "pannellum/pannellum.js";
85326       tileZoom3 = 16.5;
85327       tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
85328       dispatch10 = dispatch_default("loadedImages", "viewerChanged");
85329       minHfov = 10;
85330       maxHfov = 90;
85331       defaultHfov = 45;
85332       _hires = false;
85333       _resolution = 512;
85334       _currScene = 0;
85335       _sceneOptions = {
85336         showFullscreenCtrl: false,
85337         autoLoad: true,
85338         compass: true,
85339         yaw: 0,
85340         minHfov,
85341         maxHfov,
85342         hfov: defaultHfov,
85343         type: "cubemap",
85344         cubeMap: []
85345       };
85346       streetside_default = {
85347         /**
85348          * init() initialize streetside.
85349          */
85350         init: function() {
85351           if (!_ssCache) {
85352             this.reset();
85353           }
85354           this.event = utilRebind(this, dispatch10, "on");
85355         },
85356         /**
85357          * reset() reset the cache.
85358          */
85359         reset: function() {
85360           if (_ssCache) {
85361             Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
85362           }
85363           _ssCache = {
85364             bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
85365             sequences: {}
85366           };
85367         },
85368         /**
85369          * bubbles()
85370          */
85371         bubbles: function(projection2) {
85372           const limit = 5;
85373           return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
85374         },
85375         cachedImage: function(imageKey) {
85376           return _ssCache.bubbles.points[imageKey];
85377         },
85378         sequences: function(projection2) {
85379           const viewport = projection2.clipExtent();
85380           const min3 = [viewport[0][0], viewport[1][1]];
85381           const max3 = [viewport[1][0], viewport[0][1]];
85382           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
85383           let seen = {};
85384           let results = [];
85385           _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
85386             const key = d2.data.sequenceKey;
85387             if (key && !seen[key]) {
85388               seen[key] = true;
85389               results.push(_ssCache.sequences[key].geojson);
85390             }
85391           });
85392           return results;
85393         },
85394         /**
85395          * loadBubbles()
85396          */
85397         loadBubbles: function(projection2, margin) {
85398           if (margin === void 0) margin = 2;
85399           loadTiles3("bubbles", streetsideApi, projection2, margin);
85400         },
85401         viewer: function() {
85402           return _pannellumViewer2;
85403         },
85404         initViewer: function() {
85405           if (!window.pannellum) return;
85406           if (_pannellumViewer2) return;
85407           _currScene += 1;
85408           const sceneID = _currScene.toString();
85409           const options2 = {
85410             "default": { firstScene: sceneID },
85411             scenes: {}
85412           };
85413           options2.scenes[sceneID] = _sceneOptions;
85414           _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
85415         },
85416         ensureViewerLoaded: function(context) {
85417           if (_loadViewerPromise4) return _loadViewerPromise4;
85418           let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
85419           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
85420           let that = this;
85421           let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
85422           wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
85423             select_default2(window).on(pointerPrefix + "move.streetside", () => {
85424               dispatch10.call("viewerChanged");
85425             }, true);
85426           }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
85427             select_default2(window).on(pointerPrefix + "move.streetside", null);
85428             let t2 = timer((elapsed) => {
85429               dispatch10.call("viewerChanged");
85430               if (elapsed > 2e3) {
85431                 t2.stop();
85432               }
85433             });
85434           }).append("div").attr("class", "photo-attribution fillD");
85435           let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
85436           controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
85437           controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
85438           wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
85439           context.ui().photoviewer.on("resize.streetside", () => {
85440             if (_pannellumViewer2) {
85441               _pannellumViewer2.resize();
85442             }
85443           });
85444           _loadViewerPromise4 = new Promise((resolve, reject) => {
85445             let loadedCount = 0;
85446             function loaded() {
85447               loadedCount += 1;
85448               if (loadedCount === 2) resolve();
85449             }
85450             const head = select_default2("head");
85451             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() {
85452               reject();
85453             });
85454             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() {
85455               reject();
85456             });
85457           }).catch(function() {
85458             _loadViewerPromise4 = null;
85459           });
85460           return _loadViewerPromise4;
85461           function step(stepBy) {
85462             return () => {
85463               let viewer = context.container().select(".photoviewer");
85464               let selected = viewer.empty() ? void 0 : viewer.datum();
85465               if (!selected) return;
85466               let nextID = stepBy === 1 ? selected.ne : selected.pr;
85467               let yaw = _pannellumViewer2.getYaw();
85468               let ca = selected.ca + yaw;
85469               let origin = selected.loc;
85470               const meters = 35;
85471               let p1 = [
85472                 origin[0] + geoMetersToLon(meters / 5, origin[1]),
85473                 origin[1]
85474               ];
85475               let p2 = [
85476                 origin[0] + geoMetersToLon(meters / 2, origin[1]),
85477                 origin[1] + geoMetersToLat(meters)
85478               ];
85479               let p3 = [
85480                 origin[0] - geoMetersToLon(meters / 2, origin[1]),
85481                 origin[1] + geoMetersToLat(meters)
85482               ];
85483               let p4 = [
85484                 origin[0] - geoMetersToLon(meters / 5, origin[1]),
85485                 origin[1]
85486               ];
85487               let poly = [p1, p2, p3, p4, p1];
85488               let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
85489               poly = geoRotate(poly, -angle2, origin);
85490               let extent = poly.reduce((extent2, point) => {
85491                 return extent2.extend(geoExtent(point));
85492               }, geoExtent());
85493               let minDist = Infinity;
85494               _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
85495                 if (d2.data.key === selected.key) return;
85496                 if (!geoPointInPolygon(d2.data.loc, poly)) return;
85497                 let dist = geoVecLength(d2.data.loc, selected.loc);
85498                 let theta = selected.ca - d2.data.ca;
85499                 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
85500                 if (minTheta > 20) {
85501                   dist += 5;
85502                 }
85503                 if (dist < minDist) {
85504                   nextID = d2.data.key;
85505                   minDist = dist;
85506                 }
85507               });
85508               let nextBubble = nextID && that.cachedImage(nextID);
85509               if (!nextBubble) return;
85510               context.map().centerEase(nextBubble.loc);
85511               that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
85512             };
85513           }
85514         },
85515         yaw: function(yaw) {
85516           if (typeof yaw !== "number") return yaw;
85517           _sceneOptions.yaw = yaw;
85518           return this;
85519         },
85520         /**
85521          * showViewer()
85522          */
85523         showViewer: function(context) {
85524           const wrap2 = context.container().select(".photoviewer");
85525           const isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
85526           if (isHidden) {
85527             for (const service of Object.values(services)) {
85528               if (service === this) continue;
85529               if (typeof service.hideViewer === "function") {
85530                 service.hideViewer(context);
85531               }
85532             }
85533             wrap2.classed("hide", false).selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
85534           }
85535           return this;
85536         },
85537         /**
85538          * hideViewer()
85539          */
85540         hideViewer: function(context) {
85541           let viewer = context.container().select(".photoviewer");
85542           if (!viewer.empty()) viewer.datum(null);
85543           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
85544           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
85545           this.updateUrlImage(null);
85546           return this.setStyles(context, null, true);
85547         },
85548         /**
85549          * selectImage().
85550          */
85551         selectImage: function(context, key) {
85552           let that = this;
85553           let d2 = this.cachedImage(key);
85554           let viewer = context.container().select(".photoviewer");
85555           if (!viewer.empty()) viewer.datum(d2);
85556           this.setStyles(context, null, true);
85557           let wrap2 = context.container().select(".photoviewer .ms-wrapper");
85558           let attribution = wrap2.selectAll(".photo-attribution").html("");
85559           wrap2.selectAll(".pnlm-load-box").style("display", "block");
85560           if (!d2) return this;
85561           this.updateUrlImage(key);
85562           _sceneOptions.northOffset = d2.ca;
85563           let line1 = attribution.append("div").attr("class", "attribution-row");
85564           const hiresDomId = utilUniqueDomId("streetside-hires");
85565           let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
85566           label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
85567             d3_event.stopPropagation();
85568             _hires = !_hires;
85569             _resolution = _hires ? 1024 : 512;
85570             wrap2.call(setupCanvas, true);
85571             let viewstate = {
85572               yaw: _pannellumViewer2.getYaw(),
85573               pitch: _pannellumViewer2.getPitch(),
85574               hfov: _pannellumViewer2.getHfov()
85575             };
85576             _sceneOptions = Object.assign(_sceneOptions, viewstate);
85577             that.selectImage(context, d2.key).showViewer(context);
85578           });
85579           label.append("span").call(_t.append("streetside.hires"));
85580           let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
85581           if (d2.captured_by) {
85582             const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
85583             captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
85584             captureInfo.append("span").text("|");
85585           }
85586           if (d2.captured_at) {
85587             captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
85588           }
85589           let line2 = attribution.append("div").attr("class", "attribution-row");
85590           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"));
85591           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"));
85592           const faceKeys = ["01", "02", "03", "10", "11", "12"];
85593           let quadKeys = getQuadKeys();
85594           let faces = faceKeys.map((faceKey) => {
85595             return quadKeys.map((quadKey) => {
85596               const xy = qkToXY(quadKey);
85597               return {
85598                 face: faceKey,
85599                 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
85600                 x: xy[0],
85601                 y: xy[1]
85602               };
85603             });
85604           });
85605           loadFaces(faces).then(function() {
85606             if (!_pannellumViewer2) {
85607               that.initViewer();
85608             } else {
85609               _currScene += 1;
85610               let sceneID = _currScene.toString();
85611               _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
85612               if (_currScene > 2) {
85613                 sceneID = (_currScene - 1).toString();
85614                 _pannellumViewer2.removeScene(sceneID);
85615               }
85616             }
85617           });
85618           return this;
85619         },
85620         getSequenceKeyForBubble: function(d2) {
85621           return d2 && d2.sequenceKey;
85622         },
85623         // Updates the currently highlighted sequence and selected bubble.
85624         // Reset is only necessary when interacting with the viewport because
85625         // this implicitly changes the currently selected bubble/sequence
85626         setStyles: function(context, hovered, reset) {
85627           if (reset) {
85628             context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
85629             context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
85630           }
85631           let hoveredBubbleKey = hovered && hovered.key;
85632           let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
85633           let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
85634           let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
85635           let viewer = context.container().select(".photoviewer");
85636           let selected = viewer.empty() ? void 0 : viewer.datum();
85637           let selectedBubbleKey = selected && selected.key;
85638           let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
85639           let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
85640           let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
85641           let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
85642           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);
85643           context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
85644           context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
85645           function viewfieldPath() {
85646             let d2 = this.parentNode.__data__;
85647             if (d2.pano && d2.key !== selectedBubbleKey) {
85648               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
85649             } else {
85650               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
85651             }
85652           }
85653           return this;
85654         },
85655         updateUrlImage: function(imageKey) {
85656           const hash2 = utilStringQs(window.location.hash);
85657           if (imageKey) {
85658             hash2.photo = "streetside/" + imageKey;
85659           } else {
85660             delete hash2.photo;
85661           }
85662           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
85663         },
85664         /**
85665          * cache().
85666          */
85667         cache: function() {
85668           return _ssCache;
85669         }
85670       };
85671     }
85672   });
85673
85674   // modules/services/taginfo.js
85675   var taginfo_exports = {};
85676   __export(taginfo_exports, {
85677     default: () => taginfo_default
85678   });
85679   function sets(params, n3, o2) {
85680     if (params.geometry && o2[params.geometry]) {
85681       params[n3] = o2[params.geometry];
85682     }
85683     return params;
85684   }
85685   function setFilter(params) {
85686     return sets(params, "filter", tag_filters);
85687   }
85688   function setSort(params) {
85689     return sets(params, "sortname", tag_sorts);
85690   }
85691   function setSortMembers(params) {
85692     return sets(params, "sortname", tag_sort_members);
85693   }
85694   function clean(params) {
85695     return utilObjectOmit(params, ["geometry", "debounce"]);
85696   }
85697   function filterKeys(type2) {
85698     var count_type = type2 ? "count_" + type2 : "count_all";
85699     return function(d2) {
85700       return Number(d2[count_type]) > 2500 || d2.in_wiki;
85701     };
85702   }
85703   function filterMultikeys(prefix) {
85704     return function(d2) {
85705       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
85706       var matches = d2.key.match(re3) || [];
85707       return matches.length === 2 && matches[1].indexOf(":") === -1;
85708     };
85709   }
85710   function filterValues(allowUpperCase) {
85711     return function(d2) {
85712       if (d2.value.match(/[;,]/) !== null) return false;
85713       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
85714       return d2.count > 100 || d2.in_wiki;
85715     };
85716   }
85717   function filterRoles(geometry) {
85718     return function(d2) {
85719       if (d2.role === "") return false;
85720       if (d2.role.match(/[A-Z*;,]/) !== null) return false;
85721       return Number(d2[tag_members_fractions[geometry]]) > 0;
85722     };
85723   }
85724   function valKey(d2) {
85725     return {
85726       value: d2.key,
85727       title: d2.key
85728     };
85729   }
85730   function valKeyDescription(d2) {
85731     var obj = {
85732       value: d2.value,
85733       title: d2.description || d2.value
85734     };
85735     return obj;
85736   }
85737   function roleKey(d2) {
85738     return {
85739       value: d2.role,
85740       title: d2.role
85741     };
85742   }
85743   function sortKeys(a2, b2) {
85744     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
85745   }
85746   function request2(url, params, exactMatch, callback, loaded) {
85747     if (_inflight3[url]) return;
85748     if (checkCache(url, params, exactMatch, callback)) return;
85749     var controller = new AbortController();
85750     _inflight3[url] = controller;
85751     json_default(url, { signal: controller.signal }).then(function(result) {
85752       delete _inflight3[url];
85753       if (loaded) loaded(null, result);
85754     }).catch(function(err) {
85755       delete _inflight3[url];
85756       if (err.name === "AbortError") return;
85757       if (loaded) loaded(err.message);
85758     });
85759   }
85760   function checkCache(url, params, exactMatch, callback) {
85761     var rp = params.rp || 25;
85762     var testQuery = params.query || "";
85763     var testUrl = url;
85764     do {
85765       var hit = _taginfoCache[testUrl];
85766       if (hit && (url === testUrl || hit.length < rp)) {
85767         callback(null, hit);
85768         return true;
85769       }
85770       if (exactMatch || !testQuery.length) return false;
85771       testQuery = testQuery.slice(0, -1);
85772       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
85773     } while (testQuery.length >= 0);
85774     return false;
85775   }
85776   var apibase4, _inflight3, _popularKeys, _taginfoCache, tag_sorts, tag_sort_members, tag_filters, tag_members_fractions, debouncedRequest2, taginfo_default;
85777   var init_taginfo = __esm({
85778     "modules/services/taginfo.js"() {
85779       "use strict";
85780       init_debounce();
85781       init_src18();
85782       init_util();
85783       init_localizer();
85784       init_tags();
85785       init_id();
85786       apibase4 = taginfoApiUrl;
85787       _inflight3 = {};
85788       _popularKeys = {};
85789       _taginfoCache = {};
85790       tag_sorts = {
85791         point: "count_nodes",
85792         vertex: "count_nodes",
85793         area: "count_ways",
85794         line: "count_ways"
85795       };
85796       tag_sort_members = {
85797         point: "count_node_members",
85798         vertex: "count_node_members",
85799         area: "count_way_members",
85800         line: "count_way_members",
85801         relation: "count_relation_members"
85802       };
85803       tag_filters = {
85804         point: "nodes",
85805         vertex: "nodes",
85806         area: "ways",
85807         line: "ways"
85808       };
85809       tag_members_fractions = {
85810         point: "count_node_members_fraction",
85811         vertex: "count_node_members_fraction",
85812         area: "count_way_members_fraction",
85813         line: "count_way_members_fraction",
85814         relation: "count_relation_members_fraction"
85815       };
85816       debouncedRequest2 = debounce_default(request2, 300, { leading: false });
85817       taginfo_default = {
85818         init: function() {
85819           _inflight3 = {};
85820           _taginfoCache = {};
85821           _popularKeys = {
85822             // manually exclude some keys – #5377, #7485
85823             postal_code: true,
85824             full_name: true,
85825             loc_name: true,
85826             reg_name: true,
85827             short_name: true,
85828             sorting_name: true,
85829             artist_name: true,
85830             nat_name: true,
85831             long_name: true,
85832             via: true,
85833             "bridge:name": true
85834           };
85835           var params = {
85836             rp: 100,
85837             sortname: "values_all",
85838             sortorder: "desc",
85839             page: 1,
85840             debounce: false,
85841             lang: _mainLocalizer.languageCode()
85842           };
85843           this.keys(params, function(err, data) {
85844             if (err) return;
85845             data.forEach(function(d2) {
85846               if (d2.value === "opening_hours") return;
85847               _popularKeys[d2.value] = true;
85848             });
85849           });
85850         },
85851         reset: function() {
85852           Object.values(_inflight3).forEach(function(controller) {
85853             controller.abort();
85854           });
85855           _inflight3 = {};
85856         },
85857         keys: function(params, callback) {
85858           var doRequest = params.debounce ? debouncedRequest2 : request2;
85859           params = clean(setSort(params));
85860           params = Object.assign({
85861             rp: 10,
85862             sortname: "count_all",
85863             sortorder: "desc",
85864             page: 1,
85865             lang: _mainLocalizer.languageCode()
85866           }, params);
85867           var url = apibase4 + "keys/all?" + utilQsString(params);
85868           doRequest(url, params, false, callback, function(err, d2) {
85869             if (err) {
85870               callback(err);
85871             } else {
85872               var f2 = filterKeys(params.filter);
85873               var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
85874               _taginfoCache[url] = result;
85875               callback(null, result);
85876             }
85877           });
85878         },
85879         multikeys: function(params, callback) {
85880           var doRequest = params.debounce ? debouncedRequest2 : request2;
85881           params = clean(setSort(params));
85882           params = Object.assign({
85883             rp: 25,
85884             sortname: "count_all",
85885             sortorder: "desc",
85886             page: 1,
85887             lang: _mainLocalizer.languageCode()
85888           }, params);
85889           var prefix = params.query;
85890           var url = apibase4 + "keys/all?" + utilQsString(params);
85891           doRequest(url, params, true, callback, function(err, d2) {
85892             if (err) {
85893               callback(err);
85894             } else {
85895               var f2 = filterMultikeys(prefix);
85896               var result = d2.data.filter(f2).map(valKey);
85897               _taginfoCache[url] = result;
85898               callback(null, result);
85899             }
85900           });
85901         },
85902         values: function(params, callback) {
85903           var key = params.key;
85904           if (key && _popularKeys[key]) {
85905             callback(null, []);
85906             return;
85907           }
85908           var doRequest = params.debounce ? debouncedRequest2 : request2;
85909           params = clean(setSort(setFilter(params)));
85910           params = Object.assign({
85911             rp: 25,
85912             sortname: "count_all",
85913             sortorder: "desc",
85914             page: 1,
85915             lang: _mainLocalizer.languageCode()
85916           }, params);
85917           var url = apibase4 + "key/values?" + utilQsString(params);
85918           doRequest(url, params, false, callback, function(err, d2) {
85919             if (err) {
85920               callback(err);
85921             } else {
85922               var allowUpperCase = allowUpperCaseTagValues.test(params.key);
85923               var f2 = filterValues(allowUpperCase);
85924               var result = d2.data.filter(f2).map(valKeyDescription);
85925               _taginfoCache[url] = result;
85926               callback(null, result);
85927             }
85928           });
85929         },
85930         roles: function(params, callback) {
85931           var doRequest = params.debounce ? debouncedRequest2 : request2;
85932           var geometry = params.geometry;
85933           params = clean(setSortMembers(params));
85934           params = Object.assign({
85935             rp: 25,
85936             sortname: "count_all_members",
85937             sortorder: "desc",
85938             page: 1,
85939             lang: _mainLocalizer.languageCode()
85940           }, params);
85941           var url = apibase4 + "relation/roles?" + utilQsString(params);
85942           doRequest(url, params, true, callback, function(err, d2) {
85943             if (err) {
85944               callback(err);
85945             } else {
85946               var f2 = filterRoles(geometry);
85947               var result = d2.data.filter(f2).map(roleKey);
85948               _taginfoCache[url] = result;
85949               callback(null, result);
85950             }
85951           });
85952         },
85953         docs: function(params, callback) {
85954           var doRequest = params.debounce ? debouncedRequest2 : request2;
85955           params = clean(setSort(params));
85956           var path = "key/wiki_pages?";
85957           if (params.value) {
85958             path = "tag/wiki_pages?";
85959           } else if (params.rtype) {
85960             path = "relation/wiki_pages?";
85961           }
85962           var url = apibase4 + path + utilQsString(params);
85963           doRequest(url, params, true, callback, function(err, d2) {
85964             if (err) {
85965               callback(err);
85966             } else {
85967               _taginfoCache[url] = d2.data;
85968               callback(null, d2.data);
85969             }
85970           });
85971         },
85972         apibase: function(_2) {
85973           if (!arguments.length) return apibase4;
85974           apibase4 = _2;
85975           return this;
85976         }
85977       };
85978     }
85979   });
85980
85981   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
85982   var require_polygon_clipping_umd = __commonJS({
85983     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
85984       (function(global2, factory) {
85985         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());
85986       })(exports2, function() {
85987         "use strict";
85988         function __generator(thisArg, body) {
85989           var _2 = {
85990             label: 0,
85991             sent: function() {
85992               if (t2[0] & 1) throw t2[1];
85993               return t2[1];
85994             },
85995             trys: [],
85996             ops: []
85997           }, f2, y2, t2, g3;
85998           return g3 = {
85999             next: verb(0),
86000             "throw": verb(1),
86001             "return": verb(2)
86002           }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
86003             return this;
86004           }), g3;
86005           function verb(n3) {
86006             return function(v2) {
86007               return step([n3, v2]);
86008             };
86009           }
86010           function step(op) {
86011             if (f2) throw new TypeError("Generator is already executing.");
86012             while (_2) try {
86013               if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) return t2;
86014               if (y2 = 0, t2) op = [op[0] & 2, t2.value];
86015               switch (op[0]) {
86016                 case 0:
86017                 case 1:
86018                   t2 = op;
86019                   break;
86020                 case 4:
86021                   _2.label++;
86022                   return {
86023                     value: op[1],
86024                     done: false
86025                   };
86026                 case 5:
86027                   _2.label++;
86028                   y2 = op[1];
86029                   op = [0];
86030                   continue;
86031                 case 7:
86032                   op = _2.ops.pop();
86033                   _2.trys.pop();
86034                   continue;
86035                 default:
86036                   if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
86037                     _2 = 0;
86038                     continue;
86039                   }
86040                   if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
86041                     _2.label = op[1];
86042                     break;
86043                   }
86044                   if (op[0] === 6 && _2.label < t2[1]) {
86045                     _2.label = t2[1];
86046                     t2 = op;
86047                     break;
86048                   }
86049                   if (t2 && _2.label < t2[2]) {
86050                     _2.label = t2[2];
86051                     _2.ops.push(op);
86052                     break;
86053                   }
86054                   if (t2[2]) _2.ops.pop();
86055                   _2.trys.pop();
86056                   continue;
86057               }
86058               op = body.call(thisArg, _2);
86059             } catch (e3) {
86060               op = [6, e3];
86061               y2 = 0;
86062             } finally {
86063               f2 = t2 = 0;
86064             }
86065             if (op[0] & 5) throw op[1];
86066             return {
86067               value: op[0] ? op[1] : void 0,
86068               done: true
86069             };
86070           }
86071         }
86072         var Node = (
86073           /** @class */
86074           /* @__PURE__ */ function() {
86075             function Node2(key, data) {
86076               this.next = null;
86077               this.key = key;
86078               this.data = data;
86079               this.left = null;
86080               this.right = null;
86081             }
86082             return Node2;
86083           }()
86084         );
86085         function DEFAULT_COMPARE(a2, b2) {
86086           return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
86087         }
86088         function splay(i3, t2, comparator) {
86089           var N2 = new Node(null, null);
86090           var l2 = N2;
86091           var r2 = N2;
86092           while (true) {
86093             var cmp2 = comparator(i3, t2.key);
86094             if (cmp2 < 0) {
86095               if (t2.left === null) break;
86096               if (comparator(i3, t2.left.key) < 0) {
86097                 var y2 = t2.left;
86098                 t2.left = y2.right;
86099                 y2.right = t2;
86100                 t2 = y2;
86101                 if (t2.left === null) break;
86102               }
86103               r2.left = t2;
86104               r2 = t2;
86105               t2 = t2.left;
86106             } else if (cmp2 > 0) {
86107               if (t2.right === null) break;
86108               if (comparator(i3, t2.right.key) > 0) {
86109                 var y2 = t2.right;
86110                 t2.right = y2.left;
86111                 y2.left = t2;
86112                 t2 = y2;
86113                 if (t2.right === null) break;
86114               }
86115               l2.right = t2;
86116               l2 = t2;
86117               t2 = t2.right;
86118             } else break;
86119           }
86120           l2.right = t2.left;
86121           r2.left = t2.right;
86122           t2.left = N2.right;
86123           t2.right = N2.left;
86124           return t2;
86125         }
86126         function insert(i3, data, t2, comparator) {
86127           var node = new Node(i3, data);
86128           if (t2 === null) {
86129             node.left = node.right = null;
86130             return node;
86131           }
86132           t2 = splay(i3, t2, comparator);
86133           var cmp2 = comparator(i3, t2.key);
86134           if (cmp2 < 0) {
86135             node.left = t2.left;
86136             node.right = t2;
86137             t2.left = null;
86138           } else if (cmp2 >= 0) {
86139             node.right = t2.right;
86140             node.left = t2;
86141             t2.right = null;
86142           }
86143           return node;
86144         }
86145         function split(key, v2, comparator) {
86146           var left = null;
86147           var right = null;
86148           if (v2) {
86149             v2 = splay(key, v2, comparator);
86150             var cmp2 = comparator(v2.key, key);
86151             if (cmp2 === 0) {
86152               left = v2.left;
86153               right = v2.right;
86154             } else if (cmp2 < 0) {
86155               right = v2.right;
86156               v2.right = null;
86157               left = v2;
86158             } else {
86159               left = v2.left;
86160               v2.left = null;
86161               right = v2;
86162             }
86163           }
86164           return {
86165             left,
86166             right
86167           };
86168         }
86169         function merge3(left, right, comparator) {
86170           if (right === null) return left;
86171           if (left === null) return right;
86172           right = splay(left.key, right, comparator);
86173           right.left = left;
86174           return right;
86175         }
86176         function printRow(root3, prefix, isTail, out, printNode) {
86177           if (root3) {
86178             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
86179             var indent = prefix + (isTail ? "    " : "\u2502   ");
86180             if (root3.left) printRow(root3.left, indent, false, out, printNode);
86181             if (root3.right) printRow(root3.right, indent, true, out, printNode);
86182           }
86183         }
86184         var Tree = (
86185           /** @class */
86186           function() {
86187             function Tree2(comparator) {
86188               if (comparator === void 0) {
86189                 comparator = DEFAULT_COMPARE;
86190               }
86191               this._root = null;
86192               this._size = 0;
86193               this._comparator = comparator;
86194             }
86195             Tree2.prototype.insert = function(key, data) {
86196               this._size++;
86197               return this._root = insert(key, data, this._root, this._comparator);
86198             };
86199             Tree2.prototype.add = function(key, data) {
86200               var node = new Node(key, data);
86201               if (this._root === null) {
86202                 node.left = node.right = null;
86203                 this._size++;
86204                 this._root = node;
86205               }
86206               var comparator = this._comparator;
86207               var t2 = splay(key, this._root, comparator);
86208               var cmp2 = comparator(key, t2.key);
86209               if (cmp2 === 0) this._root = t2;
86210               else {
86211                 if (cmp2 < 0) {
86212                   node.left = t2.left;
86213                   node.right = t2;
86214                   t2.left = null;
86215                 } else if (cmp2 > 0) {
86216                   node.right = t2.right;
86217                   node.left = t2;
86218                   t2.right = null;
86219                 }
86220                 this._size++;
86221                 this._root = node;
86222               }
86223               return this._root;
86224             };
86225             Tree2.prototype.remove = function(key) {
86226               this._root = this._remove(key, this._root, this._comparator);
86227             };
86228             Tree2.prototype._remove = function(i3, t2, comparator) {
86229               var x2;
86230               if (t2 === null) return null;
86231               t2 = splay(i3, t2, comparator);
86232               var cmp2 = comparator(i3, t2.key);
86233               if (cmp2 === 0) {
86234                 if (t2.left === null) {
86235                   x2 = t2.right;
86236                 } else {
86237                   x2 = splay(i3, t2.left, comparator);
86238                   x2.right = t2.right;
86239                 }
86240                 this._size--;
86241                 return x2;
86242               }
86243               return t2;
86244             };
86245             Tree2.prototype.pop = function() {
86246               var node = this._root;
86247               if (node) {
86248                 while (node.left) node = node.left;
86249                 this._root = splay(node.key, this._root, this._comparator);
86250                 this._root = this._remove(node.key, this._root, this._comparator);
86251                 return {
86252                   key: node.key,
86253                   data: node.data
86254                 };
86255               }
86256               return null;
86257             };
86258             Tree2.prototype.findStatic = function(key) {
86259               var current = this._root;
86260               var compare2 = this._comparator;
86261               while (current) {
86262                 var cmp2 = compare2(key, current.key);
86263                 if (cmp2 === 0) return current;
86264                 else if (cmp2 < 0) current = current.left;
86265                 else current = current.right;
86266               }
86267               return null;
86268             };
86269             Tree2.prototype.find = function(key) {
86270               if (this._root) {
86271                 this._root = splay(key, this._root, this._comparator);
86272                 if (this._comparator(key, this._root.key) !== 0) return null;
86273               }
86274               return this._root;
86275             };
86276             Tree2.prototype.contains = function(key) {
86277               var current = this._root;
86278               var compare2 = this._comparator;
86279               while (current) {
86280                 var cmp2 = compare2(key, current.key);
86281                 if (cmp2 === 0) return true;
86282                 else if (cmp2 < 0) current = current.left;
86283                 else current = current.right;
86284               }
86285               return false;
86286             };
86287             Tree2.prototype.forEach = function(visitor, ctx) {
86288               var current = this._root;
86289               var Q2 = [];
86290               var done = false;
86291               while (!done) {
86292                 if (current !== null) {
86293                   Q2.push(current);
86294                   current = current.left;
86295                 } else {
86296                   if (Q2.length !== 0) {
86297                     current = Q2.pop();
86298                     visitor.call(ctx, current);
86299                     current = current.right;
86300                   } else done = true;
86301                 }
86302               }
86303               return this;
86304             };
86305             Tree2.prototype.range = function(low, high, fn, ctx) {
86306               var Q2 = [];
86307               var compare2 = this._comparator;
86308               var node = this._root;
86309               var cmp2;
86310               while (Q2.length !== 0 || node) {
86311                 if (node) {
86312                   Q2.push(node);
86313                   node = node.left;
86314                 } else {
86315                   node = Q2.pop();
86316                   cmp2 = compare2(node.key, high);
86317                   if (cmp2 > 0) {
86318                     break;
86319                   } else if (compare2(node.key, low) >= 0) {
86320                     if (fn.call(ctx, node)) return this;
86321                   }
86322                   node = node.right;
86323                 }
86324               }
86325               return this;
86326             };
86327             Tree2.prototype.keys = function() {
86328               var keys2 = [];
86329               this.forEach(function(_a3) {
86330                 var key = _a3.key;
86331                 return keys2.push(key);
86332               });
86333               return keys2;
86334             };
86335             Tree2.prototype.values = function() {
86336               var values = [];
86337               this.forEach(function(_a3) {
86338                 var data = _a3.data;
86339                 return values.push(data);
86340               });
86341               return values;
86342             };
86343             Tree2.prototype.min = function() {
86344               if (this._root) return this.minNode(this._root).key;
86345               return null;
86346             };
86347             Tree2.prototype.max = function() {
86348               if (this._root) return this.maxNode(this._root).key;
86349               return null;
86350             };
86351             Tree2.prototype.minNode = function(t2) {
86352               if (t2 === void 0) {
86353                 t2 = this._root;
86354               }
86355               if (t2) while (t2.left) t2 = t2.left;
86356               return t2;
86357             };
86358             Tree2.prototype.maxNode = function(t2) {
86359               if (t2 === void 0) {
86360                 t2 = this._root;
86361               }
86362               if (t2) while (t2.right) t2 = t2.right;
86363               return t2;
86364             };
86365             Tree2.prototype.at = function(index2) {
86366               var current = this._root;
86367               var done = false;
86368               var i3 = 0;
86369               var Q2 = [];
86370               while (!done) {
86371                 if (current) {
86372                   Q2.push(current);
86373                   current = current.left;
86374                 } else {
86375                   if (Q2.length > 0) {
86376                     current = Q2.pop();
86377                     if (i3 === index2) return current;
86378                     i3++;
86379                     current = current.right;
86380                   } else done = true;
86381                 }
86382               }
86383               return null;
86384             };
86385             Tree2.prototype.next = function(d2) {
86386               var root3 = this._root;
86387               var successor = null;
86388               if (d2.right) {
86389                 successor = d2.right;
86390                 while (successor.left) successor = successor.left;
86391                 return successor;
86392               }
86393               var comparator = this._comparator;
86394               while (root3) {
86395                 var cmp2 = comparator(d2.key, root3.key);
86396                 if (cmp2 === 0) break;
86397                 else if (cmp2 < 0) {
86398                   successor = root3;
86399                   root3 = root3.left;
86400                 } else root3 = root3.right;
86401               }
86402               return successor;
86403             };
86404             Tree2.prototype.prev = function(d2) {
86405               var root3 = this._root;
86406               var predecessor = null;
86407               if (d2.left !== null) {
86408                 predecessor = d2.left;
86409                 while (predecessor.right) predecessor = predecessor.right;
86410                 return predecessor;
86411               }
86412               var comparator = this._comparator;
86413               while (root3) {
86414                 var cmp2 = comparator(d2.key, root3.key);
86415                 if (cmp2 === 0) break;
86416                 else if (cmp2 < 0) root3 = root3.left;
86417                 else {
86418                   predecessor = root3;
86419                   root3 = root3.right;
86420                 }
86421               }
86422               return predecessor;
86423             };
86424             Tree2.prototype.clear = function() {
86425               this._root = null;
86426               this._size = 0;
86427               return this;
86428             };
86429             Tree2.prototype.toList = function() {
86430               return toList(this._root);
86431             };
86432             Tree2.prototype.load = function(keys2, values, presort) {
86433               if (values === void 0) {
86434                 values = [];
86435               }
86436               if (presort === void 0) {
86437                 presort = false;
86438               }
86439               var size = keys2.length;
86440               var comparator = this._comparator;
86441               if (presort) sort(keys2, values, 0, size - 1, comparator);
86442               if (this._root === null) {
86443                 this._root = loadRecursive(keys2, values, 0, size);
86444                 this._size = size;
86445               } else {
86446                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
86447                 size = this._size + size;
86448                 this._root = sortedListToBST({
86449                   head: mergedList
86450                 }, 0, size);
86451               }
86452               return this;
86453             };
86454             Tree2.prototype.isEmpty = function() {
86455               return this._root === null;
86456             };
86457             Object.defineProperty(Tree2.prototype, "size", {
86458               get: function() {
86459                 return this._size;
86460               },
86461               enumerable: true,
86462               configurable: true
86463             });
86464             Object.defineProperty(Tree2.prototype, "root", {
86465               get: function() {
86466                 return this._root;
86467               },
86468               enumerable: true,
86469               configurable: true
86470             });
86471             Tree2.prototype.toString = function(printNode) {
86472               if (printNode === void 0) {
86473                 printNode = function(n3) {
86474                   return String(n3.key);
86475                 };
86476               }
86477               var out = [];
86478               printRow(this._root, "", true, function(v2) {
86479                 return out.push(v2);
86480               }, printNode);
86481               return out.join("");
86482             };
86483             Tree2.prototype.update = function(key, newKey, newData) {
86484               var comparator = this._comparator;
86485               var _a3 = split(key, this._root, comparator), left = _a3.left, right = _a3.right;
86486               if (comparator(key, newKey) < 0) {
86487                 right = insert(newKey, newData, right, comparator);
86488               } else {
86489                 left = insert(newKey, newData, left, comparator);
86490               }
86491               this._root = merge3(left, right, comparator);
86492             };
86493             Tree2.prototype.split = function(key) {
86494               return split(key, this._root, this._comparator);
86495             };
86496             Tree2.prototype[Symbol.iterator] = function() {
86497               var current, Q2, done;
86498               return __generator(this, function(_a3) {
86499                 switch (_a3.label) {
86500                   case 0:
86501                     current = this._root;
86502                     Q2 = [];
86503                     done = false;
86504                     _a3.label = 1;
86505                   case 1:
86506                     if (!!done) return [3, 6];
86507                     if (!(current !== null)) return [3, 2];
86508                     Q2.push(current);
86509                     current = current.left;
86510                     return [3, 5];
86511                   case 2:
86512                     if (!(Q2.length !== 0)) return [3, 4];
86513                     current = Q2.pop();
86514                     return [4, current];
86515                   case 3:
86516                     _a3.sent();
86517                     current = current.right;
86518                     return [3, 5];
86519                   case 4:
86520                     done = true;
86521                     _a3.label = 5;
86522                   case 5:
86523                     return [3, 1];
86524                   case 6:
86525                     return [
86526                       2
86527                       /*return*/
86528                     ];
86529                 }
86530               });
86531             };
86532             return Tree2;
86533           }()
86534         );
86535         function loadRecursive(keys2, values, start2, end) {
86536           var size = end - start2;
86537           if (size > 0) {
86538             var middle = start2 + Math.floor(size / 2);
86539             var key = keys2[middle];
86540             var data = values[middle];
86541             var node = new Node(key, data);
86542             node.left = loadRecursive(keys2, values, start2, middle);
86543             node.right = loadRecursive(keys2, values, middle + 1, end);
86544             return node;
86545           }
86546           return null;
86547         }
86548         function createList(keys2, values) {
86549           var head = new Node(null, null);
86550           var p2 = head;
86551           for (var i3 = 0; i3 < keys2.length; i3++) {
86552             p2 = p2.next = new Node(keys2[i3], values[i3]);
86553           }
86554           p2.next = null;
86555           return head.next;
86556         }
86557         function toList(root3) {
86558           var current = root3;
86559           var Q2 = [];
86560           var done = false;
86561           var head = new Node(null, null);
86562           var p2 = head;
86563           while (!done) {
86564             if (current) {
86565               Q2.push(current);
86566               current = current.left;
86567             } else {
86568               if (Q2.length > 0) {
86569                 current = p2 = p2.next = Q2.pop();
86570                 current = current.right;
86571               } else done = true;
86572             }
86573           }
86574           p2.next = null;
86575           return head.next;
86576         }
86577         function sortedListToBST(list2, start2, end) {
86578           var size = end - start2;
86579           if (size > 0) {
86580             var middle = start2 + Math.floor(size / 2);
86581             var left = sortedListToBST(list2, start2, middle);
86582             var root3 = list2.head;
86583             root3.left = left;
86584             list2.head = list2.head.next;
86585             root3.right = sortedListToBST(list2, middle + 1, end);
86586             return root3;
86587           }
86588           return null;
86589         }
86590         function mergeLists(l1, l2, compare2) {
86591           var head = new Node(null, null);
86592           var p2 = head;
86593           var p1 = l1;
86594           var p22 = l2;
86595           while (p1 !== null && p22 !== null) {
86596             if (compare2(p1.key, p22.key) < 0) {
86597               p2.next = p1;
86598               p1 = p1.next;
86599             } else {
86600               p2.next = p22;
86601               p22 = p22.next;
86602             }
86603             p2 = p2.next;
86604           }
86605           if (p1 !== null) {
86606             p2.next = p1;
86607           } else if (p22 !== null) {
86608             p2.next = p22;
86609           }
86610           return head.next;
86611         }
86612         function sort(keys2, values, left, right, compare2) {
86613           if (left >= right) return;
86614           var pivot = keys2[left + right >> 1];
86615           var i3 = left - 1;
86616           var j2 = right + 1;
86617           while (true) {
86618             do
86619               i3++;
86620             while (compare2(keys2[i3], pivot) < 0);
86621             do
86622               j2--;
86623             while (compare2(keys2[j2], pivot) > 0);
86624             if (i3 >= j2) break;
86625             var tmp = keys2[i3];
86626             keys2[i3] = keys2[j2];
86627             keys2[j2] = tmp;
86628             tmp = values[i3];
86629             values[i3] = values[j2];
86630             values[j2] = tmp;
86631           }
86632           sort(keys2, values, left, j2, compare2);
86633           sort(keys2, values, j2 + 1, right, compare2);
86634         }
86635         const isInBbox2 = (bbox2, point) => {
86636           return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
86637         };
86638         const getBboxOverlap2 = (b1, b2) => {
86639           if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y) return null;
86640           const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
86641           const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
86642           const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
86643           const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
86644           return {
86645             ll: {
86646               x: lowerX,
86647               y: lowerY
86648             },
86649             ur: {
86650               x: upperX,
86651               y: upperY
86652             }
86653           };
86654         };
86655         let epsilon$1 = Number.EPSILON;
86656         if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
86657         const EPSILON_SQ = epsilon$1 * epsilon$1;
86658         const cmp = (a2, b2) => {
86659           if (-epsilon$1 < a2 && a2 < epsilon$1) {
86660             if (-epsilon$1 < b2 && b2 < epsilon$1) {
86661               return 0;
86662             }
86663           }
86664           const ab = a2 - b2;
86665           if (ab * ab < EPSILON_SQ * a2 * b2) {
86666             return 0;
86667           }
86668           return a2 < b2 ? -1 : 1;
86669         };
86670         class PtRounder {
86671           constructor() {
86672             this.reset();
86673           }
86674           reset() {
86675             this.xRounder = new CoordRounder();
86676             this.yRounder = new CoordRounder();
86677           }
86678           round(x2, y2) {
86679             return {
86680               x: this.xRounder.round(x2),
86681               y: this.yRounder.round(y2)
86682             };
86683           }
86684         }
86685         class CoordRounder {
86686           constructor() {
86687             this.tree = new Tree();
86688             this.round(0);
86689           }
86690           // Note: this can rounds input values backwards or forwards.
86691           //       You might ask, why not restrict this to just rounding
86692           //       forwards? Wouldn't that allow left endpoints to always
86693           //       remain left endpoints during splitting (never change to
86694           //       right). No - it wouldn't, because we snap intersections
86695           //       to endpoints (to establish independence from the segment
86696           //       angle for t-intersections).
86697           round(coord2) {
86698             const node = this.tree.add(coord2);
86699             const prevNode = this.tree.prev(node);
86700             if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
86701               this.tree.remove(coord2);
86702               return prevNode.key;
86703             }
86704             const nextNode = this.tree.next(node);
86705             if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
86706               this.tree.remove(coord2);
86707               return nextNode.key;
86708             }
86709             return coord2;
86710           }
86711         }
86712         const rounder = new PtRounder();
86713         const epsilon3 = 11102230246251565e-32;
86714         const splitter = 134217729;
86715         const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
86716         function sum(elen, e3, flen, f2, h2) {
86717           let Q2, Qnew, hh, bvirt;
86718           let enow = e3[0];
86719           let fnow = f2[0];
86720           let eindex = 0;
86721           let findex = 0;
86722           if (fnow > enow === fnow > -enow) {
86723             Q2 = enow;
86724             enow = e3[++eindex];
86725           } else {
86726             Q2 = fnow;
86727             fnow = f2[++findex];
86728           }
86729           let hindex = 0;
86730           if (eindex < elen && findex < flen) {
86731             if (fnow > enow === fnow > -enow) {
86732               Qnew = enow + Q2;
86733               hh = Q2 - (Qnew - enow);
86734               enow = e3[++eindex];
86735             } else {
86736               Qnew = fnow + Q2;
86737               hh = Q2 - (Qnew - fnow);
86738               fnow = f2[++findex];
86739             }
86740             Q2 = Qnew;
86741             if (hh !== 0) {
86742               h2[hindex++] = hh;
86743             }
86744             while (eindex < elen && findex < flen) {
86745               if (fnow > enow === fnow > -enow) {
86746                 Qnew = Q2 + enow;
86747                 bvirt = Qnew - Q2;
86748                 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
86749                 enow = e3[++eindex];
86750               } else {
86751                 Qnew = Q2 + fnow;
86752                 bvirt = Qnew - Q2;
86753                 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
86754                 fnow = f2[++findex];
86755               }
86756               Q2 = Qnew;
86757               if (hh !== 0) {
86758                 h2[hindex++] = hh;
86759               }
86760             }
86761           }
86762           while (eindex < elen) {
86763             Qnew = Q2 + enow;
86764             bvirt = Qnew - Q2;
86765             hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
86766             enow = e3[++eindex];
86767             Q2 = Qnew;
86768             if (hh !== 0) {
86769               h2[hindex++] = hh;
86770             }
86771           }
86772           while (findex < flen) {
86773             Qnew = Q2 + fnow;
86774             bvirt = Qnew - Q2;
86775             hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
86776             fnow = f2[++findex];
86777             Q2 = Qnew;
86778             if (hh !== 0) {
86779               h2[hindex++] = hh;
86780             }
86781           }
86782           if (Q2 !== 0 || hindex === 0) {
86783             h2[hindex++] = Q2;
86784           }
86785           return hindex;
86786         }
86787         function estimate(elen, e3) {
86788           let Q2 = e3[0];
86789           for (let i3 = 1; i3 < elen; i3++) Q2 += e3[i3];
86790           return Q2;
86791         }
86792         function vec(n3) {
86793           return new Float64Array(n3);
86794         }
86795         const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
86796         const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
86797         const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
86798         const B2 = vec(4);
86799         const C1 = vec(8);
86800         const C2 = vec(12);
86801         const D2 = vec(16);
86802         const u2 = vec(4);
86803         function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
86804           let acxtail, acytail, bcxtail, bcytail;
86805           let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3;
86806           const acx = ax - cx;
86807           const bcx = bx - cx;
86808           const acy = ay - cy;
86809           const bcy = by - cy;
86810           s1 = acx * bcy;
86811           c2 = splitter * acx;
86812           ahi = c2 - (c2 - acx);
86813           alo = acx - ahi;
86814           c2 = splitter * bcy;
86815           bhi = c2 - (c2 - bcy);
86816           blo = bcy - bhi;
86817           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86818           t12 = acy * bcx;
86819           c2 = splitter * acy;
86820           ahi = c2 - (c2 - acy);
86821           alo = acy - ahi;
86822           c2 = splitter * bcx;
86823           bhi = c2 - (c2 - bcx);
86824           blo = bcx - bhi;
86825           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86826           _i = s0 - t02;
86827           bvirt = s0 - _i;
86828           B2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86829           _j = s1 + _i;
86830           bvirt = _j - s1;
86831           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86832           _i = _0 - t12;
86833           bvirt = _0 - _i;
86834           B2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86835           u3 = _j + _i;
86836           bvirt = u3 - _j;
86837           B2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86838           B2[3] = u3;
86839           let det = estimate(4, B2);
86840           let errbound = ccwerrboundB * detsum;
86841           if (det >= errbound || -det >= errbound) {
86842             return det;
86843           }
86844           bvirt = ax - acx;
86845           acxtail = ax - (acx + bvirt) + (bvirt - cx);
86846           bvirt = bx - bcx;
86847           bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
86848           bvirt = ay - acy;
86849           acytail = ay - (acy + bvirt) + (bvirt - cy);
86850           bvirt = by - bcy;
86851           bcytail = by - (bcy + bvirt) + (bvirt - cy);
86852           if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
86853             return det;
86854           }
86855           errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
86856           det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
86857           if (det >= errbound || -det >= errbound) return det;
86858           s1 = acxtail * bcy;
86859           c2 = splitter * acxtail;
86860           ahi = c2 - (c2 - acxtail);
86861           alo = acxtail - ahi;
86862           c2 = splitter * bcy;
86863           bhi = c2 - (c2 - bcy);
86864           blo = bcy - bhi;
86865           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86866           t12 = acytail * bcx;
86867           c2 = splitter * acytail;
86868           ahi = c2 - (c2 - acytail);
86869           alo = acytail - ahi;
86870           c2 = splitter * bcx;
86871           bhi = c2 - (c2 - bcx);
86872           blo = bcx - bhi;
86873           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86874           _i = s0 - t02;
86875           bvirt = s0 - _i;
86876           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86877           _j = s1 + _i;
86878           bvirt = _j - s1;
86879           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86880           _i = _0 - t12;
86881           bvirt = _0 - _i;
86882           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86883           u3 = _j + _i;
86884           bvirt = u3 - _j;
86885           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86886           u2[3] = u3;
86887           const C1len = sum(4, B2, 4, u2, C1);
86888           s1 = acx * bcytail;
86889           c2 = splitter * acx;
86890           ahi = c2 - (c2 - acx);
86891           alo = acx - ahi;
86892           c2 = splitter * bcytail;
86893           bhi = c2 - (c2 - bcytail);
86894           blo = bcytail - bhi;
86895           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86896           t12 = acy * bcxtail;
86897           c2 = splitter * acy;
86898           ahi = c2 - (c2 - acy);
86899           alo = acy - ahi;
86900           c2 = splitter * bcxtail;
86901           bhi = c2 - (c2 - bcxtail);
86902           blo = bcxtail - bhi;
86903           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86904           _i = s0 - t02;
86905           bvirt = s0 - _i;
86906           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86907           _j = s1 + _i;
86908           bvirt = _j - s1;
86909           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86910           _i = _0 - t12;
86911           bvirt = _0 - _i;
86912           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86913           u3 = _j + _i;
86914           bvirt = u3 - _j;
86915           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86916           u2[3] = u3;
86917           const C2len = sum(C1len, C1, 4, u2, C2);
86918           s1 = acxtail * bcytail;
86919           c2 = splitter * acxtail;
86920           ahi = c2 - (c2 - acxtail);
86921           alo = acxtail - ahi;
86922           c2 = splitter * bcytail;
86923           bhi = c2 - (c2 - bcytail);
86924           blo = bcytail - bhi;
86925           s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
86926           t12 = acytail * bcxtail;
86927           c2 = splitter * acytail;
86928           ahi = c2 - (c2 - acytail);
86929           alo = acytail - ahi;
86930           c2 = splitter * bcxtail;
86931           bhi = c2 - (c2 - bcxtail);
86932           blo = bcxtail - bhi;
86933           t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo);
86934           _i = s0 - t02;
86935           bvirt = s0 - _i;
86936           u2[0] = s0 - (_i + bvirt) + (bvirt - t02);
86937           _j = s1 + _i;
86938           bvirt = _j - s1;
86939           _0 = s1 - (_j - bvirt) + (_i - bvirt);
86940           _i = _0 - t12;
86941           bvirt = _0 - _i;
86942           u2[1] = _0 - (_i + bvirt) + (bvirt - t12);
86943           u3 = _j + _i;
86944           bvirt = u3 - _j;
86945           u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
86946           u2[3] = u3;
86947           const Dlen = sum(C2len, C2, 4, u2, D2);
86948           return D2[Dlen - 1];
86949         }
86950         function orient2d(ax, ay, bx, by, cx, cy) {
86951           const detleft = (ay - cy) * (bx - cx);
86952           const detright = (ax - cx) * (by - cy);
86953           const det = detleft - detright;
86954           const detsum = Math.abs(detleft + detright);
86955           if (Math.abs(det) >= ccwerrboundA * detsum) return det;
86956           return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
86957         }
86958         const crossProduct2 = (a2, b2) => a2.x * b2.y - a2.y * b2.x;
86959         const dotProduct2 = (a2, b2) => a2.x * b2.x + a2.y * b2.y;
86960         const compareVectorAngles = (basePt, endPt1, endPt2) => {
86961           const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
86962           if (res > 0) return -1;
86963           if (res < 0) return 1;
86964           return 0;
86965         };
86966         const length2 = (v2) => Math.sqrt(dotProduct2(v2, v2));
86967         const sineOfAngle2 = (pShared, pBase, pAngle) => {
86968           const vBase = {
86969             x: pBase.x - pShared.x,
86970             y: pBase.y - pShared.y
86971           };
86972           const vAngle = {
86973             x: pAngle.x - pShared.x,
86974             y: pAngle.y - pShared.y
86975           };
86976           return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
86977         };
86978         const cosineOfAngle2 = (pShared, pBase, pAngle) => {
86979           const vBase = {
86980             x: pBase.x - pShared.x,
86981             y: pBase.y - pShared.y
86982           };
86983           const vAngle = {
86984             x: pAngle.x - pShared.x,
86985             y: pAngle.y - pShared.y
86986           };
86987           return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
86988         };
86989         const horizontalIntersection2 = (pt2, v2, y2) => {
86990           if (v2.y === 0) return null;
86991           return {
86992             x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
86993             y: y2
86994           };
86995         };
86996         const verticalIntersection2 = (pt2, v2, x2) => {
86997           if (v2.x === 0) return null;
86998           return {
86999             x: x2,
87000             y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
87001           };
87002         };
87003         const intersection$1 = (pt1, v1, pt2, v2) => {
87004           if (v1.x === 0) return verticalIntersection2(pt2, v2, pt1.x);
87005           if (v2.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
87006           if (v1.y === 0) return horizontalIntersection2(pt2, v2, pt1.y);
87007           if (v2.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
87008           const kross = crossProduct2(v1, v2);
87009           if (kross == 0) return null;
87010           const ve2 = {
87011             x: pt2.x - pt1.x,
87012             y: pt2.y - pt1.y
87013           };
87014           const d1 = crossProduct2(ve2, v1) / kross;
87015           const d2 = crossProduct2(ve2, v2) / kross;
87016           const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
87017           const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
87018           const x3 = (x12 + x2) / 2;
87019           const y3 = (y12 + y2) / 2;
87020           return {
87021             x: x3,
87022             y: y3
87023           };
87024         };
87025         class SweepEvent2 {
87026           // for ordering sweep events in the sweep event queue
87027           static compare(a2, b2) {
87028             const ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
87029             if (ptCmp !== 0) return ptCmp;
87030             if (a2.point !== b2.point) a2.link(b2);
87031             if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
87032             return Segment2.compare(a2.segment, b2.segment);
87033           }
87034           // for ordering points in sweep line order
87035           static comparePoints(aPt, bPt) {
87036             if (aPt.x < bPt.x) return -1;
87037             if (aPt.x > bPt.x) return 1;
87038             if (aPt.y < bPt.y) return -1;
87039             if (aPt.y > bPt.y) return 1;
87040             return 0;
87041           }
87042           // Warning: 'point' input will be modified and re-used (for performance)
87043           constructor(point, isLeft) {
87044             if (point.events === void 0) point.events = [this];
87045             else point.events.push(this);
87046             this.point = point;
87047             this.isLeft = isLeft;
87048           }
87049           link(other2) {
87050             if (other2.point === this.point) {
87051               throw new Error("Tried to link already linked events");
87052             }
87053             const otherEvents = other2.point.events;
87054             for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
87055               const evt = otherEvents[i3];
87056               this.point.events.push(evt);
87057               evt.point = this.point;
87058             }
87059             this.checkForConsuming();
87060           }
87061           /* Do a pass over our linked events and check to see if any pair
87062            * of segments match, and should be consumed. */
87063           checkForConsuming() {
87064             const numEvents = this.point.events.length;
87065             for (let i3 = 0; i3 < numEvents; i3++) {
87066               const evt1 = this.point.events[i3];
87067               if (evt1.segment.consumedBy !== void 0) continue;
87068               for (let j2 = i3 + 1; j2 < numEvents; j2++) {
87069                 const evt2 = this.point.events[j2];
87070                 if (evt2.consumedBy !== void 0) continue;
87071                 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
87072                 evt1.segment.consume(evt2.segment);
87073               }
87074             }
87075           }
87076           getAvailableLinkedEvents() {
87077             const events = [];
87078             for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
87079               const evt = this.point.events[i3];
87080               if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
87081                 events.push(evt);
87082               }
87083             }
87084             return events;
87085           }
87086           /**
87087            * Returns a comparator function for sorting linked events that will
87088            * favor the event that will give us the smallest left-side angle.
87089            * All ring construction starts as low as possible heading to the right,
87090            * so by always turning left as sharp as possible we'll get polygons
87091            * without uncessary loops & holes.
87092            *
87093            * The comparator function has a compute cache such that it avoids
87094            * re-computing already-computed values.
87095            */
87096           getLeftmostComparator(baseEvent) {
87097             const cache = /* @__PURE__ */ new Map();
87098             const fillCache = (linkedEvent) => {
87099               const nextEvent = linkedEvent.otherSE;
87100               cache.set(linkedEvent, {
87101                 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
87102                 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
87103               });
87104             };
87105             return (a2, b2) => {
87106               if (!cache.has(a2)) fillCache(a2);
87107               if (!cache.has(b2)) fillCache(b2);
87108               const {
87109                 sine: asine,
87110                 cosine: acosine
87111               } = cache.get(a2);
87112               const {
87113                 sine: bsine,
87114                 cosine: bcosine
87115               } = cache.get(b2);
87116               if (asine >= 0 && bsine >= 0) {
87117                 if (acosine < bcosine) return 1;
87118                 if (acosine > bcosine) return -1;
87119                 return 0;
87120               }
87121               if (asine < 0 && bsine < 0) {
87122                 if (acosine < bcosine) return -1;
87123                 if (acosine > bcosine) return 1;
87124                 return 0;
87125               }
87126               if (bsine < asine) return -1;
87127               if (bsine > asine) return 1;
87128               return 0;
87129             };
87130           }
87131         }
87132         let segmentId2 = 0;
87133         class Segment2 {
87134           /* This compare() function is for ordering segments in the sweep
87135            * line tree, and does so according to the following criteria:
87136            *
87137            * Consider the vertical line that lies an infinestimal step to the
87138            * right of the right-more of the two left endpoints of the input
87139            * segments. Imagine slowly moving a point up from negative infinity
87140            * in the increasing y direction. Which of the two segments will that
87141            * point intersect first? That segment comes 'before' the other one.
87142            *
87143            * If neither segment would be intersected by such a line, (if one
87144            * or more of the segments are vertical) then the line to be considered
87145            * is directly on the right-more of the two left inputs.
87146            */
87147           static compare(a2, b2) {
87148             const alx = a2.leftSE.point.x;
87149             const blx = b2.leftSE.point.x;
87150             const arx = a2.rightSE.point.x;
87151             const brx = b2.rightSE.point.x;
87152             if (brx < alx) return 1;
87153             if (arx < blx) return -1;
87154             const aly = a2.leftSE.point.y;
87155             const bly = b2.leftSE.point.y;
87156             const ary = a2.rightSE.point.y;
87157             const bry = b2.rightSE.point.y;
87158             if (alx < blx) {
87159               if (bly < aly && bly < ary) return 1;
87160               if (bly > aly && bly > ary) return -1;
87161               const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
87162               if (aCmpBLeft < 0) return 1;
87163               if (aCmpBLeft > 0) return -1;
87164               const bCmpARight = b2.comparePoint(a2.rightSE.point);
87165               if (bCmpARight !== 0) return bCmpARight;
87166               return -1;
87167             }
87168             if (alx > blx) {
87169               if (aly < bly && aly < bry) return -1;
87170               if (aly > bly && aly > bry) return 1;
87171               const bCmpALeft = b2.comparePoint(a2.leftSE.point);
87172               if (bCmpALeft !== 0) return bCmpALeft;
87173               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
87174               if (aCmpBRight < 0) return 1;
87175               if (aCmpBRight > 0) return -1;
87176               return 1;
87177             }
87178             if (aly < bly) return -1;
87179             if (aly > bly) return 1;
87180             if (arx < brx) {
87181               const bCmpARight = b2.comparePoint(a2.rightSE.point);
87182               if (bCmpARight !== 0) return bCmpARight;
87183             }
87184             if (arx > brx) {
87185               const aCmpBRight = a2.comparePoint(b2.rightSE.point);
87186               if (aCmpBRight < 0) return 1;
87187               if (aCmpBRight > 0) return -1;
87188             }
87189             if (arx !== brx) {
87190               const ay = ary - aly;
87191               const ax = arx - alx;
87192               const by = bry - bly;
87193               const bx = brx - blx;
87194               if (ay > ax && by < bx) return 1;
87195               if (ay < ax && by > bx) return -1;
87196             }
87197             if (arx > brx) return 1;
87198             if (arx < brx) return -1;
87199             if (ary < bry) return -1;
87200             if (ary > bry) return 1;
87201             if (a2.id < b2.id) return -1;
87202             if (a2.id > b2.id) return 1;
87203             return 0;
87204           }
87205           /* Warning: a reference to ringWindings input will be stored,
87206            *  and possibly will be later modified */
87207           constructor(leftSE, rightSE, rings, windings) {
87208             this.id = ++segmentId2;
87209             this.leftSE = leftSE;
87210             leftSE.segment = this;
87211             leftSE.otherSE = rightSE;
87212             this.rightSE = rightSE;
87213             rightSE.segment = this;
87214             rightSE.otherSE = leftSE;
87215             this.rings = rings;
87216             this.windings = windings;
87217           }
87218           static fromRing(pt1, pt2, ring) {
87219             let leftPt, rightPt, winding;
87220             const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
87221             if (cmpPts < 0) {
87222               leftPt = pt1;
87223               rightPt = pt2;
87224               winding = 1;
87225             } else if (cmpPts > 0) {
87226               leftPt = pt2;
87227               rightPt = pt1;
87228               winding = -1;
87229             } else throw new Error(`Tried to create degenerate segment at [${pt1.x}, ${pt1.y}]`);
87230             const leftSE = new SweepEvent2(leftPt, true);
87231             const rightSE = new SweepEvent2(rightPt, false);
87232             return new Segment2(leftSE, rightSE, [ring], [winding]);
87233           }
87234           /* When a segment is split, the rightSE is replaced with a new sweep event */
87235           replaceRightSE(newRightSE) {
87236             this.rightSE = newRightSE;
87237             this.rightSE.segment = this;
87238             this.rightSE.otherSE = this.leftSE;
87239             this.leftSE.otherSE = this.rightSE;
87240           }
87241           bbox() {
87242             const y12 = this.leftSE.point.y;
87243             const y2 = this.rightSE.point.y;
87244             return {
87245               ll: {
87246                 x: this.leftSE.point.x,
87247                 y: y12 < y2 ? y12 : y2
87248               },
87249               ur: {
87250                 x: this.rightSE.point.x,
87251                 y: y12 > y2 ? y12 : y2
87252               }
87253             };
87254           }
87255           /* A vector from the left point to the right */
87256           vector() {
87257             return {
87258               x: this.rightSE.point.x - this.leftSE.point.x,
87259               y: this.rightSE.point.y - this.leftSE.point.y
87260             };
87261           }
87262           isAnEndpoint(pt2) {
87263             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;
87264           }
87265           /* Compare this segment with a point.
87266            *
87267            * A point P is considered to be colinear to a segment if there
87268            * exists a distance D such that if we travel along the segment
87269            * from one * endpoint towards the other a distance D, we find
87270            * ourselves at point P.
87271            *
87272            * Return value indicates:
87273            *
87274            *   1: point lies above the segment (to the left of vertical)
87275            *   0: point is colinear to segment
87276            *  -1: point lies below the segment (to the right of vertical)
87277            */
87278           comparePoint(point) {
87279             if (this.isAnEndpoint(point)) return 0;
87280             const lPt = this.leftSE.point;
87281             const rPt = this.rightSE.point;
87282             const v2 = this.vector();
87283             if (lPt.x === rPt.x) {
87284               if (point.x === lPt.x) return 0;
87285               return point.x < lPt.x ? 1 : -1;
87286             }
87287             const yDist = (point.y - lPt.y) / v2.y;
87288             const xFromYDist = lPt.x + yDist * v2.x;
87289             if (point.x === xFromYDist) return 0;
87290             const xDist = (point.x - lPt.x) / v2.x;
87291             const yFromXDist = lPt.y + xDist * v2.y;
87292             if (point.y === yFromXDist) return 0;
87293             return point.y < yFromXDist ? -1 : 1;
87294           }
87295           /**
87296            * Given another segment, returns the first non-trivial intersection
87297            * between the two segments (in terms of sweep line ordering), if it exists.
87298            *
87299            * A 'non-trivial' intersection is one that will cause one or both of the
87300            * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
87301            *
87302            *   * endpoint of segA with endpoint of segB --> trivial
87303            *   * endpoint of segA with point along segB --> non-trivial
87304            *   * endpoint of segB with point along segA --> non-trivial
87305            *   * point along segA with point along segB --> non-trivial
87306            *
87307            * If no non-trivial intersection exists, return null
87308            * Else, return null.
87309            */
87310           getIntersection(other2) {
87311             const tBbox = this.bbox();
87312             const oBbox = other2.bbox();
87313             const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
87314             if (bboxOverlap === null) return null;
87315             const tlp = this.leftSE.point;
87316             const trp = this.rightSE.point;
87317             const olp = other2.leftSE.point;
87318             const orp = other2.rightSE.point;
87319             const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
87320             const touchesThisLSE = isInBbox2(oBbox, tlp) && other2.comparePoint(tlp) === 0;
87321             const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
87322             const touchesThisRSE = isInBbox2(oBbox, trp) && other2.comparePoint(trp) === 0;
87323             if (touchesThisLSE && touchesOtherLSE) {
87324               if (touchesThisRSE && !touchesOtherRSE) return trp;
87325               if (!touchesThisRSE && touchesOtherRSE) return orp;
87326               return null;
87327             }
87328             if (touchesThisLSE) {
87329               if (touchesOtherRSE) {
87330                 if (tlp.x === orp.x && tlp.y === orp.y) return null;
87331               }
87332               return tlp;
87333             }
87334             if (touchesOtherLSE) {
87335               if (touchesThisRSE) {
87336                 if (trp.x === olp.x && trp.y === olp.y) return null;
87337               }
87338               return olp;
87339             }
87340             if (touchesThisRSE && touchesOtherRSE) return null;
87341             if (touchesThisRSE) return trp;
87342             if (touchesOtherRSE) return orp;
87343             const pt2 = intersection$1(tlp, this.vector(), olp, other2.vector());
87344             if (pt2 === null) return null;
87345             if (!isInBbox2(bboxOverlap, pt2)) return null;
87346             return rounder.round(pt2.x, pt2.y);
87347           }
87348           /**
87349            * Split the given segment into multiple segments on the given points.
87350            *  * Each existing segment will retain its leftSE and a new rightSE will be
87351            *    generated for it.
87352            *  * A new segment will be generated which will adopt the original segment's
87353            *    rightSE, and a new leftSE will be generated for it.
87354            *  * If there are more than two points given to split on, new segments
87355            *    in the middle will be generated with new leftSE and rightSE's.
87356            *  * An array of the newly generated SweepEvents will be returned.
87357            *
87358            * Warning: input array of points is modified
87359            */
87360           split(point) {
87361             const newEvents = [];
87362             const alreadyLinked = point.events !== void 0;
87363             const newLeftSE = new SweepEvent2(point, true);
87364             const newRightSE = new SweepEvent2(point, false);
87365             const oldRightSE = this.rightSE;
87366             this.replaceRightSE(newRightSE);
87367             newEvents.push(newRightSE);
87368             newEvents.push(newLeftSE);
87369             const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
87370             if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
87371               newSeg.swapEvents();
87372             }
87373             if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
87374               this.swapEvents();
87375             }
87376             if (alreadyLinked) {
87377               newLeftSE.checkForConsuming();
87378               newRightSE.checkForConsuming();
87379             }
87380             return newEvents;
87381           }
87382           /* Swap which event is left and right */
87383           swapEvents() {
87384             const tmpEvt = this.rightSE;
87385             this.rightSE = this.leftSE;
87386             this.leftSE = tmpEvt;
87387             this.leftSE.isLeft = true;
87388             this.rightSE.isLeft = false;
87389             for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
87390               this.windings[i3] *= -1;
87391             }
87392           }
87393           /* Consume another segment. We take their rings under our wing
87394            * and mark them as consumed. Use for perfectly overlapping segments */
87395           consume(other2) {
87396             let consumer = this;
87397             let consumee = other2;
87398             while (consumer.consumedBy) consumer = consumer.consumedBy;
87399             while (consumee.consumedBy) consumee = consumee.consumedBy;
87400             const cmp2 = Segment2.compare(consumer, consumee);
87401             if (cmp2 === 0) return;
87402             if (cmp2 > 0) {
87403               const tmp = consumer;
87404               consumer = consumee;
87405               consumee = tmp;
87406             }
87407             if (consumer.prev === consumee) {
87408               const tmp = consumer;
87409               consumer = consumee;
87410               consumee = tmp;
87411             }
87412             for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
87413               const ring = consumee.rings[i3];
87414               const winding = consumee.windings[i3];
87415               const index2 = consumer.rings.indexOf(ring);
87416               if (index2 === -1) {
87417                 consumer.rings.push(ring);
87418                 consumer.windings.push(winding);
87419               } else consumer.windings[index2] += winding;
87420             }
87421             consumee.rings = null;
87422             consumee.windings = null;
87423             consumee.consumedBy = consumer;
87424             consumee.leftSE.consumedBy = consumer.leftSE;
87425             consumee.rightSE.consumedBy = consumer.rightSE;
87426           }
87427           /* The first segment previous segment chain that is in the result */
87428           prevInResult() {
87429             if (this._prevInResult !== void 0) return this._prevInResult;
87430             if (!this.prev) this._prevInResult = null;
87431             else if (this.prev.isInResult()) this._prevInResult = this.prev;
87432             else this._prevInResult = this.prev.prevInResult();
87433             return this._prevInResult;
87434           }
87435           beforeState() {
87436             if (this._beforeState !== void 0) return this._beforeState;
87437             if (!this.prev) this._beforeState = {
87438               rings: [],
87439               windings: [],
87440               multiPolys: []
87441             };
87442             else {
87443               const seg = this.prev.consumedBy || this.prev;
87444               this._beforeState = seg.afterState();
87445             }
87446             return this._beforeState;
87447           }
87448           afterState() {
87449             if (this._afterState !== void 0) return this._afterState;
87450             const beforeState = this.beforeState();
87451             this._afterState = {
87452               rings: beforeState.rings.slice(0),
87453               windings: beforeState.windings.slice(0),
87454               multiPolys: []
87455             };
87456             const ringsAfter = this._afterState.rings;
87457             const windingsAfter = this._afterState.windings;
87458             const mpsAfter = this._afterState.multiPolys;
87459             for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
87460               const ring = this.rings[i3];
87461               const winding = this.windings[i3];
87462               const index2 = ringsAfter.indexOf(ring);
87463               if (index2 === -1) {
87464                 ringsAfter.push(ring);
87465                 windingsAfter.push(winding);
87466               } else windingsAfter[index2] += winding;
87467             }
87468             const polysAfter = [];
87469             const polysExclude = [];
87470             for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
87471               if (windingsAfter[i3] === 0) continue;
87472               const ring = ringsAfter[i3];
87473               const poly = ring.poly;
87474               if (polysExclude.indexOf(poly) !== -1) continue;
87475               if (ring.isExterior) polysAfter.push(poly);
87476               else {
87477                 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
87478                 const index2 = polysAfter.indexOf(ring.poly);
87479                 if (index2 !== -1) polysAfter.splice(index2, 1);
87480               }
87481             }
87482             for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
87483               const mp = polysAfter[i3].multiPoly;
87484               if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
87485             }
87486             return this._afterState;
87487           }
87488           /* Is this segment part of the final result? */
87489           isInResult() {
87490             if (this.consumedBy) return false;
87491             if (this._isInResult !== void 0) return this._isInResult;
87492             const mpsBefore = this.beforeState().multiPolys;
87493             const mpsAfter = this.afterState().multiPolys;
87494             switch (operation2.type) {
87495               case "union": {
87496                 const noBefores = mpsBefore.length === 0;
87497                 const noAfters = mpsAfter.length === 0;
87498                 this._isInResult = noBefores !== noAfters;
87499                 break;
87500               }
87501               case "intersection": {
87502                 let least;
87503                 let most;
87504                 if (mpsBefore.length < mpsAfter.length) {
87505                   least = mpsBefore.length;
87506                   most = mpsAfter.length;
87507                 } else {
87508                   least = mpsAfter.length;
87509                   most = mpsBefore.length;
87510                 }
87511                 this._isInResult = most === operation2.numMultiPolys && least < most;
87512                 break;
87513               }
87514               case "xor": {
87515                 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
87516                 this._isInResult = diff % 2 === 1;
87517                 break;
87518               }
87519               case "difference": {
87520                 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
87521                 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
87522                 break;
87523               }
87524               default:
87525                 throw new Error(`Unrecognized operation type found ${operation2.type}`);
87526             }
87527             return this._isInResult;
87528           }
87529         }
87530         class RingIn2 {
87531           constructor(geomRing, poly, isExterior) {
87532             if (!Array.isArray(geomRing) || geomRing.length === 0) {
87533               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87534             }
87535             this.poly = poly;
87536             this.isExterior = isExterior;
87537             this.segments = [];
87538             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
87539               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87540             }
87541             const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
87542             this.bbox = {
87543               ll: {
87544                 x: firstPoint.x,
87545                 y: firstPoint.y
87546               },
87547               ur: {
87548                 x: firstPoint.x,
87549                 y: firstPoint.y
87550               }
87551             };
87552             let prevPoint = firstPoint;
87553             for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
87554               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
87555                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87556               }
87557               let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
87558               if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
87559               this.segments.push(Segment2.fromRing(prevPoint, point, this));
87560               if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
87561               if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
87562               if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
87563               if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
87564               prevPoint = point;
87565             }
87566             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
87567               this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
87568             }
87569           }
87570           getSweepEvents() {
87571             const sweepEvents = [];
87572             for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
87573               const segment = this.segments[i3];
87574               sweepEvents.push(segment.leftSE);
87575               sweepEvents.push(segment.rightSE);
87576             }
87577             return sweepEvents;
87578           }
87579         }
87580         class PolyIn2 {
87581           constructor(geomPoly, multiPoly) {
87582             if (!Array.isArray(geomPoly)) {
87583               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87584             }
87585             this.exteriorRing = new RingIn2(geomPoly[0], this, true);
87586             this.bbox = {
87587               ll: {
87588                 x: this.exteriorRing.bbox.ll.x,
87589                 y: this.exteriorRing.bbox.ll.y
87590               },
87591               ur: {
87592                 x: this.exteriorRing.bbox.ur.x,
87593                 y: this.exteriorRing.bbox.ur.y
87594               }
87595             };
87596             this.interiorRings = [];
87597             for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
87598               const ring = new RingIn2(geomPoly[i3], this, false);
87599               if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
87600               if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
87601               if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
87602               if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
87603               this.interiorRings.push(ring);
87604             }
87605             this.multiPoly = multiPoly;
87606           }
87607           getSweepEvents() {
87608             const sweepEvents = this.exteriorRing.getSweepEvents();
87609             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
87610               const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
87611               for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
87612                 sweepEvents.push(ringSweepEvents[j2]);
87613               }
87614             }
87615             return sweepEvents;
87616           }
87617         }
87618         class MultiPolyIn2 {
87619           constructor(geom, isSubject) {
87620             if (!Array.isArray(geom)) {
87621               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
87622             }
87623             try {
87624               if (typeof geom[0][0][0] === "number") geom = [geom];
87625             } catch (ex) {
87626             }
87627             this.polys = [];
87628             this.bbox = {
87629               ll: {
87630                 x: Number.POSITIVE_INFINITY,
87631                 y: Number.POSITIVE_INFINITY
87632               },
87633               ur: {
87634                 x: Number.NEGATIVE_INFINITY,
87635                 y: Number.NEGATIVE_INFINITY
87636               }
87637             };
87638             for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
87639               const poly = new PolyIn2(geom[i3], this);
87640               if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
87641               if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
87642               if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
87643               if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
87644               this.polys.push(poly);
87645             }
87646             this.isSubject = isSubject;
87647           }
87648           getSweepEvents() {
87649             const sweepEvents = [];
87650             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
87651               const polySweepEvents = this.polys[i3].getSweepEvents();
87652               for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
87653                 sweepEvents.push(polySweepEvents[j2]);
87654               }
87655             }
87656             return sweepEvents;
87657           }
87658         }
87659         class RingOut2 {
87660           /* Given the segments from the sweep line pass, compute & return a series
87661            * of closed rings from all the segments marked to be part of the result */
87662           static factory(allSegments) {
87663             const ringsOut = [];
87664             for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
87665               const segment = allSegments[i3];
87666               if (!segment.isInResult() || segment.ringOut) continue;
87667               let prevEvent = null;
87668               let event = segment.leftSE;
87669               let nextEvent = segment.rightSE;
87670               const events = [event];
87671               const startingPoint = event.point;
87672               const intersectionLEs = [];
87673               while (true) {
87674                 prevEvent = event;
87675                 event = nextEvent;
87676                 events.push(event);
87677                 if (event.point === startingPoint) break;
87678                 while (true) {
87679                   const availableLEs = event.getAvailableLinkedEvents();
87680                   if (availableLEs.length === 0) {
87681                     const firstPt = events[0].point;
87682                     const lastPt = events[events.length - 1].point;
87683                     throw new Error(`Unable to complete output ring starting at [${firstPt.x}, ${firstPt.y}]. Last matching segment found ends at [${lastPt.x}, ${lastPt.y}].`);
87684                   }
87685                   if (availableLEs.length === 1) {
87686                     nextEvent = availableLEs[0].otherSE;
87687                     break;
87688                   }
87689                   let indexLE = null;
87690                   for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
87691                     if (intersectionLEs[j2].point === event.point) {
87692                       indexLE = j2;
87693                       break;
87694                     }
87695                   }
87696                   if (indexLE !== null) {
87697                     const intersectionLE = intersectionLEs.splice(indexLE)[0];
87698                     const ringEvents = events.splice(intersectionLE.index);
87699                     ringEvents.unshift(ringEvents[0].otherSE);
87700                     ringsOut.push(new RingOut2(ringEvents.reverse()));
87701                     continue;
87702                   }
87703                   intersectionLEs.push({
87704                     index: events.length,
87705                     point: event.point
87706                   });
87707                   const comparator = event.getLeftmostComparator(prevEvent);
87708                   nextEvent = availableLEs.sort(comparator)[0].otherSE;
87709                   break;
87710                 }
87711               }
87712               ringsOut.push(new RingOut2(events));
87713             }
87714             return ringsOut;
87715           }
87716           constructor(events) {
87717             this.events = events;
87718             for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
87719               events[i3].segment.ringOut = this;
87720             }
87721             this.poly = null;
87722           }
87723           getGeom() {
87724             let prevPt = this.events[0].point;
87725             const points = [prevPt];
87726             for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
87727               const pt3 = this.events[i3].point;
87728               const nextPt2 = this.events[i3 + 1].point;
87729               if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
87730               points.push(pt3);
87731               prevPt = pt3;
87732             }
87733             if (points.length === 1) return null;
87734             const pt2 = points[0];
87735             const nextPt = points[1];
87736             if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
87737             points.push(points[0]);
87738             const step = this.isExteriorRing() ? 1 : -1;
87739             const iStart = this.isExteriorRing() ? 0 : points.length - 1;
87740             const iEnd = this.isExteriorRing() ? points.length : -1;
87741             const orderedPoints = [];
87742             for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
87743             return orderedPoints;
87744           }
87745           isExteriorRing() {
87746             if (this._isExteriorRing === void 0) {
87747               const enclosing = this.enclosingRing();
87748               this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
87749             }
87750             return this._isExteriorRing;
87751           }
87752           enclosingRing() {
87753             if (this._enclosingRing === void 0) {
87754               this._enclosingRing = this._calcEnclosingRing();
87755             }
87756             return this._enclosingRing;
87757           }
87758           /* Returns the ring that encloses this one, if any */
87759           _calcEnclosingRing() {
87760             let leftMostEvt = this.events[0];
87761             for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
87762               const evt = this.events[i3];
87763               if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
87764             }
87765             let prevSeg = leftMostEvt.segment.prevInResult();
87766             let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
87767             while (true) {
87768               if (!prevSeg) return null;
87769               if (!prevPrevSeg) return prevSeg.ringOut;
87770               if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
87771                 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
87772                   return prevSeg.ringOut;
87773                 } else return prevSeg.ringOut.enclosingRing();
87774               }
87775               prevSeg = prevPrevSeg.prevInResult();
87776               prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
87777             }
87778           }
87779         }
87780         class PolyOut2 {
87781           constructor(exteriorRing) {
87782             this.exteriorRing = exteriorRing;
87783             exteriorRing.poly = this;
87784             this.interiorRings = [];
87785           }
87786           addInterior(ring) {
87787             this.interiorRings.push(ring);
87788             ring.poly = this;
87789           }
87790           getGeom() {
87791             const geom = [this.exteriorRing.getGeom()];
87792             if (geom[0] === null) return null;
87793             for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
87794               const ringGeom = this.interiorRings[i3].getGeom();
87795               if (ringGeom === null) continue;
87796               geom.push(ringGeom);
87797             }
87798             return geom;
87799           }
87800         }
87801         class MultiPolyOut2 {
87802           constructor(rings) {
87803             this.rings = rings;
87804             this.polys = this._composePolys(rings);
87805           }
87806           getGeom() {
87807             const geom = [];
87808             for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
87809               const polyGeom = this.polys[i3].getGeom();
87810               if (polyGeom === null) continue;
87811               geom.push(polyGeom);
87812             }
87813             return geom;
87814           }
87815           _composePolys(rings) {
87816             const polys = [];
87817             for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
87818               const ring = rings[i3];
87819               if (ring.poly) continue;
87820               if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
87821               else {
87822                 const enclosingRing = ring.enclosingRing();
87823                 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
87824                 enclosingRing.poly.addInterior(ring);
87825               }
87826             }
87827             return polys;
87828           }
87829         }
87830         class SweepLine2 {
87831           constructor(queue) {
87832             let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
87833             this.queue = queue;
87834             this.tree = new Tree(comparator);
87835             this.segments = [];
87836           }
87837           process(event) {
87838             const segment = event.segment;
87839             const newEvents = [];
87840             if (event.consumedBy) {
87841               if (event.isLeft) this.queue.remove(event.otherSE);
87842               else this.tree.remove(segment);
87843               return newEvents;
87844             }
87845             const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
87846             if (!node) throw new Error(`Unable to find segment #${segment.id} [${segment.leftSE.point.x}, ${segment.leftSE.point.y}] -> [${segment.rightSE.point.x}, ${segment.rightSE.point.y}] in SweepLine tree.`);
87847             let prevNode = node;
87848             let nextNode = node;
87849             let prevSeg = void 0;
87850             let nextSeg = void 0;
87851             while (prevSeg === void 0) {
87852               prevNode = this.tree.prev(prevNode);
87853               if (prevNode === null) prevSeg = null;
87854               else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
87855             }
87856             while (nextSeg === void 0) {
87857               nextNode = this.tree.next(nextNode);
87858               if (nextNode === null) nextSeg = null;
87859               else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
87860             }
87861             if (event.isLeft) {
87862               let prevMySplitter = null;
87863               if (prevSeg) {
87864                 const prevInter = prevSeg.getIntersection(segment);
87865                 if (prevInter !== null) {
87866                   if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
87867                   if (!prevSeg.isAnEndpoint(prevInter)) {
87868                     const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
87869                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87870                       newEvents.push(newEventsFromSplit[i3]);
87871                     }
87872                   }
87873                 }
87874               }
87875               let nextMySplitter = null;
87876               if (nextSeg) {
87877                 const nextInter = nextSeg.getIntersection(segment);
87878                 if (nextInter !== null) {
87879                   if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
87880                   if (!nextSeg.isAnEndpoint(nextInter)) {
87881                     const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
87882                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87883                       newEvents.push(newEventsFromSplit[i3]);
87884                     }
87885                   }
87886                 }
87887               }
87888               if (prevMySplitter !== null || nextMySplitter !== null) {
87889                 let mySplitter = null;
87890                 if (prevMySplitter === null) mySplitter = nextMySplitter;
87891                 else if (nextMySplitter === null) mySplitter = prevMySplitter;
87892                 else {
87893                   const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
87894                   mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
87895                 }
87896                 this.queue.remove(segment.rightSE);
87897                 newEvents.push(segment.rightSE);
87898                 const newEventsFromSplit = segment.split(mySplitter);
87899                 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87900                   newEvents.push(newEventsFromSplit[i3]);
87901                 }
87902               }
87903               if (newEvents.length > 0) {
87904                 this.tree.remove(segment);
87905                 newEvents.push(event);
87906               } else {
87907                 this.segments.push(segment);
87908                 segment.prev = prevSeg;
87909               }
87910             } else {
87911               if (prevSeg && nextSeg) {
87912                 const inter = prevSeg.getIntersection(nextSeg);
87913                 if (inter !== null) {
87914                   if (!prevSeg.isAnEndpoint(inter)) {
87915                     const newEventsFromSplit = this._splitSafely(prevSeg, inter);
87916                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87917                       newEvents.push(newEventsFromSplit[i3]);
87918                     }
87919                   }
87920                   if (!nextSeg.isAnEndpoint(inter)) {
87921                     const newEventsFromSplit = this._splitSafely(nextSeg, inter);
87922                     for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
87923                       newEvents.push(newEventsFromSplit[i3]);
87924                     }
87925                   }
87926                 }
87927               }
87928               this.tree.remove(segment);
87929             }
87930             return newEvents;
87931           }
87932           /* Safely split a segment that is currently in the datastructures
87933            * IE - a segment other than the one that is currently being processed. */
87934           _splitSafely(seg, pt2) {
87935             this.tree.remove(seg);
87936             const rightSE = seg.rightSE;
87937             this.queue.remove(rightSE);
87938             const newEvents = seg.split(pt2);
87939             newEvents.push(rightSE);
87940             if (seg.consumedBy === void 0) this.tree.add(seg);
87941             return newEvents;
87942           }
87943         }
87944         const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
87945         const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
87946         class Operation2 {
87947           run(type2, geom, moreGeoms) {
87948             operation2.type = type2;
87949             rounder.reset();
87950             const multipolys = [new MultiPolyIn2(geom, true)];
87951             for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
87952               multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
87953             }
87954             operation2.numMultiPolys = multipolys.length;
87955             if (operation2.type === "difference") {
87956               const subject = multipolys[0];
87957               let i3 = 1;
87958               while (i3 < multipolys.length) {
87959                 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
87960                 else multipolys.splice(i3, 1);
87961               }
87962             }
87963             if (operation2.type === "intersection") {
87964               for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
87965                 const mpA = multipolys[i3];
87966                 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
87967                   if (getBboxOverlap2(mpA.bbox, multipolys[j2].bbox) === null) return [];
87968                 }
87969               }
87970             }
87971             const queue = new Tree(SweepEvent2.compare);
87972             for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
87973               const sweepEvents = multipolys[i3].getSweepEvents();
87974               for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
87975                 queue.insert(sweepEvents[j2]);
87976                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
87977                   throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
87978                 }
87979               }
87980             }
87981             const sweepLine = new SweepLine2(queue);
87982             let prevQueueSize = queue.size;
87983             let node = queue.pop();
87984             while (node) {
87985               const evt = node.key;
87986               if (queue.size === prevQueueSize) {
87987                 const seg = evt.segment;
87988                 throw new Error(`Unable to pop() ${evt.isLeft ? "left" : "right"} SweepEvent [${evt.point.x}, ${evt.point.y}] from segment #${seg.id} [${seg.leftSE.point.x}, ${seg.leftSE.point.y}] -> [${seg.rightSE.point.x}, ${seg.rightSE.point.y}] from queue.`);
87989               }
87990               if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
87991                 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
87992               }
87993               if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
87994                 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
87995               }
87996               const newEvents = sweepLine.process(evt);
87997               for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
87998                 const evt2 = newEvents[i3];
87999                 if (evt2.consumedBy === void 0) queue.insert(evt2);
88000               }
88001               prevQueueSize = queue.size;
88002               node = queue.pop();
88003             }
88004             rounder.reset();
88005             const ringsOut = RingOut2.factory(sweepLine.segments);
88006             const result = new MultiPolyOut2(ringsOut);
88007             return result.getGeom();
88008           }
88009         }
88010         const operation2 = new Operation2();
88011         const union2 = function(geom) {
88012           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
88013             moreGeoms[_key - 1] = arguments[_key];
88014           }
88015           return operation2.run("union", geom, moreGeoms);
88016         };
88017         const intersection2 = function(geom) {
88018           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
88019             moreGeoms[_key2 - 1] = arguments[_key2];
88020           }
88021           return operation2.run("intersection", geom, moreGeoms);
88022         };
88023         const xor = function(geom) {
88024           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
88025             moreGeoms[_key3 - 1] = arguments[_key3];
88026           }
88027           return operation2.run("xor", geom, moreGeoms);
88028         };
88029         const difference2 = function(subjectGeom) {
88030           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
88031             clippingGeoms[_key4 - 1] = arguments[_key4];
88032           }
88033           return operation2.run("difference", subjectGeom, clippingGeoms);
88034         };
88035         var index = {
88036           union: union2,
88037           intersection: intersection2,
88038           xor,
88039           difference: difference2
88040         };
88041         return index;
88042       });
88043     }
88044   });
88045
88046   // modules/services/vector_tile.js
88047   var vector_tile_exports = {};
88048   __export(vector_tile_exports, {
88049     default: () => vector_tile_default
88050   });
88051   function abortRequest6(controller) {
88052     controller.abort();
88053   }
88054   function vtToGeoJSON(data, tile, mergeCache) {
88055     var vectorTile = new VectorTile(new Pbf(data));
88056     var layers = Object.keys(vectorTile.layers);
88057     if (!Array.isArray(layers)) {
88058       layers = [layers];
88059     }
88060     var features = [];
88061     layers.forEach(function(layerID) {
88062       var layer = vectorTile.layers[layerID];
88063       if (layer) {
88064         for (var i3 = 0; i3 < layer.length; i3++) {
88065           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88066           var geometry = feature3.geometry;
88067           if (geometry.type === "Polygon") {
88068             geometry.type = "MultiPolygon";
88069             geometry.coordinates = [geometry.coordinates];
88070           }
88071           var isClipped = false;
88072           if (geometry.type === "MultiPolygon") {
88073             var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
88074             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
88075               isClipped = true;
88076             }
88077             if (!feature3.geometry.coordinates.length) continue;
88078             if (!feature3.geometry.coordinates[0].length) continue;
88079           }
88080           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
88081           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
88082           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
88083           feature3.__featurehash__ = featurehash;
88084           feature3.__propertyhash__ = propertyhash;
88085           features.push(feature3);
88086           if (isClipped && geometry.type === "MultiPolygon") {
88087             var merged = mergeCache[propertyhash];
88088             if (merged && merged.length) {
88089               var other2 = merged[0];
88090               var coords = import_polygon_clipping.default.union(
88091                 feature3.geometry.coordinates,
88092                 other2.geometry.coordinates
88093               );
88094               if (!coords || !coords.length) {
88095                 continue;
88096               }
88097               merged.push(feature3);
88098               for (var j2 = 0; j2 < merged.length; j2++) {
88099                 merged[j2].geometry.coordinates = coords;
88100                 merged[j2].__featurehash__ = featurehash;
88101               }
88102             } else {
88103               mergeCache[propertyhash] = [feature3];
88104             }
88105           }
88106         }
88107       }
88108     });
88109     return features;
88110   }
88111   function loadTile3(source, tile) {
88112     if (source.loaded[tile.id] || source.inflight[tile.id]) return;
88113     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) {
88114       var subdomains = r2.split(",");
88115       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
88116     });
88117     var controller = new AbortController();
88118     source.inflight[tile.id] = controller;
88119     fetch(url, { signal: controller.signal }).then(function(response) {
88120       if (!response.ok) {
88121         throw new Error(response.status + " " + response.statusText);
88122       }
88123       source.loaded[tile.id] = [];
88124       delete source.inflight[tile.id];
88125       return response.arrayBuffer();
88126     }).then(function(data) {
88127       if (!data) {
88128         throw new Error("No Data");
88129       }
88130       var z2 = tile.xyz[2];
88131       if (!source.canMerge[z2]) {
88132         source.canMerge[z2] = {};
88133       }
88134       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
88135       dispatch11.call("loadedData");
88136     }).catch(function() {
88137       source.loaded[tile.id] = [];
88138       delete source.inflight[tile.id];
88139     });
88140   }
88141   var import_fast_deep_equal11, import_fast_json_stable_stringify2, import_polygon_clipping, tiler7, dispatch11, _vtCache, vector_tile_default;
88142   var init_vector_tile2 = __esm({
88143     "modules/services/vector_tile.js"() {
88144       "use strict";
88145       init_src4();
88146       import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
88147       init_esm5();
88148       import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
88149       import_polygon_clipping = __toESM(require_polygon_clipping_umd());
88150       init_pbf();
88151       init_vector_tile();
88152       init_util();
88153       tiler7 = utilTiler().tileSize(512).margin(1);
88154       dispatch11 = dispatch_default("loadedData");
88155       vector_tile_default = {
88156         init: function() {
88157           if (!_vtCache) {
88158             this.reset();
88159           }
88160           this.event = utilRebind(this, dispatch11, "on");
88161         },
88162         reset: function() {
88163           for (var sourceID in _vtCache) {
88164             var source = _vtCache[sourceID];
88165             if (source && source.inflight) {
88166               Object.values(source.inflight).forEach(abortRequest6);
88167             }
88168           }
88169           _vtCache = {};
88170         },
88171         addSource: function(sourceID, template) {
88172           _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
88173           return _vtCache[sourceID];
88174         },
88175         data: function(sourceID, projection2) {
88176           var source = _vtCache[sourceID];
88177           if (!source) return [];
88178           var tiles = tiler7.getTiles(projection2);
88179           var seen = {};
88180           var results = [];
88181           for (var i3 = 0; i3 < tiles.length; i3++) {
88182             var features = source.loaded[tiles[i3].id];
88183             if (!features || !features.length) continue;
88184             for (var j2 = 0; j2 < features.length; j2++) {
88185               var feature3 = features[j2];
88186               var hash2 = feature3.__featurehash__;
88187               if (seen[hash2]) continue;
88188               seen[hash2] = true;
88189               results.push(Object.assign({}, feature3));
88190             }
88191           }
88192           return results;
88193         },
88194         loadTiles: function(sourceID, template, projection2) {
88195           var source = _vtCache[sourceID];
88196           if (!source) {
88197             source = this.addSource(sourceID, template);
88198           }
88199           var tiles = tiler7.getTiles(projection2);
88200           Object.keys(source.inflight).forEach(function(k2) {
88201             var wanted = tiles.find(function(tile) {
88202               return k2 === tile.id;
88203             });
88204             if (!wanted) {
88205               abortRequest6(source.inflight[k2]);
88206               delete source.inflight[k2];
88207             }
88208           });
88209           tiles.forEach(function(tile) {
88210             loadTile3(source, tile);
88211           });
88212         },
88213         cache: function() {
88214           return _vtCache;
88215         }
88216       };
88217     }
88218   });
88219
88220   // modules/services/wikidata.js
88221   var wikidata_exports2 = {};
88222   __export(wikidata_exports2, {
88223     default: () => wikidata_default
88224   });
88225   var apibase5, _wikidataCache, wikidata_default;
88226   var init_wikidata2 = __esm({
88227     "modules/services/wikidata.js"() {
88228       "use strict";
88229       init_src18();
88230       init_util();
88231       init_localizer();
88232       apibase5 = "https://www.wikidata.org/w/api.php?";
88233       _wikidataCache = {};
88234       wikidata_default = {
88235         init: function() {
88236         },
88237         reset: function() {
88238           _wikidataCache = {};
88239         },
88240         // Search for Wikidata items matching the query
88241         itemsForSearchQuery: function(query, callback, language) {
88242           if (!query) {
88243             if (callback) callback("No query", {});
88244             return;
88245           }
88246           var lang = this.languagesToQuery()[0];
88247           var url = apibase5 + utilQsString({
88248             action: "wbsearchentities",
88249             format: "json",
88250             formatversion: 2,
88251             search: query,
88252             type: "item",
88253             // the language to search
88254             language: language || lang,
88255             // the language for the label and description in the result
88256             uselang: lang,
88257             limit: 10,
88258             origin: "*"
88259           });
88260           json_default(url).then((result) => {
88261             if (result && result.error) {
88262               if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
88263                 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
88264                 return;
88265               } else {
88266                 throw new Error(result.error);
88267               }
88268             }
88269             if (callback) callback(null, result.search || {});
88270           }).catch(function(err) {
88271             if (callback) callback(err.message, {});
88272           });
88273         },
88274         // Given a Wikipedia language and article title,
88275         // return an array of corresponding Wikidata entities.
88276         itemsByTitle: function(lang, title, callback) {
88277           if (!title) {
88278             if (callback) callback("No title", {});
88279             return;
88280           }
88281           lang = lang || "en";
88282           var url = apibase5 + utilQsString({
88283             action: "wbgetentities",
88284             format: "json",
88285             formatversion: 2,
88286             sites: lang.replace(/-/g, "_") + "wiki",
88287             titles: title,
88288             languages: "en",
88289             // shrink response by filtering to one language
88290             origin: "*"
88291           });
88292           json_default(url).then(function(result) {
88293             if (result && result.error) {
88294               throw new Error(result.error);
88295             }
88296             if (callback) callback(null, result.entities || {});
88297           }).catch(function(err) {
88298             if (callback) callback(err.message, {});
88299           });
88300         },
88301         languagesToQuery: function() {
88302           return _mainLocalizer.localeCodes().map(function(code) {
88303             return code.toLowerCase();
88304           }).filter(function(code) {
88305             return code !== "en-us";
88306           });
88307         },
88308         entityByQID: function(qid, callback) {
88309           if (!qid) {
88310             callback("No qid", {});
88311             return;
88312           }
88313           if (_wikidataCache[qid]) {
88314             if (callback) callback(null, _wikidataCache[qid]);
88315             return;
88316           }
88317           var langs = this.languagesToQuery();
88318           var url = apibase5 + utilQsString({
88319             action: "wbgetentities",
88320             format: "json",
88321             formatversion: 2,
88322             ids: qid,
88323             props: "labels|descriptions|claims|sitelinks",
88324             sitefilter: langs.map(function(d2) {
88325               return d2 + "wiki";
88326             }).join("|"),
88327             languages: langs.join("|"),
88328             languagefallback: 1,
88329             origin: "*"
88330           });
88331           json_default(url).then(function(result) {
88332             if (result && result.error) {
88333               throw new Error(result.error);
88334             }
88335             if (callback) callback(null, result.entities[qid] || {});
88336           }).catch(function(err) {
88337             if (callback) callback(err.message, {});
88338           });
88339         },
88340         // Pass `params` object of the form:
88341         // {
88342         //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
88343         // }
88344         //
88345         // Get an result object used to display tag documentation
88346         // {
88347         //   title:        'string',
88348         //   description:  'string',
88349         //   editURL:      'string',
88350         //   imageURL:     'string',
88351         //   wiki:         { title: 'string', text: 'string', url: 'string' }
88352         // }
88353         //
88354         getDocs: function(params, callback) {
88355           var langs = this.languagesToQuery();
88356           this.entityByQID(params.qid, function(err, entity) {
88357             if (err || !entity) {
88358               callback(err || "No entity");
88359               return;
88360             }
88361             var i3;
88362             var description;
88363             for (i3 in langs) {
88364               let code = langs[i3];
88365               if (entity.descriptions[code] && entity.descriptions[code].language === code) {
88366                 description = entity.descriptions[code];
88367                 break;
88368               }
88369             }
88370             if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
88371             var result = {
88372               title: entity.id,
88373               description: (selection2) => selection2.text(description ? description.value : ""),
88374               descriptionLocaleCode: description ? description.language : "",
88375               editURL: "https://www.wikidata.org/wiki/" + entity.id
88376             };
88377             if (entity.claims) {
88378               var imageroot = "https://commons.wikimedia.org/w/index.php";
88379               var props = ["P154", "P18"];
88380               var prop, image;
88381               for (i3 = 0; i3 < props.length; i3++) {
88382                 prop = entity.claims[props[i3]];
88383                 if (prop && Object.keys(prop).length > 0) {
88384                   image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
88385                   if (image) {
88386                     result.imageURL = imageroot + "?" + utilQsString({
88387                       title: "Special:Redirect/file/" + image,
88388                       width: 400
88389                     });
88390                     break;
88391                   }
88392                 }
88393               }
88394             }
88395             if (entity.sitelinks) {
88396               var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
88397               for (i3 = 0; i3 < langs.length; i3++) {
88398                 var w2 = langs[i3] + "wiki";
88399                 if (entity.sitelinks[w2]) {
88400                   var title = entity.sitelinks[w2].title;
88401                   var tKey = "inspector.wiki_reference";
88402                   if (!englishLocale && langs[i3] === "en") {
88403                     tKey = "inspector.wiki_en_reference";
88404                   }
88405                   result.wiki = {
88406                     title,
88407                     text: tKey,
88408                     url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
88409                   };
88410                   break;
88411                 }
88412               }
88413             }
88414             callback(null, result);
88415           });
88416         }
88417       };
88418     }
88419   });
88420
88421   // modules/services/wikipedia.js
88422   var wikipedia_exports2 = {};
88423   __export(wikipedia_exports2, {
88424     default: () => wikipedia_default
88425   });
88426   var endpoint, wikipedia_default;
88427   var init_wikipedia2 = __esm({
88428     "modules/services/wikipedia.js"() {
88429       "use strict";
88430       init_src18();
88431       init_util();
88432       endpoint = "https://en.wikipedia.org/w/api.php?";
88433       wikipedia_default = {
88434         init: function() {
88435         },
88436         reset: function() {
88437         },
88438         search: function(lang, query, callback) {
88439           if (!query) {
88440             if (callback) callback("No Query", []);
88441             return;
88442           }
88443           lang = lang || "en";
88444           var url = endpoint.replace("en", lang) + utilQsString({
88445             action: "query",
88446             list: "search",
88447             srlimit: "10",
88448             srinfo: "suggestion",
88449             format: "json",
88450             origin: "*",
88451             srsearch: query
88452           });
88453           json_default(url).then(function(result) {
88454             if (result && result.error) {
88455               throw new Error(result.error);
88456             } else if (!result || !result.query || !result.query.search) {
88457               throw new Error("No Results");
88458             }
88459             if (callback) {
88460               var titles = result.query.search.map(function(d2) {
88461                 return d2.title;
88462               });
88463               callback(null, titles);
88464             }
88465           }).catch(function(err) {
88466             if (callback) callback(err, []);
88467           });
88468         },
88469         suggestions: function(lang, query, callback) {
88470           if (!query) {
88471             if (callback) callback("", []);
88472             return;
88473           }
88474           lang = lang || "en";
88475           var url = endpoint.replace("en", lang) + utilQsString({
88476             action: "opensearch",
88477             namespace: 0,
88478             suggest: "",
88479             format: "json",
88480             origin: "*",
88481             search: query
88482           });
88483           json_default(url).then(function(result) {
88484             if (result && result.error) {
88485               throw new Error(result.error);
88486             } else if (!result || result.length < 2) {
88487               throw new Error("No Results");
88488             }
88489             if (callback) callback(null, result[1] || []);
88490           }).catch(function(err) {
88491             if (callback) callback(err.message, []);
88492           });
88493         },
88494         translations: function(lang, title, callback) {
88495           if (!title) {
88496             if (callback) callback("No Title");
88497             return;
88498           }
88499           var url = endpoint.replace("en", lang) + utilQsString({
88500             action: "query",
88501             prop: "langlinks",
88502             format: "json",
88503             origin: "*",
88504             lllimit: 500,
88505             titles: title
88506           });
88507           json_default(url).then(function(result) {
88508             if (result && result.error) {
88509               throw new Error(result.error);
88510             } else if (!result || !result.query || !result.query.pages) {
88511               throw new Error("No Results");
88512             }
88513             if (callback) {
88514               var list2 = result.query.pages[Object.keys(result.query.pages)[0]];
88515               var translations = {};
88516               if (list2 && list2.langlinks) {
88517                 list2.langlinks.forEach(function(d2) {
88518                   translations[d2.lang] = d2["*"];
88519                 });
88520               }
88521               callback(null, translations);
88522             }
88523           }).catch(function(err) {
88524             if (callback) callback(err.message);
88525           });
88526         }
88527       };
88528     }
88529   });
88530
88531   // modules/services/mapilio.js
88532   var mapilio_exports = {};
88533   __export(mapilio_exports, {
88534     default: () => mapilio_default
88535   });
88536   function partitionViewport5(projection2) {
88537     const z2 = geoScaleToZoom(projection2.scale());
88538     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
88539     const tiler8 = utilTiler().zoomExtent([z22, z22]);
88540     return tiler8.getTiles(projection2).map(function(tile) {
88541       return tile.extent;
88542     });
88543   }
88544   function searchLimited5(limit, projection2, rtree) {
88545     limit = limit || 5;
88546     return partitionViewport5(projection2).reduce(function(result, extent) {
88547       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
88548         return d2.data;
88549       });
88550       return found.length ? result.concat(found) : result;
88551     }, []);
88552   }
88553   function loadTiles4(which, url, maxZoom2, projection2) {
88554     const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
88555     const tiles = tiler8.getTiles(projection2);
88556     tiles.forEach(function(tile) {
88557       loadTile4(which, url, tile);
88558     });
88559   }
88560   function loadTile4(which, url, tile) {
88561     const cache = _cache3.requests;
88562     const tileId = `${tile.id}-${which}`;
88563     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
88564     const controller = new AbortController();
88565     cache.inflight[tileId] = controller;
88566     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
88567     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
88568       if (!response.ok) {
88569         throw new Error(response.status + " " + response.statusText);
88570       }
88571       cache.loaded[tileId] = true;
88572       delete cache.inflight[tileId];
88573       return response.arrayBuffer();
88574     }).then(function(data) {
88575       if (data.byteLength === 0) {
88576         throw new Error("No Data");
88577       }
88578       loadTileDataToCache2(data, tile, which);
88579       if (which === "images") {
88580         dispatch12.call("loadedImages");
88581       } else {
88582         dispatch12.call("loadedLines");
88583       }
88584     }).catch(function(e3) {
88585       if (e3.message === "No Data") {
88586         cache.loaded[tileId] = true;
88587       } else {
88588         console.error(e3);
88589       }
88590     });
88591   }
88592   function loadTileDataToCache2(data, tile) {
88593     const vectorTile = new VectorTile(new Pbf(data));
88594     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
88595       const features = [];
88596       const cache = _cache3.images;
88597       const layer = vectorTile.layers[pointLayer];
88598       for (let i3 = 0; i3 < layer.length; i3++) {
88599         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88600         const loc = feature3.geometry.coordinates;
88601         let resolutionArr = feature3.properties.resolution.split("x");
88602         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
88603         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
88604         let isPano = sourceWidth % sourceHeight === 0;
88605         const d2 = {
88606           service: "photo",
88607           loc,
88608           capture_time: feature3.properties.capture_time,
88609           id: feature3.properties.id,
88610           sequence_id: feature3.properties.sequence_uuid,
88611           heading: feature3.properties.heading,
88612           resolution: feature3.properties.resolution,
88613           isPano
88614         };
88615         cache.forImageId[d2.id] = d2;
88616         features.push({
88617           minX: loc[0],
88618           minY: loc[1],
88619           maxX: loc[0],
88620           maxY: loc[1],
88621           data: d2
88622         });
88623       }
88624       if (cache.rtree) {
88625         cache.rtree.load(features);
88626       }
88627     }
88628     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
88629       const cache = _cache3.sequences;
88630       const layer = vectorTile.layers[lineLayer];
88631       for (let i3 = 0; i3 < layer.length; i3++) {
88632         const feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
88633         if (cache.lineString[feature3.properties.sequence_uuid]) {
88634           const cacheEntry = cache.lineString[feature3.properties.sequence_uuid];
88635           if (cacheEntry.some((f2) => {
88636             const cachedCoords = f2.geometry.coordinates;
88637             const featureCoords = feature3.geometry.coordinates;
88638             return (0, import_lodash5.isEqual)(cachedCoords, featureCoords);
88639           })) continue;
88640           cacheEntry.push(feature3);
88641         } else {
88642           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
88643         }
88644       }
88645     }
88646   }
88647   function getImageData(imageId, sequenceId) {
88648     return fetch(apiUrl2 + `/api/sequence-detail?sequence_uuid=${sequenceId}`, { method: "GET" }).then(function(response) {
88649       if (!response.ok) {
88650         throw new Error(response.status + " " + response.statusText);
88651       }
88652       return response.json();
88653     }).then(function(data) {
88654       let index = data.data.findIndex((feature3) => feature3.id === imageId);
88655       const { filename, uploaded_hash } = data.data[index];
88656       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
88657     });
88658   }
88659   var import_lodash5, apiUrl2, imageBaseUrl, baseTileUrl2, pointLayer, lineLayer, tileStyle, minZoom3, dispatch12, imgZoom2, pannellumViewerCSS3, pannellumViewerJS3, resolution, _activeImage, _cache3, _loadViewerPromise5, _pannellumViewer3, _sceneOptions2, _currScene2, mapilio_default;
88660   var init_mapilio = __esm({
88661     "modules/services/mapilio.js"() {
88662       "use strict";
88663       init_src4();
88664       init_src5();
88665       init_src12();
88666       init_pbf();
88667       init_rbush();
88668       init_vector_tile();
88669       import_lodash5 = __toESM(require_lodash());
88670       init_util();
88671       init_geo2();
88672       init_localizer();
88673       init_services();
88674       apiUrl2 = "https://end.mapilio.com";
88675       imageBaseUrl = "https://cdn.mapilio.com/im";
88676       baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
88677       pointLayer = "map_points";
88678       lineLayer = "map_roads_line";
88679       tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
88680       minZoom3 = 14;
88681       dispatch12 = dispatch_default("loadedImages", "loadedLines");
88682       imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
88683       pannellumViewerCSS3 = "pannellum/pannellum.css";
88684       pannellumViewerJS3 = "pannellum/pannellum.js";
88685       resolution = 1080;
88686       _sceneOptions2 = {
88687         showFullscreenCtrl: false,
88688         autoLoad: true,
88689         yaw: 0,
88690         minHfov: 10,
88691         maxHfov: 90,
88692         hfov: 60
88693       };
88694       _currScene2 = 0;
88695       mapilio_default = {
88696         // Initialize Mapilio
88697         init: function() {
88698           if (!_cache3) {
88699             this.reset();
88700           }
88701           this.event = utilRebind(this, dispatch12, "on");
88702         },
88703         // Reset cache and state
88704         reset: function() {
88705           if (_cache3) {
88706             Object.values(_cache3.requests.inflight).forEach(function(request3) {
88707               request3.abort();
88708             });
88709           }
88710           _cache3 = {
88711             images: { rtree: new RBush(), forImageId: {} },
88712             sequences: { rtree: new RBush(), lineString: {} },
88713             requests: { loaded: {}, inflight: {} }
88714           };
88715         },
88716         // Get visible images
88717         images: function(projection2) {
88718           const limit = 5;
88719           return searchLimited5(limit, projection2, _cache3.images.rtree);
88720         },
88721         cachedImage: function(imageKey) {
88722           return _cache3.images.forImageId[imageKey];
88723         },
88724         // Load images in the visible area
88725         loadImages: function(projection2) {
88726           let url = baseTileUrl2 + pointLayer + tileStyle;
88727           loadTiles4("images", url, 14, projection2);
88728         },
88729         // Load line in the visible area
88730         loadLines: function(projection2) {
88731           let url = baseTileUrl2 + lineLayer + tileStyle;
88732           loadTiles4("line", url, 14, projection2);
88733         },
88734         // Get visible sequences
88735         sequences: function(projection2) {
88736           const viewport = projection2.clipExtent();
88737           const min3 = [viewport[0][0], viewport[1][1]];
88738           const max3 = [viewport[1][0], viewport[0][1]];
88739           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
88740           const sequenceIds = {};
88741           let lineStrings = [];
88742           _cache3.images.rtree.search(bbox2).forEach(function(d2) {
88743             if (d2.data.sequence_id) {
88744               sequenceIds[d2.data.sequence_id] = true;
88745             }
88746           });
88747           Object.keys(sequenceIds).forEach(function(sequenceId) {
88748             if (_cache3.sequences.lineString[sequenceId]) {
88749               lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
88750             }
88751           });
88752           return lineStrings;
88753         },
88754         // Set the currently visible image
88755         setActiveImage: function(image) {
88756           if (image) {
88757             _activeImage = {
88758               id: image.id,
88759               sequence_id: image.sequence_id
88760             };
88761           } else {
88762             _activeImage = null;
88763           }
88764         },
88765         // Update the currently highlighted sequence and selected bubble.
88766         setStyles: function(context, hovered) {
88767           const hoveredImageId = hovered && hovered.id;
88768           const hoveredSequenceId = hovered && hovered.sequence_id;
88769           const selectedSequenceId = _activeImage && _activeImage.sequence_id;
88770           const selectedImageId = _activeImage && _activeImage.id;
88771           const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
88772           const sequences = context.container().selectAll(".layer-mapilio .sequence");
88773           markers.classed("highlighted", function(d2) {
88774             return d2.id === hoveredImageId;
88775           }).classed("hovered", function(d2) {
88776             return d2.id === hoveredImageId;
88777           }).classed("currentView", function(d2) {
88778             return d2.id === selectedImageId;
88779           });
88780           sequences.classed("highlighted", function(d2) {
88781             return d2.properties.sequence_uuid === hoveredSequenceId;
88782           }).classed("currentView", function(d2) {
88783             return d2.properties.sequence_uuid === selectedSequenceId;
88784           });
88785           return this;
88786         },
88787         updateUrlImage: function(imageKey) {
88788           const hash2 = utilStringQs(window.location.hash);
88789           if (imageKey) {
88790             hash2.photo = "mapilio/" + imageKey;
88791           } else {
88792             delete hash2.photo;
88793           }
88794           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
88795         },
88796         initViewer: function() {
88797           if (!window.pannellum) return;
88798           if (_pannellumViewer3) return;
88799           _currScene2 += 1;
88800           const sceneID = _currScene2.toString();
88801           const options2 = {
88802             "default": { firstScene: sceneID },
88803             scenes: {}
88804           };
88805           options2.scenes[sceneID] = _sceneOptions2;
88806           _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
88807         },
88808         selectImage: function(context, id2) {
88809           let that = this;
88810           let d2 = this.cachedImage(id2);
88811           this.setActiveImage(d2);
88812           this.updateUrlImage(d2.id);
88813           let viewer = context.container().select(".photoviewer");
88814           if (!viewer.empty()) viewer.datum(d2);
88815           this.setStyles(context, null);
88816           if (!d2) return this;
88817           let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
88818           let attribution = wrap2.selectAll(".photo-attribution").text("");
88819           if (d2.capture_time) {
88820             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
88821             attribution.append("span").text("|");
88822           }
88823           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", `https://mapilio.com/app?lat=${d2.loc[1]}&lng=${d2.loc[0]}&zoom=17&pId=${d2.id}`).text("mapilio.com");
88824           wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
88825           wrap2.selectAll("img").remove();
88826           wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
88827           wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
88828           getImageData(d2.id, d2.sequence_id).then(function() {
88829             if (d2.isPano) {
88830               if (!_pannellumViewer3) {
88831                 that.initViewer();
88832               } else {
88833                 _currScene2 += 1;
88834                 let sceneID = _currScene2.toString();
88835                 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
88836                 if (_currScene2 > 2) {
88837                   sceneID = (_currScene2 - 1).toString();
88838                   _pannellumViewer3.removeScene(sceneID);
88839                 }
88840               }
88841             } else {
88842               that.initOnlyPhoto(context);
88843             }
88844           });
88845           function localeDateString2(s2) {
88846             if (!s2) return null;
88847             var options2 = { day: "numeric", month: "short", year: "numeric" };
88848             var d4 = new Date(s2);
88849             if (isNaN(d4.getTime())) return null;
88850             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
88851           }
88852           return this;
88853         },
88854         initOnlyPhoto: function(context) {
88855           if (_pannellumViewer3) {
88856             _pannellumViewer3.destroy();
88857             _pannellumViewer3 = null;
88858           }
88859           let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
88860           let imgWrap = wrap2.select("img");
88861           if (!imgWrap.empty()) {
88862             imgWrap.attr("src", _sceneOptions2.panorama);
88863           } else {
88864             wrap2.append("img").attr("src", _sceneOptions2.panorama);
88865           }
88866         },
88867         ensureViewerLoaded: function(context) {
88868           let that = this;
88869           let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
88870           if (!imgWrap.empty()) {
88871             imgWrap.remove();
88872           }
88873           if (_loadViewerPromise5) return _loadViewerPromise5;
88874           let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
88875           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
88876           wrapEnter.append("div").attr("class", "photo-attribution fillD");
88877           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
88878           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
88879           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
88880           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
88881           wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom2.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
88882           context.ui().photoviewer.on("resize.mapilio", () => {
88883             if (_pannellumViewer3) {
88884               _pannellumViewer3.resize();
88885             }
88886           });
88887           _loadViewerPromise5 = new Promise((resolve, reject) => {
88888             let loadedCount = 0;
88889             function loaded() {
88890               loadedCount += 1;
88891               if (loadedCount === 2) resolve();
88892             }
88893             const head = select_default2("head");
88894             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() {
88895               reject();
88896             });
88897             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() {
88898               reject();
88899             });
88900           }).catch(function() {
88901             _loadViewerPromise5 = null;
88902           });
88903           function step(stepBy) {
88904             return function() {
88905               if (!_activeImage) return;
88906               const imageId = _activeImage.id;
88907               const nextIndex = imageId + stepBy;
88908               if (!nextIndex) return;
88909               const nextImage = _cache3.images.forImageId[nextIndex];
88910               context.map().centerEase(nextImage.loc);
88911               that.selectImage(context, nextImage.id);
88912             };
88913           }
88914           function zoomPan2(d3_event) {
88915             var t2 = d3_event.transform;
88916             context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
88917           }
88918           return _loadViewerPromise5;
88919         },
88920         showViewer: function(context) {
88921           const wrap2 = context.container().select(".photoviewer");
88922           const isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
88923           if (isHidden) {
88924             for (const service of Object.values(services)) {
88925               if (service === this) continue;
88926               if (typeof service.hideViewer === "function") {
88927                 service.hideViewer(context);
88928               }
88929             }
88930             wrap2.classed("hide", false).selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
88931           }
88932           return this;
88933         },
88934         /**
88935          * hideViewer()
88936          */
88937         hideViewer: function(context) {
88938           let viewer = context.container().select(".photoviewer");
88939           if (!viewer.empty()) viewer.datum(null);
88940           this.updateUrlImage(null);
88941           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
88942           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
88943           this.setActiveImage();
88944           return this.setStyles(context, null);
88945         },
88946         // Return the current cache
88947         cache: function() {
88948           return _cache3;
88949         }
88950       };
88951     }
88952   });
88953
88954   // modules/services/panoramax.js
88955   var panoramax_exports = {};
88956   __export(panoramax_exports, {
88957     default: () => panoramax_default
88958   });
88959   function partitionViewport6(projection2) {
88960     const z2 = geoScaleToZoom(projection2.scale());
88961     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
88962     const tiler8 = utilTiler().zoomExtent([z22, z22]);
88963     return tiler8.getTiles(projection2).map(function(tile) {
88964       return tile.extent;
88965     });
88966   }
88967   function searchLimited6(limit, projection2, rtree) {
88968     limit = limit || 5;
88969     return partitionViewport6(projection2).reduce(function(result, extent) {
88970       let found = rtree.search(extent.bbox());
88971       const spacing = Math.max(1, Math.floor(found.length / limit));
88972       found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a2, b2) => {
88973         if (a2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
88974         if (b2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
88975         return 0;
88976       }).slice(0, limit).map((d2) => d2.data);
88977       return found.length ? result.concat(found) : result;
88978     }, []);
88979   }
88980   function loadTiles5(which, url, maxZoom2, projection2, zoom) {
88981     const tiler8 = utilTiler().zoomExtent([minZoom4, maxZoom2]).skipNullIsland(true);
88982     const tiles = tiler8.getTiles(projection2);
88983     tiles.forEach(function(tile) {
88984       loadTile5(which, url, tile, zoom);
88985     });
88986   }
88987   function loadTile5(which, url, tile, zoom) {
88988     const cache = _cache4.requests;
88989     const tileId = `${tile.id}-${which}`;
88990     if (cache.loaded[tileId] || cache.inflight[tileId]) return;
88991     const controller = new AbortController();
88992     cache.inflight[tileId] = controller;
88993     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
88994     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
88995       if (!response.ok) {
88996         throw new Error(response.status + " " + response.statusText);
88997       }
88998       cache.loaded[tileId] = true;
88999       delete cache.inflight[tileId];
89000       return response.arrayBuffer();
89001     }).then(function(data) {
89002       if (data.byteLength === 0) {
89003         throw new Error("No Data");
89004       }
89005       loadTileDataToCache3(data, tile, zoom);
89006       if (which === "images") {
89007         dispatch13.call("loadedImages");
89008       } else {
89009         dispatch13.call("loadedLines");
89010       }
89011     }).catch(function(e3) {
89012       if (e3.message === "No Data") {
89013         cache.loaded[tileId] = true;
89014       } else {
89015         console.error(e3);
89016       }
89017     });
89018   }
89019   function loadTileDataToCache3(data, tile, zoom) {
89020     const vectorTile = new VectorTile(new Pbf(data));
89021     let features, cache, layer, i3, feature3, loc, d2;
89022     if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
89023       features = [];
89024       cache = _cache4.images;
89025       layer = vectorTile.layers[pictureLayer];
89026       for (i3 = 0; i3 < layer.length; i3++) {
89027         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
89028         loc = feature3.geometry.coordinates;
89029         d2 = {
89030           service: "photo",
89031           loc,
89032           capture_time: feature3.properties.ts,
89033           capture_time_parsed: new Date(feature3.properties.ts),
89034           id: feature3.properties.id,
89035           account_id: feature3.properties.account_id,
89036           sequence_id: feature3.properties.sequences.split('"')[1],
89037           heading: parseInt(feature3.properties.heading, 10),
89038           image_path: "",
89039           isPano: feature3.properties.type === "equirectangular",
89040           model: feature3.properties.model
89041         };
89042         cache.forImageId[d2.id] = d2;
89043         features.push({
89044           minX: loc[0],
89045           minY: loc[1],
89046           maxX: loc[0],
89047           maxY: loc[1],
89048           data: d2
89049         });
89050       }
89051       if (cache.rtree) {
89052         cache.rtree.load(features);
89053       }
89054     }
89055     if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
89056       cache = _cache4.sequences;
89057       if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
89058       layer = vectorTile.layers[sequenceLayer];
89059       for (i3 = 0; i3 < layer.length; i3++) {
89060         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
89061         if (cache.lineString[feature3.properties.id]) {
89062           cache.lineString[feature3.properties.id].push(feature3);
89063         } else {
89064           cache.lineString[feature3.properties.id] = [feature3];
89065         }
89066       }
89067     }
89068   }
89069   async function getUsername(user_id) {
89070     const requestUrl = usernameURL.replace("{userId}", user_id);
89071     const response = await fetch(requestUrl, { method: "GET" });
89072     if (!response.ok) {
89073       throw new Error(response.status + " " + response.statusText);
89074     }
89075     const data = await response.json();
89076     return data.name;
89077   }
89078   var apiUrl3, tileUrl2, imageDataUrl, userIdUrl, usernameURL, viewerUrl, highDefinition, standardDefinition, pictureLayer, sequenceLayer, minZoom4, imageMinZoom, lineMinZoom, dispatch13, _cache4, _loadViewerPromise6, _definition, _isHD, _planeFrame2, _pannellumFrame2, _currentFrame2, _currentScene, _activeImage2, _isViewerOpen2, panoramax_default;
89079   var init_panoramax = __esm({
89080     "modules/services/panoramax.js"() {
89081       "use strict";
89082       init_src4();
89083       init_pbf();
89084       init_rbush();
89085       init_vector_tile();
89086       init_util();
89087       init_geo2();
89088       init_localizer();
89089       init_pannellum_photo();
89090       init_plane_photo();
89091       init_services();
89092       apiUrl3 = "https://api.panoramax.xyz/";
89093       tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
89094       imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
89095       userIdUrl = apiUrl3 + "api/users/search?q={username}";
89096       usernameURL = apiUrl3 + "api/users/{userId}";
89097       viewerUrl = apiUrl3;
89098       highDefinition = "hd";
89099       standardDefinition = "sd";
89100       pictureLayer = "pictures";
89101       sequenceLayer = "sequences";
89102       minZoom4 = 10;
89103       imageMinZoom = 15;
89104       lineMinZoom = 10;
89105       dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
89106       _definition = standardDefinition;
89107       _isHD = false;
89108       _currentScene = {
89109         currentImage: null,
89110         nextImage: null,
89111         prevImage: null
89112       };
89113       _isViewerOpen2 = false;
89114       panoramax_default = {
89115         init: function() {
89116           if (!_cache4) {
89117             this.reset();
89118           }
89119           this.event = utilRebind(this, dispatch13, "on");
89120         },
89121         reset: function() {
89122           if (_cache4) {
89123             Object.values(_cache4.requests.inflight).forEach(function(request3) {
89124               request3.abort();
89125             });
89126           }
89127           _cache4 = {
89128             images: { rtree: new RBush(), forImageId: {} },
89129             sequences: { rtree: new RBush(), lineString: {} },
89130             mockSequences: { rtree: new RBush(), lineString: {} },
89131             requests: { loaded: {}, inflight: {} }
89132           };
89133         },
89134         /**
89135          * Get visible images from cache
89136          * @param {*} projection Current Projection
89137          * @returns images data for the current projection
89138          */
89139         images: function(projection2) {
89140           const limit = 5;
89141           return searchLimited6(limit, projection2, _cache4.images.rtree);
89142         },
89143         /**
89144          * Get a specific image from cache
89145          * @param {*} imageKey the image id
89146          * @returns
89147          */
89148         cachedImage: function(imageKey) {
89149           return _cache4.images.forImageId[imageKey];
89150         },
89151         /**
89152          * Fetches images data for the visible area
89153          * @param {*} projection Current Projection
89154          */
89155         loadImages: function(projection2) {
89156           loadTiles5("images", tileUrl2, imageMinZoom, projection2);
89157         },
89158         /**
89159          * Fetches sequences data for the visible area
89160          * @param {*} projection Current Projection
89161          */
89162         loadLines: function(projection2, zoom) {
89163           loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
89164         },
89165         /**
89166          * Fetches all possible userIDs from Panoramax
89167          * @param {string} usernames one or multiple usernames
89168          * @returns userIDs
89169          */
89170         getUserIds: async function(usernames) {
89171           const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
89172           const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
89173           if (responses.some((response) => !response.ok)) {
89174             const response = responses.find((response2) => !response2.ok);
89175             throw new Error(response.status + " " + response.statusText);
89176           }
89177           const data = await Promise.all(responses.map((response) => response.json()));
89178           return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
89179         },
89180         /**
89181          * Get visible sequences from cache
89182          * @param {*} projection Current Projection
89183          * @param {number} zoom Current zoom (if zoom < `lineMinZoom` less accurate lines will be drawn)
89184          * @returns sequences data for the current projection
89185          */
89186         sequences: function(projection2, zoom) {
89187           const viewport = projection2.clipExtent();
89188           const min3 = [viewport[0][0], viewport[1][1]];
89189           const max3 = [viewport[1][0], viewport[0][1]];
89190           const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
89191           const sequenceIds = {};
89192           let lineStrings = [];
89193           if (zoom >= imageMinZoom) {
89194             _cache4.images.rtree.search(bbox2).forEach(function(d2) {
89195               if (d2.data.sequence_id) {
89196                 sequenceIds[d2.data.sequence_id] = true;
89197               }
89198             });
89199             Object.keys(sequenceIds).forEach(function(sequenceId) {
89200               if (_cache4.sequences.lineString[sequenceId]) {
89201                 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
89202               }
89203             });
89204             return lineStrings;
89205           }
89206           if (zoom >= lineMinZoom) {
89207             Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
89208               lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
89209             });
89210           }
89211           return lineStrings;
89212         },
89213         /**
89214          * Updates the data for the currently visible image
89215          * @param {*} image Image data
89216          */
89217         setActiveImage: function(image) {
89218           if (image && image.id && image.sequence_id) {
89219             _activeImage2 = {
89220               id: image.id,
89221               sequence_id: image.sequence_id,
89222               loc: image.loc
89223             };
89224           } else {
89225             _activeImage2 = null;
89226           }
89227         },
89228         getActiveImage: function() {
89229           return _activeImage2;
89230         },
89231         /**
89232          * Update the currently highlighted sequence and selected bubble
89233          * @param {*} context Current HTML context
89234          * @param {*} [hovered] The hovered bubble image
89235          */
89236         setStyles: function(context, hovered) {
89237           const hoveredImageId = hovered && hovered.id;
89238           const hoveredSequenceId = hovered && hovered.sequence_id;
89239           const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
89240           const selectedImageId = _activeImage2 && _activeImage2.id;
89241           const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
89242           const sequences = context.container().selectAll(".layer-panoramax .sequence");
89243           markers.classed("highlighted", function(d2) {
89244             return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
89245           }).classed("hovered", function(d2) {
89246             return d2.id === hoveredImageId;
89247           }).classed("currentView", function(d2) {
89248             return d2.id === selectedImageId;
89249           });
89250           sequences.classed("highlighted", function(d2) {
89251             return d2.properties.id === hoveredSequenceId;
89252           }).classed("currentView", function(d2) {
89253             return d2.properties.id === selectedSequenceId;
89254           });
89255           context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
89256           function viewfieldPath() {
89257             let d2 = this.parentNode.__data__;
89258             if (d2.isPano && d2.id !== selectedImageId) {
89259               return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
89260             } else {
89261               return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
89262             }
89263           }
89264           return this;
89265         },
89266         // Get viewer status
89267         isViewerOpen: function() {
89268           return _isViewerOpen2;
89269         },
89270         /**
89271          * Updates the URL to save the current shown image
89272          * @param {*} imageKey
89273          */
89274         updateUrlImage: function(imageKey) {
89275           const hash2 = utilStringQs(window.location.hash);
89276           if (imageKey) {
89277             hash2.photo = "panoramax/" + imageKey;
89278           } else {
89279             delete hash2.photo;
89280           }
89281           window.history.replaceState(null, "", "#" + utilQsString(hash2, true));
89282         },
89283         /**
89284          * Loads the selected image in the frame
89285          * @param {*} context Current HTML context
89286          * @param {*} id of the selected image
89287          * @returns
89288          */
89289         selectImage: function(context, id2) {
89290           let that = this;
89291           let d2 = that.cachedImage(id2);
89292           that.setActiveImage(d2);
89293           that.updateUrlImage(d2.id);
89294           const viewerLink = `${viewerUrl}#pic=${d2.id}&focus=pic`;
89295           let viewer = context.container().select(".photoviewer");
89296           if (!viewer.empty()) viewer.datum(d2);
89297           this.setStyles(context, null);
89298           if (!d2) return this;
89299           let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
89300           let attribution = wrap2.selectAll(".photo-attribution").text("");
89301           let line1 = attribution.append("div").attr("class", "attribution-row");
89302           const hdDomId = utilUniqueDomId("panoramax-hd");
89303           let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
89304           label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
89305             d3_event.stopPropagation();
89306             _isHD = !_isHD;
89307             _definition = _isHD ? highDefinition : standardDefinition;
89308             that.selectImage(context, d2.id).showViewer(context);
89309           });
89310           label.append("span").call(_t.append("panoramax.hd"));
89311           if (d2.capture_time) {
89312             attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
89313             attribution.append("span").text("|");
89314           }
89315           attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
89316           attribution.append("span").text("|");
89317           attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
89318           this.getImageData(d2.sequence_id, d2.id).then(function(data) {
89319             _currentScene = {
89320               currentImage: null,
89321               nextImage: null,
89322               prevImage: null
89323             };
89324             _currentScene.currentImage = data.assets[_definition];
89325             const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
89326             const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
89327             if (nextIndex !== -1) {
89328               _currentScene.nextImage = data.links[nextIndex];
89329             }
89330             if (prevIndex !== -1) {
89331               _currentScene.prevImage = data.links[prevIndex];
89332             }
89333             d2.image_path = _currentScene.currentImage.href;
89334             wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
89335             wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
89336             _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
89337             _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
89338           });
89339           function localeDateString2(s2) {
89340             if (!s2) return null;
89341             var options2 = { day: "numeric", month: "short", year: "numeric" };
89342             var d4 = new Date(s2);
89343             if (isNaN(d4.getTime())) return null;
89344             return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
89345           }
89346           if (d2.account_id) {
89347             attribution.append("span").text("|");
89348             let line2 = attribution.append("span").attr("class", "attribution-row");
89349             getUsername(d2.account_id).then(function(username) {
89350               line2.append("span").attr("class", "captured_by").text("@" + username);
89351             });
89352           }
89353           return this;
89354         },
89355         photoFrame: function() {
89356           return _currentFrame2;
89357         },
89358         /**
89359          * Fetches the data for a specific image
89360          * @param {*} collection_id
89361          * @param {*} image_id
89362          * @returns The fetched image data
89363          */
89364         getImageData: async function(collection_id, image_id) {
89365           const requestUrl = imageDataUrl.replace("{collectionId}", collection_id).replace("{itemId}", image_id);
89366           const response = await fetch(requestUrl, { method: "GET" });
89367           if (!response.ok) {
89368             throw new Error(response.status + " " + response.statusText);
89369           }
89370           const data = await response.json();
89371           return data;
89372         },
89373         ensureViewerLoaded: function(context) {
89374           let that = this;
89375           let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
89376           if (!imgWrap.empty()) {
89377             imgWrap.remove();
89378           }
89379           if (_loadViewerPromise6) return _loadViewerPromise6;
89380           let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
89381           let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
89382           wrapEnter.append("div").attr("class", "photo-attribution fillD");
89383           const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
89384           controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
89385           controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
89386           _loadViewerPromise6 = Promise.all([
89387             pannellum_photo_default.init(context, wrapEnter),
89388             plane_photo_default.init(context, wrapEnter)
89389           ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
89390             _pannellumFrame2 = pannellumPhotoFrame;
89391             _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
89392             _planeFrame2 = planePhotoFrame;
89393             _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
89394           });
89395           function step(stepBy) {
89396             return function() {
89397               if (!_currentScene.currentImage) return;
89398               let nextId;
89399               if (stepBy === 1) nextId = _currentScene.nextImage.id;
89400               else nextId = _currentScene.prevImage.id;
89401               if (!nextId) return;
89402               const nextImage = _cache4.images.forImageId[nextId];
89403               if (nextImage) {
89404                 context.map().centerEase(nextImage.loc);
89405                 that.selectImage(context, nextImage.id);
89406               }
89407             };
89408           }
89409           return _loadViewerPromise6;
89410         },
89411         /**
89412          * Shows the current viewer if hidden
89413          * @param {*} context
89414          */
89415         showViewer: function(context) {
89416           const wrap2 = context.container().select(".photoviewer");
89417           const isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
89418           if (isHidden) {
89419             for (const service of Object.values(services)) {
89420               if (service === this) continue;
89421               if (typeof service.hideViewer === "function") {
89422                 service.hideViewer(context);
89423               }
89424             }
89425             wrap2.classed("hide", false).selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
89426           }
89427           _isViewerOpen2 = true;
89428           return this;
89429         },
89430         /**
89431          * Hides the current viewer if shown, resets the active image and sequence
89432          * @param {*} context
89433          */
89434         hideViewer: function(context) {
89435           let viewer = context.container().select(".photoviewer");
89436           if (!viewer.empty()) viewer.datum(null);
89437           this.updateUrlImage(null);
89438           viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
89439           context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
89440           this.setActiveImage(null);
89441           _isViewerOpen2 = false;
89442           return this.setStyles(context, null);
89443         },
89444         cache: function() {
89445           return _cache4;
89446         }
89447       };
89448     }
89449   });
89450
89451   // modules/services/index.js
89452   var services_exports = {};
89453   __export(services_exports, {
89454     serviceKartaview: () => kartaview_default,
89455     serviceKeepRight: () => keepRight_default,
89456     serviceMapRules: () => maprules_default,
89457     serviceMapilio: () => mapilio_default,
89458     serviceMapillary: () => mapillary_default,
89459     serviceNominatim: () => nominatim_default,
89460     serviceNsi: () => nsi_default,
89461     serviceOsm: () => osm_default,
89462     serviceOsmWikibase: () => osm_wikibase_default,
89463     serviceOsmose: () => osmose_default,
89464     servicePanoramax: () => panoramax_default,
89465     serviceStreetside: () => streetside_default,
89466     serviceTaginfo: () => taginfo_default,
89467     serviceVectorTile: () => vector_tile_default,
89468     serviceVegbilder: () => vegbilder_default,
89469     serviceWikidata: () => wikidata_default,
89470     serviceWikipedia: () => wikipedia_default,
89471     services: () => services
89472   });
89473   var services;
89474   var init_services = __esm({
89475     "modules/services/index.js"() {
89476       "use strict";
89477       init_keepRight();
89478       init_osmose();
89479       init_mapillary();
89480       init_maprules();
89481       init_nominatim();
89482       init_nsi();
89483       init_kartaview();
89484       init_vegbilder2();
89485       init_osm3();
89486       init_osm_wikibase();
89487       init_streetside2();
89488       init_taginfo();
89489       init_vector_tile2();
89490       init_wikidata2();
89491       init_wikipedia2();
89492       init_mapilio();
89493       init_panoramax();
89494       services = {
89495         geocoder: nominatim_default,
89496         keepRight: keepRight_default,
89497         osmose: osmose_default,
89498         mapillary: mapillary_default,
89499         nsi: nsi_default,
89500         kartaview: kartaview_default,
89501         vegbilder: vegbilder_default,
89502         osm: osm_default,
89503         osmWikibase: osm_wikibase_default,
89504         maprules: maprules_default,
89505         streetside: streetside_default,
89506         taginfo: taginfo_default,
89507         vectorTile: vector_tile_default,
89508         wikidata: wikidata_default,
89509         wikipedia: wikipedia_default,
89510         mapilio: mapilio_default,
89511         panoramax: panoramax_default
89512       };
89513     }
89514   });
89515
89516   // modules/modes/drag_note.js
89517   var drag_note_exports = {};
89518   __export(drag_note_exports, {
89519     modeDragNote: () => modeDragNote
89520   });
89521   function modeDragNote(context) {
89522     var mode = {
89523       id: "drag-note",
89524       button: "browse"
89525     };
89526     var edit2 = behaviorEdit(context);
89527     var _nudgeInterval;
89528     var _lastLoc;
89529     var _note;
89530     function startNudge(d3_event, nudge) {
89531       if (_nudgeInterval) window.clearInterval(_nudgeInterval);
89532       _nudgeInterval = window.setInterval(function() {
89533         context.map().pan(nudge);
89534         doMove(d3_event, nudge);
89535       }, 50);
89536     }
89537     function stopNudge() {
89538       if (_nudgeInterval) {
89539         window.clearInterval(_nudgeInterval);
89540         _nudgeInterval = null;
89541       }
89542     }
89543     function origin(note) {
89544       return context.projection(note.loc);
89545     }
89546     function start2(d3_event, note) {
89547       _note = note;
89548       var osm = services.osm;
89549       if (osm) {
89550         _note = osm.getNote(_note.id);
89551       }
89552       context.surface().selectAll(".note-" + _note.id).classed("active", true);
89553       context.perform(actionNoop());
89554       context.enter(mode);
89555       context.selectedNoteID(_note.id);
89556     }
89557     function move(d3_event, entity, point) {
89558       d3_event.stopPropagation();
89559       _lastLoc = context.projection.invert(point);
89560       doMove(d3_event);
89561       var nudge = geoViewportEdge(point, context.map().dimensions());
89562       if (nudge) {
89563         startNudge(d3_event, nudge);
89564       } else {
89565         stopNudge();
89566       }
89567     }
89568     function doMove(d3_event, nudge) {
89569       nudge = nudge || [0, 0];
89570       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
89571       var currMouse = geoVecSubtract(currPoint, nudge);
89572       var loc = context.projection.invert(currMouse);
89573       _note = _note.move(loc);
89574       var osm = services.osm;
89575       if (osm) {
89576         osm.replaceNote(_note);
89577       }
89578       context.replace(actionNoop());
89579     }
89580     function end() {
89581       context.replace(actionNoop());
89582       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
89583     }
89584     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);
89585     mode.enter = function() {
89586       context.install(edit2);
89587     };
89588     mode.exit = function() {
89589       context.ui().sidebar.hover.cancel();
89590       context.uninstall(edit2);
89591       context.surface().selectAll(".active").classed("active", false);
89592       stopNudge();
89593     };
89594     mode.behavior = drag;
89595     return mode;
89596   }
89597   var init_drag_note = __esm({
89598     "modules/modes/drag_note.js"() {
89599       "use strict";
89600       init_services();
89601       init_noop2();
89602       init_drag2();
89603       init_edit();
89604       init_geo2();
89605       init_select_note();
89606     }
89607   });
89608
89609   // modules/modes/select_data.js
89610   var select_data_exports = {};
89611   __export(select_data_exports, {
89612     modeSelectData: () => modeSelectData
89613   });
89614   function modeSelectData(context, selectedDatum) {
89615     var mode = {
89616       id: "select-data",
89617       button: "browse"
89618     };
89619     var keybinding = utilKeybinding("select-data");
89620     var dataEditor = uiDataEditor(context);
89621     var behaviors = [
89622       behaviorBreathe(context),
89623       behaviorHover(context),
89624       behaviorSelect(context),
89625       behaviorLasso(context),
89626       modeDragNode(context).behavior,
89627       modeDragNote(context).behavior
89628     ];
89629     function selectData(d3_event, drawn) {
89630       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
89631       if (selection2.empty()) {
89632         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
89633         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
89634           context.enter(modeBrowse(context));
89635         }
89636       } else {
89637         selection2.classed("selected", true);
89638       }
89639     }
89640     function esc() {
89641       if (context.container().select(".combobox").size()) return;
89642       context.enter(modeBrowse(context));
89643     }
89644     mode.zoomToSelected = function() {
89645       var extent = geoExtent(bounds_default(selectedDatum));
89646       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
89647     };
89648     mode.enter = function() {
89649       behaviors.forEach(context.install);
89650       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
89651       select_default2(document).call(keybinding);
89652       selectData();
89653       var sidebar = context.ui().sidebar;
89654       sidebar.show(dataEditor.datum(selectedDatum));
89655       var extent = geoExtent(bounds_default(selectedDatum));
89656       sidebar.expand(sidebar.intersects(extent));
89657       context.map().on("drawn.select-data", selectData);
89658     };
89659     mode.exit = function() {
89660       behaviors.forEach(context.uninstall);
89661       select_default2(document).call(keybinding.unbind);
89662       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
89663       context.map().on("drawn.select-data", null);
89664       context.ui().sidebar.hide();
89665     };
89666     return mode;
89667   }
89668   var init_select_data = __esm({
89669     "modules/modes/select_data.js"() {
89670       "use strict";
89671       init_src2();
89672       init_src5();
89673       init_breathe();
89674       init_hover();
89675       init_lasso2();
89676       init_select4();
89677       init_localizer();
89678       init_geo2();
89679       init_browse();
89680       init_drag_node();
89681       init_drag_note();
89682       init_data_editor();
89683       init_util();
89684     }
89685   });
89686
89687   // modules/behavior/select.js
89688   var select_exports = {};
89689   __export(select_exports, {
89690     behaviorSelect: () => behaviorSelect
89691   });
89692   function behaviorSelect(context) {
89693     var _tolerancePx = 4;
89694     var _lastMouseEvent = null;
89695     var _showMenu = false;
89696     var _downPointers = {};
89697     var _longPressTimeout = null;
89698     var _lastInteractionType = null;
89699     var _multiselectionPointerId = null;
89700     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
89701     function keydown(d3_event) {
89702       if (d3_event.keyCode === 32) {
89703         var activeNode = document.activeElement;
89704         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
89705       }
89706       if (d3_event.keyCode === 93 || // context menu key
89707       d3_event.keyCode === 32) {
89708         d3_event.preventDefault();
89709       }
89710       if (d3_event.repeat) return;
89711       cancelLongPress();
89712       if (d3_event.shiftKey) {
89713         context.surface().classed("behavior-multiselect", true);
89714       }
89715       if (d3_event.keyCode === 32) {
89716         if (!_downPointers.spacebar && _lastMouseEvent) {
89717           cancelLongPress();
89718           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
89719           _downPointers.spacebar = {
89720             firstEvent: _lastMouseEvent,
89721             lastEvent: _lastMouseEvent
89722           };
89723         }
89724       }
89725     }
89726     function keyup(d3_event) {
89727       cancelLongPress();
89728       if (!d3_event.shiftKey) {
89729         context.surface().classed("behavior-multiselect", false);
89730       }
89731       if (d3_event.keyCode === 93) {
89732         d3_event.preventDefault();
89733         _lastInteractionType = "menukey";
89734         contextmenu(d3_event);
89735       } else if (d3_event.keyCode === 32) {
89736         var pointer = _downPointers.spacebar;
89737         if (pointer) {
89738           delete _downPointers.spacebar;
89739           if (pointer.done) return;
89740           d3_event.preventDefault();
89741           _lastInteractionType = "spacebar";
89742           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
89743         }
89744       }
89745     }
89746     function pointerdown(d3_event) {
89747       var id2 = (d3_event.pointerId || "mouse").toString();
89748       cancelLongPress();
89749       if (d3_event.buttons && d3_event.buttons !== 1) return;
89750       context.ui().closeEditMenu();
89751       if (d3_event.pointerType !== "mouse") {
89752         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
89753       }
89754       _downPointers[id2] = {
89755         firstEvent: d3_event,
89756         lastEvent: d3_event
89757       };
89758     }
89759     function didLongPress(id2, interactionType) {
89760       var pointer = _downPointers[id2];
89761       if (!pointer) return;
89762       for (var i3 in _downPointers) {
89763         _downPointers[i3].done = true;
89764       }
89765       _longPressTimeout = null;
89766       _lastInteractionType = interactionType;
89767       _showMenu = true;
89768       click(pointer.firstEvent, pointer.lastEvent, id2);
89769     }
89770     function pointermove(d3_event) {
89771       var id2 = (d3_event.pointerId || "mouse").toString();
89772       if (_downPointers[id2]) {
89773         _downPointers[id2].lastEvent = d3_event;
89774       }
89775       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
89776         _lastMouseEvent = d3_event;
89777         if (_downPointers.spacebar) {
89778           _downPointers.spacebar.lastEvent = d3_event;
89779         }
89780       }
89781     }
89782     function pointerup(d3_event) {
89783       var id2 = (d3_event.pointerId || "mouse").toString();
89784       var pointer = _downPointers[id2];
89785       if (!pointer) return;
89786       delete _downPointers[id2];
89787       if (_multiselectionPointerId === id2) {
89788         _multiselectionPointerId = null;
89789       }
89790       if (pointer.done) return;
89791       click(pointer.firstEvent, d3_event, id2);
89792     }
89793     function pointercancel(d3_event) {
89794       var id2 = (d3_event.pointerId || "mouse").toString();
89795       if (!_downPointers[id2]) return;
89796       delete _downPointers[id2];
89797       if (_multiselectionPointerId === id2) {
89798         _multiselectionPointerId = null;
89799       }
89800     }
89801     function contextmenu(d3_event) {
89802       d3_event.preventDefault();
89803       if (!+d3_event.clientX && !+d3_event.clientY) {
89804         if (_lastMouseEvent) {
89805           d3_event = _lastMouseEvent;
89806         } else {
89807           return;
89808         }
89809       } else {
89810         _lastMouseEvent = d3_event;
89811         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
89812         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
89813           _lastInteractionType = "touch";
89814         } else {
89815           _lastInteractionType = "rightclick";
89816         }
89817       }
89818       _showMenu = true;
89819       click(d3_event, d3_event);
89820     }
89821     function click(firstEvent, lastEvent, pointerId) {
89822       cancelLongPress();
89823       var mapNode = context.container().select(".main-map").node();
89824       var pointGetter = utilFastMouse(mapNode);
89825       var p1 = pointGetter(firstEvent);
89826       var p2 = pointGetter(lastEvent);
89827       var dist = geoVecLength(p1, p2);
89828       if (dist > _tolerancePx || !mapContains(lastEvent)) {
89829         resetProperties();
89830         return;
89831       }
89832       var targetDatum = lastEvent.target.__data__;
89833       if (targetDatum === 0 && lastEvent.target.parentNode.__data__) {
89834         targetDatum = lastEvent.target.parentNode.__data__;
89835       }
89836       var multiselectEntityId;
89837       if (!_multiselectionPointerId) {
89838         var selectPointerInfo = pointerDownOnSelection(pointerId);
89839         if (selectPointerInfo) {
89840           _multiselectionPointerId = selectPointerInfo.pointerId;
89841           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
89842           _downPointers[selectPointerInfo.pointerId].done = true;
89843         }
89844       }
89845       var isMultiselect = context.mode().id === "select" && // and shift key is down
89846       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
89847       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
89848       _multiselectionPointerId && !multiselectEntityId);
89849       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
89850       function mapContains(event) {
89851         var rect = mapNode.getBoundingClientRect();
89852         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
89853       }
89854       function pointerDownOnSelection(skipPointerId) {
89855         var mode = context.mode();
89856         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
89857         for (var pointerId2 in _downPointers) {
89858           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
89859           var pointerInfo = _downPointers[pointerId2];
89860           var p12 = pointGetter(pointerInfo.firstEvent);
89861           var p22 = pointGetter(pointerInfo.lastEvent);
89862           if (geoVecLength(p12, p22) > _tolerancePx) continue;
89863           var datum2 = pointerInfo.firstEvent.target.__data__;
89864           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
89865           if (context.graph().hasEntity(entity.id)) {
89866             return {
89867               pointerId: pointerId2,
89868               entityId: entity.id,
89869               selected: selectedIDs.indexOf(entity.id) !== -1
89870             };
89871           }
89872         }
89873         return null;
89874       }
89875     }
89876     function processClick(datum2, isMultiselect, point, alsoSelectId) {
89877       var mode = context.mode();
89878       var showMenu = _showMenu;
89879       var interactionType = _lastInteractionType;
89880       var entity = datum2 && datum2.properties && datum2.properties.entity;
89881       if (entity) datum2 = entity;
89882       if (datum2 && datum2.type === "midpoint") {
89883         datum2 = datum2.parents[0];
89884       }
89885       var newMode;
89886       if (datum2 instanceof osmEntity) {
89887         var selectedIDs = context.selectedIDs();
89888         context.selectedNoteID(null);
89889         context.selectedErrorID(null);
89890         if (!isMultiselect) {
89891           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
89892             if (alsoSelectId === datum2.id) alsoSelectId = null;
89893             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
89894             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
89895             context.enter(newMode);
89896           }
89897         } else {
89898           if (selectedIDs.indexOf(datum2.id) !== -1) {
89899             if (!showMenu) {
89900               selectedIDs = selectedIDs.filter(function(id2) {
89901                 return id2 !== datum2.id;
89902               });
89903               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
89904               context.enter(newMode);
89905             }
89906           } else {
89907             selectedIDs = selectedIDs.concat([datum2.id]);
89908             newMode = mode.selectedIDs(selectedIDs);
89909             context.enter(newMode);
89910           }
89911         }
89912       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
89913         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
89914       } else if (datum2 instanceof osmNote && !isMultiselect) {
89915         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
89916       } else if (datum2 instanceof QAItem && !isMultiselect) {
89917         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
89918       } else if (datum2.service === "photo") {
89919       } else {
89920         context.selectedNoteID(null);
89921         context.selectedErrorID(null);
89922         if (!isMultiselect && mode.id !== "browse") {
89923           context.enter(modeBrowse(context));
89924         }
89925       }
89926       context.ui().closeEditMenu();
89927       if (showMenu) context.ui().showEditMenu(point, interactionType);
89928       resetProperties();
89929     }
89930     function cancelLongPress() {
89931       if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
89932       _longPressTimeout = null;
89933     }
89934     function resetProperties() {
89935       cancelLongPress();
89936       _showMenu = false;
89937       _lastInteractionType = null;
89938     }
89939     function behavior(selection2) {
89940       resetProperties();
89941       _lastMouseEvent = context.map().lastPointerEvent();
89942       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) {
89943         var e3 = d3_event;
89944         if (+e3.clientX === 0 && +e3.clientY === 0) {
89945           d3_event.preventDefault();
89946         }
89947       });
89948       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
89949     }
89950     behavior.off = function(selection2) {
89951       cancelLongPress();
89952       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);
89953       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
89954       context.surface().classed("behavior-multiselect", false);
89955     };
89956     return behavior;
89957   }
89958   var init_select4 = __esm({
89959     "modules/behavior/select.js"() {
89960       "use strict";
89961       init_src5();
89962       init_geo2();
89963       init_browse();
89964       init_select5();
89965       init_select_data();
89966       init_select_note();
89967       init_select_error();
89968       init_osm();
89969       init_util2();
89970     }
89971   });
89972
89973   // modules/operations/continue.js
89974   var continue_exports = {};
89975   __export(continue_exports, {
89976     operationContinue: () => operationContinue
89977   });
89978   function operationContinue(context, selectedIDs) {
89979     var _entities = selectedIDs.map(function(id2) {
89980       return context.graph().entity(id2);
89981     });
89982     var _geometries = Object.assign(
89983       { line: [], vertex: [] },
89984       utilArrayGroupBy(_entities, function(entity) {
89985         return entity.geometry(context.graph());
89986       })
89987     );
89988     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
89989     function candidateWays() {
89990       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
89991         const geom = parent.geometry(context.graph());
89992         return (geom === "line" || geom === "area") && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
89993       }) : [];
89994     }
89995     var _candidates = candidateWays();
89996     var operation2 = function() {
89997       var candidate = _candidates[0];
89998       const tagsToRemove = /* @__PURE__ */ new Set();
89999       if (_vertex.tags.fixme === "continue") tagsToRemove.add("fixme");
90000       if (_vertex.tags.noexit === "yes") tagsToRemove.add("noexit");
90001       if (tagsToRemove.size) {
90002         context.perform((graph) => {
90003           const newTags = { ..._vertex.tags };
90004           for (const key of tagsToRemove) {
90005             delete newTags[key];
90006           }
90007           return actionChangeTags(_vertex.id, newTags)(graph);
90008         }, operation2.annotation());
90009       }
90010       context.enter(
90011         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
90012       );
90013     };
90014     operation2.relatedEntityIds = function() {
90015       return _candidates.length ? [_candidates[0].id] : [];
90016     };
90017     operation2.available = function() {
90018       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
90019     };
90020     operation2.disabled = function() {
90021       if (_candidates.length === 0) {
90022         return "not_eligible";
90023       } else if (_candidates.length > 1) {
90024         return "multiple";
90025       }
90026       return false;
90027     };
90028     operation2.tooltip = function() {
90029       var disable = operation2.disabled();
90030       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
90031     };
90032     operation2.annotation = function() {
90033       return _t("operations.continue.annotation.line");
90034     };
90035     operation2.id = "continue";
90036     operation2.keys = [_t("operations.continue.key")];
90037     operation2.title = _t.append("operations.continue.title");
90038     operation2.behavior = behaviorOperation(context).which(operation2);
90039     return operation2;
90040   }
90041   var init_continue = __esm({
90042     "modules/operations/continue.js"() {
90043       "use strict";
90044       init_localizer();
90045       init_draw_line();
90046       init_operation();
90047       init_util();
90048       init_actions();
90049     }
90050   });
90051
90052   // modules/operations/copy.js
90053   var copy_exports = {};
90054   __export(copy_exports, {
90055     operationCopy: () => operationCopy
90056   });
90057   function operationCopy(context, selectedIDs) {
90058     function getFilteredIdsToCopy() {
90059       return selectedIDs.filter(function(selectedID) {
90060         var entity = context.graph().hasEntity(selectedID);
90061         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
90062       });
90063     }
90064     var operation2 = function() {
90065       var graph = context.graph();
90066       var selected = groupEntities(getFilteredIdsToCopy(), graph);
90067       var canCopy = [];
90068       var skip = {};
90069       var entity;
90070       var i3;
90071       for (i3 = 0; i3 < selected.relation.length; i3++) {
90072         entity = selected.relation[i3];
90073         if (!skip[entity.id] && entity.isComplete(graph)) {
90074           canCopy.push(entity.id);
90075           skip = getDescendants(entity.id, graph, skip);
90076         }
90077       }
90078       for (i3 = 0; i3 < selected.way.length; i3++) {
90079         entity = selected.way[i3];
90080         if (!skip[entity.id]) {
90081           canCopy.push(entity.id);
90082           skip = getDescendants(entity.id, graph, skip);
90083         }
90084       }
90085       for (i3 = 0; i3 < selected.node.length; i3++) {
90086         entity = selected.node[i3];
90087         if (!skip[entity.id]) {
90088           canCopy.push(entity.id);
90089         }
90090       }
90091       context.copyIDs(canCopy);
90092       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
90093         context.copyLonLat(context.projection.invert(_point));
90094       } else {
90095         context.copyLonLat(null);
90096       }
90097     };
90098     function groupEntities(ids, graph) {
90099       var entities = ids.map(function(id2) {
90100         return graph.entity(id2);
90101       });
90102       return Object.assign(
90103         { relation: [], way: [], node: [] },
90104         utilArrayGroupBy(entities, "type")
90105       );
90106     }
90107     function getDescendants(id2, graph, descendants) {
90108       var entity = graph.entity(id2);
90109       var children2;
90110       descendants = descendants || {};
90111       if (entity.type === "relation") {
90112         children2 = entity.members.map(function(m2) {
90113           return m2.id;
90114         });
90115       } else if (entity.type === "way") {
90116         children2 = entity.nodes;
90117       } else {
90118         children2 = [];
90119       }
90120       for (var i3 = 0; i3 < children2.length; i3++) {
90121         if (!descendants[children2[i3]]) {
90122           descendants[children2[i3]] = true;
90123           descendants = getDescendants(children2[i3], graph, descendants);
90124         }
90125       }
90126       return descendants;
90127     }
90128     operation2.available = function() {
90129       return getFilteredIdsToCopy().length > 0;
90130     };
90131     operation2.disabled = function() {
90132       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
90133       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
90134         return "too_large";
90135       }
90136       return false;
90137     };
90138     operation2.availableForKeypress = function() {
90139       var selection2 = window.getSelection && window.getSelection();
90140       return !selection2 || !selection2.toString();
90141     };
90142     operation2.tooltip = function() {
90143       var disable = operation2.disabled();
90144       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
90145     };
90146     operation2.annotation = function() {
90147       return _t("operations.copy.annotation", { n: selectedIDs.length });
90148     };
90149     var _point;
90150     operation2.point = function(val) {
90151       _point = val;
90152       return operation2;
90153     };
90154     operation2.id = "copy";
90155     operation2.keys = [uiCmd("\u2318C")];
90156     operation2.title = _t.append("operations.copy.title");
90157     operation2.behavior = behaviorOperation(context).which(operation2);
90158     return operation2;
90159   }
90160   var init_copy = __esm({
90161     "modules/operations/copy.js"() {
90162       "use strict";
90163       init_localizer();
90164       init_operation();
90165       init_cmd();
90166       init_util();
90167     }
90168   });
90169
90170   // modules/operations/disconnect.js
90171   var disconnect_exports2 = {};
90172   __export(disconnect_exports2, {
90173     operationDisconnect: () => operationDisconnect
90174   });
90175   function operationDisconnect(context, selectedIDs) {
90176     var _vertexIDs = [];
90177     var _wayIDs = [];
90178     var _otherIDs = [];
90179     var _actions = [];
90180     selectedIDs.forEach(function(id2) {
90181       var entity = context.entity(id2);
90182       if (entity.type === "way") {
90183         _wayIDs.push(id2);
90184       } else if (entity.geometry(context.graph()) === "vertex") {
90185         _vertexIDs.push(id2);
90186       } else {
90187         _otherIDs.push(id2);
90188       }
90189     });
90190     var _coords, _descriptionID = "", _annotationID = "features";
90191     var _disconnectingVertexIds = [];
90192     var _disconnectingWayIds = [];
90193     if (_vertexIDs.length > 0) {
90194       _disconnectingVertexIds = _vertexIDs;
90195       _vertexIDs.forEach(function(vertexID) {
90196         var action = actionDisconnect(vertexID);
90197         if (_wayIDs.length > 0) {
90198           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
90199             var way = context.entity(wayID);
90200             return way.nodes.indexOf(vertexID) !== -1;
90201           });
90202           action.limitWays(waysIDsForVertex);
90203         }
90204         _actions.push(action);
90205         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
90206       });
90207       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
90208         return _wayIDs.indexOf(id2) === -1;
90209       });
90210       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
90211       if (_wayIDs.length === 1) {
90212         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
90213       } else {
90214         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
90215       }
90216     } else if (_wayIDs.length > 0) {
90217       var ways = _wayIDs.map(function(id2) {
90218         return context.entity(id2);
90219       });
90220       var nodes = utilGetAllNodes(_wayIDs, context.graph());
90221       _coords = nodes.map(function(n3) {
90222         return n3.loc;
90223       });
90224       var sharedActions = [];
90225       var sharedNodes = [];
90226       var unsharedActions = [];
90227       var unsharedNodes = [];
90228       nodes.forEach(function(node) {
90229         var action = actionDisconnect(node.id).limitWays(_wayIDs);
90230         if (action.disabled(context.graph()) !== "not_connected") {
90231           var count = 0;
90232           for (var i3 in ways) {
90233             var way = ways[i3];
90234             if (way.nodes.indexOf(node.id) !== -1) {
90235               count += 1;
90236             }
90237             if (count > 1) break;
90238           }
90239           if (count > 1) {
90240             sharedActions.push(action);
90241             sharedNodes.push(node);
90242           } else {
90243             unsharedActions.push(action);
90244             unsharedNodes.push(node);
90245           }
90246         }
90247       });
90248       _descriptionID += "no_points.";
90249       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
90250       if (sharedActions.length) {
90251         _actions = sharedActions;
90252         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
90253         _descriptionID += "conjoined";
90254         _annotationID = "from_each_other";
90255       } else {
90256         _actions = unsharedActions;
90257         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
90258         if (_wayIDs.length === 1) {
90259           _descriptionID += context.graph().geometry(_wayIDs[0]);
90260         } else {
90261           _descriptionID += "separate";
90262         }
90263       }
90264     }
90265     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
90266     var operation2 = function() {
90267       context.perform(function(graph) {
90268         return _actions.reduce(function(graph2, action) {
90269           return action(graph2);
90270         }, graph);
90271       }, operation2.annotation());
90272       context.validator().validate();
90273     };
90274     operation2.relatedEntityIds = function() {
90275       if (_vertexIDs.length) {
90276         return _disconnectingWayIds;
90277       }
90278       return _disconnectingVertexIds;
90279     };
90280     operation2.available = function() {
90281       if (_actions.length === 0) return false;
90282       if (_otherIDs.length !== 0) return false;
90283       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
90284         return _vertexIDs.some(function(vertexID) {
90285           var way = context.entity(wayID);
90286           return way.nodes.indexOf(vertexID) !== -1;
90287         });
90288       })) return false;
90289       return true;
90290     };
90291     operation2.disabled = function() {
90292       var reason;
90293       for (var actionIndex in _actions) {
90294         reason = _actions[actionIndex].disabled(context.graph());
90295         if (reason) return reason;
90296       }
90297       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
90298         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
90299       } else if (_coords && someMissing()) {
90300         return "not_downloaded";
90301       } else if (selectedIDs.some(context.hasHiddenConnections)) {
90302         return "connected_to_hidden";
90303       }
90304       return false;
90305       function someMissing() {
90306         if (context.inIntro()) return false;
90307         var osm = context.connection();
90308         if (osm) {
90309           var missing = _coords.filter(function(loc) {
90310             return !osm.isDataLoaded(loc);
90311           });
90312           if (missing.length) {
90313             missing.forEach(function(loc) {
90314               context.loadTileAtLoc(loc);
90315             });
90316             return true;
90317           }
90318         }
90319         return false;
90320       }
90321     };
90322     operation2.tooltip = function() {
90323       var disable = operation2.disabled();
90324       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
90325     };
90326     operation2.annotation = function() {
90327       return _t("operations.disconnect.annotation." + _annotationID);
90328     };
90329     operation2.id = "disconnect";
90330     operation2.keys = [_t("operations.disconnect.key")];
90331     operation2.title = _t.append("operations.disconnect.title");
90332     operation2.behavior = behaviorOperation(context).which(operation2);
90333     return operation2;
90334   }
90335   var init_disconnect2 = __esm({
90336     "modules/operations/disconnect.js"() {
90337       "use strict";
90338       init_localizer();
90339       init_disconnect();
90340       init_operation();
90341       init_array3();
90342       init_util2();
90343     }
90344   });
90345
90346   // modules/operations/downgrade.js
90347   var downgrade_exports = {};
90348   __export(downgrade_exports, {
90349     operationDowngrade: () => operationDowngrade
90350   });
90351   function operationDowngrade(context, selectedIDs) {
90352     var _affectedFeatureCount = 0;
90353     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
90354     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
90355     function downgradeTypeForEntityIDs(entityIds) {
90356       var downgradeType;
90357       _affectedFeatureCount = 0;
90358       for (var i3 in entityIds) {
90359         var entityID = entityIds[i3];
90360         var type2 = downgradeTypeForEntityID(entityID);
90361         if (type2) {
90362           _affectedFeatureCount += 1;
90363           if (downgradeType && type2 !== downgradeType) {
90364             if (downgradeType !== "generic" && type2 !== "generic") {
90365               downgradeType = "building_address";
90366             } else {
90367               downgradeType = "generic";
90368             }
90369           } else {
90370             downgradeType = type2;
90371           }
90372         }
90373       }
90374       return downgradeType;
90375     }
90376     function downgradeTypeForEntityID(entityID) {
90377       var graph = context.graph();
90378       var entity = graph.entity(entityID);
90379       var preset = _mainPresetIndex.match(entity, graph);
90380       if (!preset || preset.isFallback()) return null;
90381       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
90382         return key.match(/^addr:.{1,}/);
90383       })) {
90384         return "address";
90385       }
90386       var geometry = entity.geometry(graph);
90387       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
90388         return "building";
90389       }
90390       if (geometry === "vertex" && Object.keys(entity.tags).length) {
90391         return "generic";
90392       }
90393       return null;
90394     }
90395     var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
90396     var addressKeysToKeep = ["source"];
90397     var operation2 = function() {
90398       context.perform(function(graph) {
90399         for (var i3 in selectedIDs) {
90400           var entityID = selectedIDs[i3];
90401           var type2 = downgradeTypeForEntityID(entityID);
90402           if (!type2) continue;
90403           var tags = Object.assign({}, graph.entity(entityID).tags);
90404           for (var key in tags) {
90405             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
90406             if (type2 === "building") {
90407               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
90408             }
90409             if (type2 !== "generic") {
90410               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
90411             }
90412             delete tags[key];
90413           }
90414           graph = actionChangeTags(entityID, tags)(graph);
90415         }
90416         return graph;
90417       }, operation2.annotation());
90418       context.validator().validate();
90419       context.enter(modeSelect(context, selectedIDs));
90420     };
90421     operation2.available = function() {
90422       return _downgradeType;
90423     };
90424     operation2.disabled = function() {
90425       if (selectedIDs.some(hasWikidataTag)) {
90426         return "has_wikidata_tag";
90427       }
90428       return false;
90429       function hasWikidataTag(id2) {
90430         var entity = context.entity(id2);
90431         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
90432       }
90433     };
90434     operation2.tooltip = function() {
90435       var disable = operation2.disabled();
90436       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
90437     };
90438     operation2.annotation = function() {
90439       var suffix;
90440       if (_downgradeType === "building_address") {
90441         suffix = "generic";
90442       } else {
90443         suffix = _downgradeType;
90444       }
90445       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
90446     };
90447     operation2.id = "downgrade";
90448     operation2.keys = [uiCmd("\u232B")];
90449     operation2.title = _t.append("operations.downgrade.title");
90450     operation2.behavior = behaviorOperation(context).which(operation2);
90451     return operation2;
90452   }
90453   var init_downgrade = __esm({
90454     "modules/operations/downgrade.js"() {
90455       "use strict";
90456       init_change_tags();
90457       init_operation();
90458       init_select5();
90459       init_localizer();
90460       init_cmd();
90461       init_presets();
90462     }
90463   });
90464
90465   // modules/operations/extract.js
90466   var extract_exports2 = {};
90467   __export(extract_exports2, {
90468     operationExtract: () => operationExtract
90469   });
90470   function operationExtract(context, selectedIDs) {
90471     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
90472     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
90473       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
90474     }).filter(Boolean));
90475     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
90476     var _extent;
90477     var _actions = selectedIDs.map(function(entityID) {
90478       var graph = context.graph();
90479       var entity = graph.hasEntity(entityID);
90480       if (!entity || !entity.hasInterestingTags()) return null;
90481       if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
90482       if (entity.type !== "node") {
90483         var preset = _mainPresetIndex.match(entity, graph);
90484         if (preset.geometry.indexOf("point") === -1) return null;
90485       }
90486       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
90487       return actionExtract(entityID, context.projection);
90488     }).filter(Boolean);
90489     var operation2 = function(d3_event) {
90490       const shiftKeyPressed = (d3_event == null ? void 0 : d3_event.shiftKey) || false;
90491       var combinedAction = function(graph) {
90492         _actions.forEach(function(action) {
90493           graph = action(graph, shiftKeyPressed);
90494         });
90495         return graph;
90496       };
90497       context.perform(combinedAction, operation2.annotation());
90498       var extractedNodeIDs = _actions.map(function(action) {
90499         return action.getExtractedNodeID();
90500       });
90501       context.enter(modeSelect(context, extractedNodeIDs));
90502     };
90503     operation2.available = function() {
90504       return _actions.length && selectedIDs.length === _actions.length;
90505     };
90506     operation2.disabled = function() {
90507       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
90508         return "too_large";
90509       } else if (selectedIDs.some(function(entityID) {
90510         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
90511       })) {
90512         return "connected_to_hidden";
90513       }
90514       return false;
90515     };
90516     operation2.tooltip = function() {
90517       var disableReason = operation2.disabled();
90518       if (disableReason) {
90519         return _t.append("operations.extract." + disableReason + "." + _amount);
90520       } else {
90521         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
90522       }
90523     };
90524     operation2.annotation = function() {
90525       return _t("operations.extract.annotation", { n: selectedIDs.length });
90526     };
90527     operation2.id = "extract";
90528     operation2.keys = [_t("operations.extract.key")];
90529     operation2.title = _t.append("operations.extract.title");
90530     operation2.behavior = behaviorOperation(context).which(operation2);
90531     return operation2;
90532   }
90533   var init_extract2 = __esm({
90534     "modules/operations/extract.js"() {
90535       "use strict";
90536       init_extract();
90537       init_operation();
90538       init_select5();
90539       init_localizer();
90540       init_presets();
90541       init_array3();
90542     }
90543   });
90544
90545   // modules/operations/merge.js
90546   var merge_exports2 = {};
90547   __export(merge_exports2, {
90548     operationMerge: () => operationMerge
90549   });
90550   function operationMerge(context, selectedIDs) {
90551     var _action = getAction();
90552     function getAction() {
90553       var join = actionJoin(selectedIDs);
90554       if (!join.disabled(context.graph())) return join;
90555       var merge3 = actionMerge(selectedIDs);
90556       if (!merge3.disabled(context.graph())) return merge3;
90557       var mergePolygon = actionMergePolygon(selectedIDs);
90558       if (!mergePolygon.disabled(context.graph())) return mergePolygon;
90559       var mergeNodes = actionMergeNodes(selectedIDs);
90560       if (!mergeNodes.disabled(context.graph())) return mergeNodes;
90561       if (join.disabled(context.graph()) !== "not_eligible") return join;
90562       if (merge3.disabled(context.graph()) !== "not_eligible") return merge3;
90563       if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
90564       return mergeNodes;
90565     }
90566     var operation2 = function() {
90567       if (operation2.disabled()) return;
90568       context.perform(_action, operation2.annotation());
90569       context.validator().validate();
90570       var resultIDs = selectedIDs.filter(context.hasEntity);
90571       if (resultIDs.length > 1) {
90572         var interestingIDs = resultIDs.filter(function(id2) {
90573           return context.entity(id2).hasInterestingTags();
90574         });
90575         if (interestingIDs.length) resultIDs = interestingIDs;
90576       }
90577       context.enter(modeSelect(context, resultIDs));
90578     };
90579     operation2.available = function() {
90580       return selectedIDs.length >= 2;
90581     };
90582     operation2.disabled = function() {
90583       var actionDisabled = _action.disabled(context.graph());
90584       if (actionDisabled) return actionDisabled;
90585       var osm = context.connection();
90586       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
90587         return "too_many_vertices";
90588       }
90589       return false;
90590     };
90591     operation2.tooltip = function() {
90592       var disabled = operation2.disabled();
90593       if (disabled) {
90594         if (disabled === "conflicting_relations") {
90595           return _t.append("operations.merge.conflicting_relations");
90596         }
90597         if (disabled === "restriction" || disabled === "connectivity") {
90598           return _t.append(
90599             "operations.merge.damage_relation",
90600             { relation: _mainPresetIndex.item("type/" + disabled).name() }
90601           );
90602         }
90603         return _t.append("operations.merge." + disabled);
90604       }
90605       return _t.append("operations.merge.description");
90606     };
90607     operation2.annotation = function() {
90608       return _t("operations.merge.annotation", { n: selectedIDs.length });
90609     };
90610     operation2.id = "merge";
90611     operation2.keys = [_t("operations.merge.key")];
90612     operation2.title = _t.append("operations.merge.title");
90613     operation2.behavior = behaviorOperation(context).which(operation2);
90614     return operation2;
90615   }
90616   var init_merge6 = __esm({
90617     "modules/operations/merge.js"() {
90618       "use strict";
90619       init_localizer();
90620       init_join2();
90621       init_merge5();
90622       init_merge_nodes();
90623       init_merge_polygon();
90624       init_operation();
90625       init_select5();
90626       init_presets();
90627     }
90628   });
90629
90630   // modules/operations/paste.js
90631   var paste_exports2 = {};
90632   __export(paste_exports2, {
90633     operationPaste: () => operationPaste
90634   });
90635   function operationPaste(context) {
90636     var _pastePoint;
90637     var operation2 = function() {
90638       if (!_pastePoint) return;
90639       var oldIDs = context.copyIDs();
90640       if (!oldIDs.length) return;
90641       var projection2 = context.projection;
90642       var extent = geoExtent();
90643       var oldGraph = context.copyGraph();
90644       var newIDs = [];
90645       var action = actionCopyEntities(oldIDs, oldGraph);
90646       context.perform(action);
90647       var copies = action.copies();
90648       var originals = /* @__PURE__ */ new Set();
90649       Object.values(copies).forEach(function(entity) {
90650         originals.add(entity.id);
90651       });
90652       for (var id2 in copies) {
90653         var oldEntity = oldGraph.entity(id2);
90654         var newEntity = copies[id2];
90655         extent._extend(oldEntity.extent(oldGraph));
90656         var parents = context.graph().parentWays(newEntity);
90657         var parentCopied = parents.some(function(parent) {
90658           return originals.has(parent.id);
90659         });
90660         if (!parentCopied) {
90661           newIDs.push(newEntity.id);
90662         }
90663       }
90664       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
90665       var delta = geoVecSubtract(_pastePoint, copyPoint);
90666       context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
90667       context.enter(modeSelect(context, newIDs));
90668     };
90669     operation2.point = function(val) {
90670       _pastePoint = val;
90671       return operation2;
90672     };
90673     operation2.available = function() {
90674       return context.mode().id === "browse";
90675     };
90676     operation2.disabled = function() {
90677       return !context.copyIDs().length;
90678     };
90679     operation2.tooltip = function() {
90680       var oldGraph = context.copyGraph();
90681       var ids = context.copyIDs();
90682       if (!ids.length) {
90683         return _t.append("operations.paste.nothing_copied");
90684       }
90685       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
90686     };
90687     operation2.annotation = function() {
90688       var ids = context.copyIDs();
90689       return _t("operations.paste.annotation", { n: ids.length });
90690     };
90691     operation2.id = "paste";
90692     operation2.keys = [uiCmd("\u2318V")];
90693     operation2.title = _t.append("operations.paste.title");
90694     return operation2;
90695   }
90696   var init_paste2 = __esm({
90697     "modules/operations/paste.js"() {
90698       "use strict";
90699       init_copy_entities();
90700       init_move();
90701       init_select5();
90702       init_geo2();
90703       init_localizer();
90704       init_cmd();
90705       init_utilDisplayLabel();
90706     }
90707   });
90708
90709   // modules/operations/reverse.js
90710   var reverse_exports2 = {};
90711   __export(reverse_exports2, {
90712     operationReverse: () => operationReverse
90713   });
90714   function operationReverse(context, selectedIDs) {
90715     var operation2 = function() {
90716       context.perform(function combinedReverseAction(graph) {
90717         actions().forEach(function(action) {
90718           graph = action(graph);
90719         });
90720         return graph;
90721       }, operation2.annotation());
90722       context.validator().validate();
90723     };
90724     function actions(situation) {
90725       return selectedIDs.map(function(entityID) {
90726         var entity = context.hasEntity(entityID);
90727         if (!entity) return null;
90728         if (situation === "toolbar") {
90729           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
90730         }
90731         var geometry = entity.geometry(context.graph());
90732         if (entity.type !== "node" && geometry !== "line") return null;
90733         var action = actionReverse(entityID);
90734         if (action.disabled(context.graph())) return null;
90735         return action;
90736       }).filter(Boolean);
90737     }
90738     function reverseTypeID() {
90739       var acts = actions();
90740       var nodeActionCount = acts.filter(function(act) {
90741         var entity = context.hasEntity(act.entityID());
90742         return entity && entity.type === "node";
90743       }).length;
90744       if (nodeActionCount === 0) return "line";
90745       if (nodeActionCount === acts.length) return "point";
90746       return "feature";
90747     }
90748     operation2.available = function(situation) {
90749       return actions(situation).length > 0;
90750     };
90751     operation2.disabled = function() {
90752       return false;
90753     };
90754     operation2.tooltip = function() {
90755       return _t.append("operations.reverse.description." + reverseTypeID());
90756     };
90757     operation2.annotation = function() {
90758       var acts = actions();
90759       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
90760     };
90761     operation2.id = "reverse";
90762     operation2.keys = [_t("operations.reverse.key")];
90763     operation2.title = _t.append("operations.reverse.title");
90764     operation2.behavior = behaviorOperation(context).which(operation2);
90765     return operation2;
90766   }
90767   var init_reverse2 = __esm({
90768     "modules/operations/reverse.js"() {
90769       "use strict";
90770       init_localizer();
90771       init_reverse();
90772       init_operation();
90773     }
90774   });
90775
90776   // modules/operations/straighten.js
90777   var straighten_exports = {};
90778   __export(straighten_exports, {
90779     operationStraighten: () => operationStraighten
90780   });
90781   function operationStraighten(context, selectedIDs) {
90782     var _wayIDs = selectedIDs.filter(function(id2) {
90783       return id2.charAt(0) === "w";
90784     });
90785     var _nodeIDs = selectedIDs.filter(function(id2) {
90786       return id2.charAt(0) === "n";
90787     });
90788     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
90789     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
90790     var _coords = _nodes.map(function(n3) {
90791       return n3.loc;
90792     });
90793     var _extent = utilTotalExtent(selectedIDs, context.graph());
90794     var _action = chooseAction();
90795     var _geometry;
90796     function chooseAction() {
90797       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
90798         _geometry = "point";
90799         return actionStraightenNodes(_nodeIDs, context.projection);
90800       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
90801         var startNodeIDs = [];
90802         var endNodeIDs = [];
90803         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
90804           var entity = context.entity(selectedIDs[i3]);
90805           if (entity.type === "node") {
90806             continue;
90807           } else if (entity.type !== "way" || entity.isClosed()) {
90808             return null;
90809           }
90810           startNodeIDs.push(entity.first());
90811           endNodeIDs.push(entity.last());
90812         }
90813         startNodeIDs = startNodeIDs.filter(function(n3) {
90814           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
90815         });
90816         endNodeIDs = endNodeIDs.filter(function(n3) {
90817           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
90818         });
90819         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
90820         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
90821           return node.id;
90822         });
90823         if (wayNodeIDs.length <= 2) return null;
90824         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
90825         if (_nodeIDs.length) {
90826           _extent = utilTotalExtent(_nodeIDs, context.graph());
90827         }
90828         _geometry = "line";
90829         return actionStraightenWay(selectedIDs, context.projection);
90830       }
90831       return null;
90832     }
90833     function operation2() {
90834       if (!_action) return;
90835       context.perform(_action, operation2.annotation());
90836       window.setTimeout(function() {
90837         context.validator().validate();
90838       }, 300);
90839     }
90840     operation2.available = function() {
90841       return Boolean(_action);
90842     };
90843     operation2.disabled = function() {
90844       var reason = _action.disabled(context.graph());
90845       if (reason) {
90846         return reason;
90847       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
90848         return "too_large";
90849       } else if (someMissing()) {
90850         return "not_downloaded";
90851       } else if (selectedIDs.some(context.hasHiddenConnections)) {
90852         return "connected_to_hidden";
90853       }
90854       return false;
90855       function someMissing() {
90856         if (context.inIntro()) return false;
90857         var osm = context.connection();
90858         if (osm) {
90859           var missing = _coords.filter(function(loc) {
90860             return !osm.isDataLoaded(loc);
90861           });
90862           if (missing.length) {
90863             missing.forEach(function(loc) {
90864               context.loadTileAtLoc(loc);
90865             });
90866             return true;
90867           }
90868         }
90869         return false;
90870       }
90871     };
90872     operation2.tooltip = function() {
90873       var disable = operation2.disabled();
90874       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
90875     };
90876     operation2.annotation = function() {
90877       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
90878     };
90879     operation2.id = "straighten";
90880     operation2.keys = [_t("operations.straighten.key")];
90881     operation2.title = _t.append("operations.straighten.title");
90882     operation2.behavior = behaviorOperation(context).which(operation2);
90883     return operation2;
90884   }
90885   var init_straighten = __esm({
90886     "modules/operations/straighten.js"() {
90887       "use strict";
90888       init_localizer();
90889       init_straighten_nodes();
90890       init_straighten_way();
90891       init_operation();
90892       init_util();
90893     }
90894   });
90895
90896   // modules/operations/index.js
90897   var operations_exports = {};
90898   __export(operations_exports, {
90899     operationCircularize: () => operationCircularize,
90900     operationContinue: () => operationContinue,
90901     operationCopy: () => operationCopy,
90902     operationDelete: () => operationDelete,
90903     operationDisconnect: () => operationDisconnect,
90904     operationDowngrade: () => operationDowngrade,
90905     operationExtract: () => operationExtract,
90906     operationMerge: () => operationMerge,
90907     operationMove: () => operationMove,
90908     operationOrthogonalize: () => operationOrthogonalize,
90909     operationPaste: () => operationPaste,
90910     operationReflectLong: () => operationReflectLong,
90911     operationReflectShort: () => operationReflectShort,
90912     operationReverse: () => operationReverse,
90913     operationRotate: () => operationRotate,
90914     operationSplit: () => operationSplit,
90915     operationStraighten: () => operationStraighten
90916   });
90917   var init_operations = __esm({
90918     "modules/operations/index.js"() {
90919       "use strict";
90920       init_circularize2();
90921       init_continue();
90922       init_copy();
90923       init_delete();
90924       init_disconnect2();
90925       init_downgrade();
90926       init_extract2();
90927       init_merge6();
90928       init_move2();
90929       init_orthogonalize2();
90930       init_paste2();
90931       init_reflect2();
90932       init_reverse2();
90933       init_rotate3();
90934       init_split2();
90935       init_straighten();
90936     }
90937   });
90938
90939   // modules/modes/select.js
90940   var select_exports2 = {};
90941   __export(select_exports2, {
90942     modeSelect: () => modeSelect
90943   });
90944   function modeSelect(context, selectedIDs) {
90945     var mode = {
90946       id: "select",
90947       button: "browse"
90948     };
90949     var keybinding = utilKeybinding("select");
90950     var _breatheBehavior = behaviorBreathe(context);
90951     var _modeDragNode = modeDragNode(context);
90952     var _selectBehavior;
90953     var _behaviors = [];
90954     var _operations = [];
90955     var _newFeature = false;
90956     var _follow = false;
90957     var _focusedParentWayId;
90958     var _focusedVertexIds;
90959     function singular() {
90960       if (selectedIDs && selectedIDs.length === 1) {
90961         return context.hasEntity(selectedIDs[0]);
90962       }
90963     }
90964     function selectedEntities() {
90965       return selectedIDs.map(function(id2) {
90966         return context.hasEntity(id2);
90967       }).filter(Boolean);
90968     }
90969     function checkSelectedIDs() {
90970       var ids = [];
90971       if (Array.isArray(selectedIDs)) {
90972         ids = selectedIDs.filter(function(id2) {
90973           return context.hasEntity(id2);
90974         });
90975       }
90976       if (!ids.length) {
90977         context.enter(modeBrowse(context));
90978         return false;
90979       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
90980         context.enter(modeSelect(context, ids));
90981         return false;
90982       }
90983       selectedIDs = ids;
90984       return true;
90985     }
90986     function parentWaysIdsOfSelection(onlyCommonParents) {
90987       var graph = context.graph();
90988       var parents = [];
90989       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
90990         var entity = context.hasEntity(selectedIDs[i3]);
90991         if (!entity || entity.geometry(graph) !== "vertex") {
90992           return [];
90993         }
90994         var currParents = graph.parentWays(entity).map(function(w2) {
90995           return w2.id;
90996         });
90997         if (!parents.length) {
90998           parents = currParents;
90999           continue;
91000         }
91001         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
91002         if (!parents.length) {
91003           return [];
91004         }
91005       }
91006       return parents;
91007     }
91008     function childNodeIdsOfSelection(onlyCommon) {
91009       var graph = context.graph();
91010       var childs = [];
91011       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
91012         var entity = context.hasEntity(selectedIDs[i3]);
91013         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
91014           return [];
91015         }
91016         var currChilds = graph.childNodes(entity).map(function(node) {
91017           return node.id;
91018         });
91019         if (!childs.length) {
91020           childs = currChilds;
91021           continue;
91022         }
91023         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
91024         if (!childs.length) {
91025           return [];
91026         }
91027       }
91028       return childs;
91029     }
91030     function checkFocusedParent() {
91031       if (_focusedParentWayId) {
91032         var parents = parentWaysIdsOfSelection(true);
91033         if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
91034       }
91035     }
91036     function parentWayIdForVertexNavigation() {
91037       var parentIds = parentWaysIdsOfSelection(true);
91038       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
91039         return _focusedParentWayId;
91040       }
91041       return parentIds.length ? parentIds[0] : null;
91042     }
91043     mode.selectedIDs = function(val) {
91044       if (!arguments.length) return selectedIDs;
91045       selectedIDs = val;
91046       return mode;
91047     };
91048     mode.zoomToSelected = function() {
91049       context.map().zoomToEase(selectedEntities());
91050     };
91051     mode.newFeature = function(val) {
91052       if (!arguments.length) return _newFeature;
91053       _newFeature = val;
91054       return mode;
91055     };
91056     mode.selectBehavior = function(val) {
91057       if (!arguments.length) return _selectBehavior;
91058       _selectBehavior = val;
91059       return mode;
91060     };
91061     mode.follow = function(val) {
91062       if (!arguments.length) return _follow;
91063       _follow = val;
91064       return mode;
91065     };
91066     function loadOperations() {
91067       _operations.forEach(function(operation2) {
91068         if (operation2.behavior) {
91069           context.uninstall(operation2.behavior);
91070         }
91071       });
91072       _operations = Object.values(operations_exports).map(function(o2) {
91073         return o2(context, selectedIDs);
91074       }).filter(function(o2) {
91075         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
91076       }).concat([
91077         // group copy/downgrade/delete operation together at the end of the list
91078         operationCopy(context, selectedIDs),
91079         operationDowngrade(context, selectedIDs),
91080         operationDelete(context, selectedIDs)
91081       ]).filter(function(operation2) {
91082         return operation2.available();
91083       });
91084       _operations.forEach(function(operation2) {
91085         if (operation2.behavior) {
91086           context.install(operation2.behavior);
91087         }
91088       });
91089       context.ui().closeEditMenu();
91090     }
91091     mode.operations = function() {
91092       return _operations;
91093     };
91094     mode.enter = function() {
91095       if (!checkSelectedIDs()) return;
91096       context.features().forceVisible(selectedIDs);
91097       _modeDragNode.restoreSelectedIDs(selectedIDs);
91098       loadOperations();
91099       if (!_behaviors.length) {
91100         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
91101         _behaviors = [
91102           behaviorPaste(context),
91103           _breatheBehavior,
91104           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
91105           _selectBehavior,
91106           behaviorLasso(context),
91107           _modeDragNode.behavior,
91108           modeDragNote(context).behavior
91109         ];
91110       }
91111       _behaviors.forEach(context.install);
91112       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);
91113       select_default2(document).call(keybinding);
91114       context.ui().sidebar.select(selectedIDs, _newFeature);
91115       context.history().on("change.select", function() {
91116         loadOperations();
91117         selectElements();
91118       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
91119       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
91120         selectElements();
91121         _breatheBehavior.restartIfNeeded(context.surface());
91122       });
91123       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
91124       selectElements();
91125       if (_follow) {
91126         var extent = geoExtent();
91127         var graph = context.graph();
91128         selectedIDs.forEach(function(id2) {
91129           var entity = context.entity(id2);
91130           extent._extend(entity.extent(graph));
91131         });
91132         var loc = extent.center();
91133         context.map().centerEase(loc);
91134         _follow = false;
91135       }
91136       function nudgeSelection(delta) {
91137         return function() {
91138           if (!context.map().withinEditableZoom()) return;
91139           var moveOp = operationMove(context, selectedIDs);
91140           if (moveOp.disabled()) {
91141             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
91142           } else {
91143             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
91144             context.validator().validate();
91145           }
91146         };
91147       }
91148       function scaleSelection(factor) {
91149         return function() {
91150           if (!context.map().withinEditableZoom()) return;
91151           let nodes = utilGetAllNodes(selectedIDs, context.graph());
91152           let isUp = factor > 1;
91153           if (nodes.length <= 1) return;
91154           let extent2 = utilTotalExtent(selectedIDs, context.graph());
91155           function scalingDisabled() {
91156             if (tooSmall()) {
91157               return "too_small";
91158             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
91159               return "too_large";
91160             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
91161               return "not_downloaded";
91162             } else if (selectedIDs.some(context.hasHiddenConnections)) {
91163               return "connected_to_hidden";
91164             }
91165             return false;
91166             function tooSmall() {
91167               if (isUp) return false;
91168               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
91169               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
91170               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
91171             }
91172             function someMissing() {
91173               if (context.inIntro()) return false;
91174               let osm = context.connection();
91175               if (osm) {
91176                 let missing = nodes.filter(function(n3) {
91177                   return !osm.isDataLoaded(n3.loc);
91178                 });
91179                 if (missing.length) {
91180                   missing.forEach(function(loc2) {
91181                     context.loadTileAtLoc(loc2);
91182                   });
91183                   return true;
91184                 }
91185               }
91186               return false;
91187             }
91188             function incompleteRelation(id2) {
91189               let entity = context.entity(id2);
91190               return entity.type === "relation" && !entity.isComplete(context.graph());
91191             }
91192           }
91193           const disabled = scalingDisabled();
91194           if (disabled) {
91195             let multi = selectedIDs.length === 1 ? "single" : "multiple";
91196             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
91197           } else {
91198             const pivot = context.projection(extent2.center());
91199             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
91200             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
91201             context.validator().validate();
91202           }
91203         };
91204       }
91205       function didDoubleUp(d3_event, loc2) {
91206         if (!context.map().withinEditableZoom()) return;
91207         var target = select_default2(d3_event.target);
91208         var datum2 = target.datum();
91209         var entity = datum2 && datum2.properties && datum2.properties.entity;
91210         if (!entity) return;
91211         if (entity instanceof osmWay && target.classed("target")) {
91212           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
91213           var prev = entity.nodes[choice.index - 1];
91214           var next = entity.nodes[choice.index];
91215           context.perform(
91216             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
91217             _t("operations.add.annotation.vertex")
91218           );
91219           context.validator().validate();
91220         } else if (entity.type === "midpoint") {
91221           context.perform(
91222             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
91223             _t("operations.add.annotation.vertex")
91224           );
91225           context.validator().validate();
91226         }
91227       }
91228       function selectElements() {
91229         if (!checkSelectedIDs()) return;
91230         var surface = context.surface();
91231         surface.selectAll(".selected-member").classed("selected-member", false);
91232         surface.selectAll(".selected").classed("selected", false);
91233         surface.selectAll(".related").classed("related", false);
91234         checkFocusedParent();
91235         if (_focusedParentWayId) {
91236           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
91237         }
91238         if (context.map().withinEditableZoom()) {
91239           surface.selectAll(utilDeepMemberSelector(
91240             selectedIDs,
91241             context.graph(),
91242             true
91243             /* skipMultipolgonMembers */
91244           )).classed("selected-member", true);
91245           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
91246         }
91247       }
91248       function esc() {
91249         if (context.container().select(".combobox").size()) return;
91250         context.enter(modeBrowse(context));
91251       }
91252       function firstVertex(d3_event) {
91253         d3_event.preventDefault();
91254         var entity = singular();
91255         var parentId = parentWayIdForVertexNavigation();
91256         var way;
91257         if (entity && entity.type === "way") {
91258           way = entity;
91259         } else if (parentId) {
91260           way = context.entity(parentId);
91261         }
91262         _focusedParentWayId = way && way.id;
91263         if (way) {
91264           context.enter(
91265             mode.selectedIDs([way.first()]).follow(true)
91266           );
91267         }
91268       }
91269       function lastVertex(d3_event) {
91270         d3_event.preventDefault();
91271         var entity = singular();
91272         var parentId = parentWayIdForVertexNavigation();
91273         var way;
91274         if (entity && entity.type === "way") {
91275           way = entity;
91276         } else if (parentId) {
91277           way = context.entity(parentId);
91278         }
91279         _focusedParentWayId = way && way.id;
91280         if (way) {
91281           context.enter(
91282             mode.selectedIDs([way.last()]).follow(true)
91283           );
91284         }
91285       }
91286       function previousVertex(d3_event) {
91287         d3_event.preventDefault();
91288         var parentId = parentWayIdForVertexNavigation();
91289         _focusedParentWayId = parentId;
91290         if (!parentId) return;
91291         var way = context.entity(parentId);
91292         var length2 = way.nodes.length;
91293         var curr = way.nodes.indexOf(selectedIDs[0]);
91294         var index = -1;
91295         if (curr > 0) {
91296           index = curr - 1;
91297         } else if (way.isClosed()) {
91298           index = length2 - 2;
91299         }
91300         if (index !== -1) {
91301           context.enter(
91302             mode.selectedIDs([way.nodes[index]]).follow(true)
91303           );
91304         }
91305       }
91306       function nextVertex(d3_event) {
91307         d3_event.preventDefault();
91308         var parentId = parentWayIdForVertexNavigation();
91309         _focusedParentWayId = parentId;
91310         if (!parentId) return;
91311         var way = context.entity(parentId);
91312         var length2 = way.nodes.length;
91313         var curr = way.nodes.indexOf(selectedIDs[0]);
91314         var index = -1;
91315         if (curr < length2 - 1) {
91316           index = curr + 1;
91317         } else if (way.isClosed()) {
91318           index = 0;
91319         }
91320         if (index !== -1) {
91321           context.enter(
91322             mode.selectedIDs([way.nodes[index]]).follow(true)
91323           );
91324         }
91325       }
91326       function focusNextParent(d3_event) {
91327         d3_event.preventDefault();
91328         var parents = parentWaysIdsOfSelection(true);
91329         if (!parents || parents.length < 2) return;
91330         var index = parents.indexOf(_focusedParentWayId);
91331         if (index < 0 || index > parents.length - 2) {
91332           _focusedParentWayId = parents[0];
91333         } else {
91334           _focusedParentWayId = parents[index + 1];
91335         }
91336         var surface = context.surface();
91337         surface.selectAll(".related").classed("related", false);
91338         if (_focusedParentWayId) {
91339           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
91340         }
91341       }
91342       function selectParent(d3_event) {
91343         d3_event.preventDefault();
91344         var currentSelectedIds = mode.selectedIDs();
91345         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
91346         if (!parentIds.length) return;
91347         context.enter(
91348           mode.selectedIDs(parentIds)
91349         );
91350         _focusedVertexIds = currentSelectedIds;
91351       }
91352       function selectChild(d3_event) {
91353         d3_event.preventDefault();
91354         var currentSelectedIds = mode.selectedIDs();
91355         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
91356         if (!childIds || !childIds.length) return;
91357         if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
91358         context.enter(
91359           mode.selectedIDs(childIds)
91360         );
91361       }
91362     };
91363     mode.exit = function() {
91364       _newFeature = false;
91365       _focusedVertexIds = null;
91366       _operations.forEach(function(operation2) {
91367         if (operation2.behavior) {
91368           context.uninstall(operation2.behavior);
91369         }
91370       });
91371       _operations = [];
91372       _behaviors.forEach(context.uninstall);
91373       select_default2(document).call(keybinding.unbind);
91374       context.ui().closeEditMenu();
91375       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
91376       var surface = context.surface();
91377       surface.selectAll(".selected-member").classed("selected-member", false);
91378       surface.selectAll(".selected").classed("selected", false);
91379       surface.selectAll(".highlighted").classed("highlighted", false);
91380       surface.selectAll(".related").classed("related", false);
91381       context.map().on("drawn.select", null);
91382       context.ui().sidebar.hide();
91383       context.features().forceVisible([]);
91384       var entity = singular();
91385       if (_newFeature && entity && entity.type === "relation" && // no tags
91386       Object.keys(entity.tags).length === 0 && // no parent relations
91387       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
91388       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
91389         var deleteAction = actionDeleteRelation(
91390           entity.id,
91391           true
91392           /* don't delete untagged members */
91393         );
91394         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
91395         context.validator().validate();
91396       }
91397     };
91398     return mode;
91399   }
91400   var init_select5 = __esm({
91401     "modules/modes/select.js"() {
91402       "use strict";
91403       init_src5();
91404       init_localizer();
91405       init_add_midpoint();
91406       init_delete_relation();
91407       init_move();
91408       init_scale();
91409       init_breathe();
91410       init_hover();
91411       init_lasso2();
91412       init_paste();
91413       init_select4();
91414       init_move2();
91415       init_geo2();
91416       init_browse();
91417       init_drag_node();
91418       init_drag_note();
91419       init_osm();
91420       init_operations();
91421       init_cmd();
91422       init_util();
91423     }
91424   });
91425
91426   // modules/behavior/lasso.js
91427   var lasso_exports2 = {};
91428   __export(lasso_exports2, {
91429     behaviorLasso: () => behaviorLasso
91430   });
91431   function behaviorLasso(context) {
91432     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
91433     var behavior = function(selection2) {
91434       var lasso;
91435       function pointerdown(d3_event) {
91436         var button = 0;
91437         if (d3_event.button === button && d3_event.shiftKey === true) {
91438           lasso = null;
91439           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
91440           d3_event.stopPropagation();
91441         }
91442       }
91443       function pointermove() {
91444         if (!lasso) {
91445           lasso = uiLasso(context);
91446           context.surface().call(lasso);
91447         }
91448         lasso.p(context.map().mouse());
91449       }
91450       function normalize2(a2, b2) {
91451         return [
91452           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
91453           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
91454         ];
91455       }
91456       function lassoed() {
91457         if (!lasso) return [];
91458         var graph = context.graph();
91459         var limitToNodes;
91460         if (context.map().editableDataEnabled(
91461           true
91462           /* skipZoomCheck */
91463         ) && context.map().isInWideSelection()) {
91464           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
91465         } else if (!context.map().editableDataEnabled()) {
91466           return [];
91467         }
91468         var bounds = lasso.extent().map(context.projection.invert);
91469         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
91470         var intersects2 = context.history().intersects(extent).filter(function(entity) {
91471           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
91472         });
91473         intersects2.sort(function(node1, node2) {
91474           var parents1 = graph.parentWays(node1);
91475           var parents2 = graph.parentWays(node2);
91476           if (parents1.length && parents2.length) {
91477             var sharedParents = utilArrayIntersection(parents1, parents2);
91478             if (sharedParents.length) {
91479               var sharedParentNodes = sharedParents[0].nodes;
91480               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
91481             } else {
91482               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
91483             }
91484           } else if (parents1.length || parents2.length) {
91485             return parents1.length - parents2.length;
91486           }
91487           return node1.loc[0] - node2.loc[0];
91488         });
91489         return intersects2.map(function(entity) {
91490           return entity.id;
91491         });
91492       }
91493       function pointerup() {
91494         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
91495         if (!lasso) return;
91496         var ids = lassoed();
91497         lasso.close();
91498         if (ids.length) {
91499           context.enter(modeSelect(context, ids));
91500         }
91501       }
91502       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
91503     };
91504     behavior.off = function(selection2) {
91505       selection2.on(_pointerPrefix + "down.lasso", null);
91506     };
91507     return behavior;
91508   }
91509   var init_lasso2 = __esm({
91510     "modules/behavior/lasso.js"() {
91511       "use strict";
91512       init_src5();
91513       init_geo2();
91514       init_select5();
91515       init_lasso();
91516       init_array3();
91517       init_util2();
91518     }
91519   });
91520
91521   // modules/modes/browse.js
91522   var browse_exports = {};
91523   __export(browse_exports, {
91524     modeBrowse: () => modeBrowse
91525   });
91526   function modeBrowse(context) {
91527     var mode = {
91528       button: "browse",
91529       id: "browse",
91530       title: _t.append("modes.browse.title"),
91531       description: _t.append("modes.browse.description")
91532     };
91533     var sidebar;
91534     var _selectBehavior;
91535     var _behaviors = [];
91536     mode.selectBehavior = function(val) {
91537       if (!arguments.length) return _selectBehavior;
91538       _selectBehavior = val;
91539       return mode;
91540     };
91541     mode.enter = function() {
91542       if (!_behaviors.length) {
91543         if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
91544         _behaviors = [
91545           behaviorPaste(context),
91546           behaviorHover(context).on("hover", context.ui().sidebar.hover),
91547           _selectBehavior,
91548           behaviorLasso(context),
91549           modeDragNode(context).behavior,
91550           modeDragNote(context).behavior
91551         ];
91552       }
91553       _behaviors.forEach(context.install);
91554       if (document.activeElement && document.activeElement.blur) {
91555         document.activeElement.blur();
91556       }
91557       if (sidebar) {
91558         context.ui().sidebar.show(sidebar);
91559       } else {
91560         context.ui().sidebar.select(null);
91561       }
91562     };
91563     mode.exit = function() {
91564       context.ui().sidebar.hover.cancel();
91565       _behaviors.forEach(context.uninstall);
91566       if (sidebar) {
91567         context.ui().sidebar.hide();
91568       }
91569     };
91570     mode.sidebar = function(_2) {
91571       if (!arguments.length) return sidebar;
91572       sidebar = _2;
91573       return mode;
91574     };
91575     mode.operations = function() {
91576       return [operationPaste(context)];
91577     };
91578     return mode;
91579   }
91580   var init_browse = __esm({
91581     "modules/modes/browse.js"() {
91582       "use strict";
91583       init_localizer();
91584       init_hover();
91585       init_lasso2();
91586       init_paste();
91587       init_select4();
91588       init_drag_node();
91589       init_drag_note();
91590       init_paste2();
91591     }
91592   });
91593
91594   // modules/behavior/add_way.js
91595   var add_way_exports = {};
91596   __export(add_way_exports, {
91597     behaviorAddWay: () => behaviorAddWay
91598   });
91599   function behaviorAddWay(context) {
91600     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
91601     var draw = behaviorDraw(context);
91602     function behavior(surface) {
91603       draw.on("click", function() {
91604         dispatch14.apply("start", this, arguments);
91605       }).on("clickWay", function() {
91606         dispatch14.apply("startFromWay", this, arguments);
91607       }).on("clickNode", function() {
91608         dispatch14.apply("startFromNode", this, arguments);
91609       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
91610       context.map().dblclickZoomEnable(false);
91611       surface.call(draw);
91612     }
91613     behavior.off = function(surface) {
91614       surface.call(draw.off);
91615     };
91616     behavior.cancel = function() {
91617       window.setTimeout(function() {
91618         context.map().dblclickZoomEnable(true);
91619       }, 1e3);
91620       context.enter(modeBrowse(context));
91621     };
91622     return utilRebind(behavior, dispatch14, "on");
91623   }
91624   var init_add_way = __esm({
91625     "modules/behavior/add_way.js"() {
91626       "use strict";
91627       init_src4();
91628       init_draw();
91629       init_browse();
91630       init_rebind();
91631     }
91632   });
91633
91634   // modules/globals.d.ts
91635   var globals_d_exports = {};
91636   var init_globals_d = __esm({
91637     "modules/globals.d.ts"() {
91638       "use strict";
91639     }
91640   });
91641
91642   // modules/ui/panes/index.js
91643   var panes_exports = {};
91644   __export(panes_exports, {
91645     uiPaneBackground: () => uiPaneBackground,
91646     uiPaneHelp: () => uiPaneHelp,
91647     uiPaneIssues: () => uiPaneIssues,
91648     uiPaneMapData: () => uiPaneMapData,
91649     uiPanePreferences: () => uiPanePreferences
91650   });
91651   var init_panes = __esm({
91652     "modules/ui/panes/index.js"() {
91653       "use strict";
91654       init_background3();
91655       init_help();
91656       init_issues();
91657       init_map_data();
91658       init_preferences2();
91659     }
91660   });
91661
91662   // modules/ui/sections/index.js
91663   var sections_exports = {};
91664   __export(sections_exports, {
91665     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
91666     uiSectionBackgroundList: () => uiSectionBackgroundList,
91667     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
91668     uiSectionChanges: () => uiSectionChanges,
91669     uiSectionDataLayers: () => uiSectionDataLayers,
91670     uiSectionEntityIssues: () => uiSectionEntityIssues,
91671     uiSectionFeatureType: () => uiSectionFeatureType,
91672     uiSectionMapFeatures: () => uiSectionMapFeatures,
91673     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
91674     uiSectionOverlayList: () => uiSectionOverlayList,
91675     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
91676     uiSectionPresetFields: () => uiSectionPresetFields,
91677     uiSectionPrivacy: () => uiSectionPrivacy,
91678     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
91679     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
91680     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
91681     uiSectionSelectionList: () => uiSectionSelectionList,
91682     uiSectionValidationIssues: () => uiSectionValidationIssues,
91683     uiSectionValidationOptions: () => uiSectionValidationOptions,
91684     uiSectionValidationRules: () => uiSectionValidationRules,
91685     uiSectionValidationStatus: () => uiSectionValidationStatus
91686   });
91687   var init_sections = __esm({
91688     "modules/ui/sections/index.js"() {
91689       "use strict";
91690       init_background_display_options();
91691       init_background_list();
91692       init_background_offset();
91693       init_changes();
91694       init_data_layers();
91695       init_entity_issues();
91696       init_feature_type();
91697       init_map_features();
91698       init_map_style_options();
91699       init_overlay_list();
91700       init_photo_overlays();
91701       init_preset_fields();
91702       init_privacy();
91703       init_raw_member_editor();
91704       init_raw_membership_editor();
91705       init_raw_tag_editor();
91706       init_selection_list();
91707       init_validation_issues();
91708       init_validation_options();
91709       init_validation_rules();
91710       init_validation_status();
91711     }
91712   });
91713
91714   // modules/ui/settings/index.js
91715   var settings_exports = {};
91716   __export(settings_exports, {
91717     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
91718     uiSettingsCustomData: () => uiSettingsCustomData
91719   });
91720   var init_settings = __esm({
91721     "modules/ui/settings/index.js"() {
91722       "use strict";
91723       init_custom_background();
91724       init_custom_data();
91725     }
91726   });
91727
91728   // import("../**/*") in modules/core/file_fetcher.js
91729   var globImport;
91730   var init_ = __esm({
91731     'import("../**/*") in modules/core/file_fetcher.js'() {
91732       globImport = __glob({
91733         "../actions/add_entity.js": () => Promise.resolve().then(() => (init_add_entity(), add_entity_exports)),
91734         "../actions/add_member.js": () => Promise.resolve().then(() => (init_add_member(), add_member_exports)),
91735         "../actions/add_midpoint.js": () => Promise.resolve().then(() => (init_add_midpoint(), add_midpoint_exports)),
91736         "../actions/add_vertex.js": () => Promise.resolve().then(() => (init_add_vertex(), add_vertex_exports)),
91737         "../actions/change_member.js": () => Promise.resolve().then(() => (init_change_member(), change_member_exports)),
91738         "../actions/change_preset.js": () => Promise.resolve().then(() => (init_change_preset(), change_preset_exports)),
91739         "../actions/change_tags.js": () => Promise.resolve().then(() => (init_change_tags(), change_tags_exports)),
91740         "../actions/circularize.js": () => Promise.resolve().then(() => (init_circularize(), circularize_exports)),
91741         "../actions/connect.js": () => Promise.resolve().then(() => (init_connect(), connect_exports)),
91742         "../actions/copy_entities.js": () => Promise.resolve().then(() => (init_copy_entities(), copy_entities_exports)),
91743         "../actions/delete_member.js": () => Promise.resolve().then(() => (init_delete_member(), delete_member_exports)),
91744         "../actions/delete_members.js": () => Promise.resolve().then(() => (init_delete_members(), delete_members_exports)),
91745         "../actions/delete_multiple.js": () => Promise.resolve().then(() => (init_delete_multiple(), delete_multiple_exports)),
91746         "../actions/delete_node.js": () => Promise.resolve().then(() => (init_delete_node(), delete_node_exports)),
91747         "../actions/delete_relation.js": () => Promise.resolve().then(() => (init_delete_relation(), delete_relation_exports)),
91748         "../actions/delete_way.js": () => Promise.resolve().then(() => (init_delete_way(), delete_way_exports)),
91749         "../actions/discard_tags.js": () => Promise.resolve().then(() => (init_discard_tags(), discard_tags_exports)),
91750         "../actions/disconnect.js": () => Promise.resolve().then(() => (init_disconnect(), disconnect_exports)),
91751         "../actions/extract.js": () => Promise.resolve().then(() => (init_extract(), extract_exports)),
91752         "../actions/index.js": () => Promise.resolve().then(() => (init_actions(), actions_exports)),
91753         "../actions/join.js": () => Promise.resolve().then(() => (init_join2(), join_exports)),
91754         "../actions/merge.js": () => Promise.resolve().then(() => (init_merge5(), merge_exports)),
91755         "../actions/merge_nodes.js": () => Promise.resolve().then(() => (init_merge_nodes(), merge_nodes_exports)),
91756         "../actions/merge_polygon.js": () => Promise.resolve().then(() => (init_merge_polygon(), merge_polygon_exports)),
91757         "../actions/merge_remote_changes.js": () => Promise.resolve().then(() => (init_merge_remote_changes(), merge_remote_changes_exports)),
91758         "../actions/move.js": () => Promise.resolve().then(() => (init_move(), move_exports)),
91759         "../actions/move_member.js": () => Promise.resolve().then(() => (init_move_member(), move_member_exports)),
91760         "../actions/move_node.js": () => Promise.resolve().then(() => (init_move_node(), move_node_exports)),
91761         "../actions/noop.js": () => Promise.resolve().then(() => (init_noop2(), noop_exports)),
91762         "../actions/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize(), orthogonalize_exports)),
91763         "../actions/reflect.js": () => Promise.resolve().then(() => (init_reflect(), reflect_exports)),
91764         "../actions/restrict_turn.js": () => Promise.resolve().then(() => (init_restrict_turn(), restrict_turn_exports)),
91765         "../actions/reverse.js": () => Promise.resolve().then(() => (init_reverse(), reverse_exports)),
91766         "../actions/revert.js": () => Promise.resolve().then(() => (init_revert(), revert_exports)),
91767         "../actions/rotate.js": () => Promise.resolve().then(() => (init_rotate(), rotate_exports)),
91768         "../actions/scale.js": () => Promise.resolve().then(() => (init_scale(), scale_exports)),
91769         "../actions/split.js": () => Promise.resolve().then(() => (init_split(), split_exports)),
91770         "../actions/straighten_nodes.js": () => Promise.resolve().then(() => (init_straighten_nodes(), straighten_nodes_exports)),
91771         "../actions/straighten_way.js": () => Promise.resolve().then(() => (init_straighten_way(), straighten_way_exports)),
91772         "../actions/unrestrict_turn.js": () => Promise.resolve().then(() => (init_unrestrict_turn(), unrestrict_turn_exports)),
91773         "../actions/upgrade_tags.js": () => Promise.resolve().then(() => (init_upgrade_tags(), upgrade_tags_exports)),
91774         "../behavior/add_way.js": () => Promise.resolve().then(() => (init_add_way(), add_way_exports)),
91775         "../behavior/breathe.js": () => Promise.resolve().then(() => (init_breathe(), breathe_exports)),
91776         "../behavior/drag.js": () => Promise.resolve().then(() => (init_drag2(), drag_exports)),
91777         "../behavior/draw.js": () => Promise.resolve().then(() => (init_draw(), draw_exports)),
91778         "../behavior/draw_way.js": () => Promise.resolve().then(() => (init_draw_way(), draw_way_exports)),
91779         "../behavior/edit.js": () => Promise.resolve().then(() => (init_edit(), edit_exports)),
91780         "../behavior/hash.js": () => Promise.resolve().then(() => (init_hash(), hash_exports)),
91781         "../behavior/hover.js": () => Promise.resolve().then(() => (init_hover(), hover_exports)),
91782         "../behavior/index.js": () => Promise.resolve().then(() => (init_behavior(), behavior_exports)),
91783         "../behavior/lasso.js": () => Promise.resolve().then(() => (init_lasso2(), lasso_exports2)),
91784         "../behavior/operation.js": () => Promise.resolve().then(() => (init_operation(), operation_exports)),
91785         "../behavior/paste.js": () => Promise.resolve().then(() => (init_paste(), paste_exports)),
91786         "../behavior/select.js": () => Promise.resolve().then(() => (init_select4(), select_exports)),
91787         "../core/LocationManager.js": () => Promise.resolve().then(() => (init_LocationManager(), LocationManager_exports)),
91788         "../core/context.js": () => Promise.resolve().then(() => (init_context2(), context_exports)),
91789         "../core/difference.js": () => Promise.resolve().then(() => (init_difference(), difference_exports)),
91790         "../core/file_fetcher.js": () => Promise.resolve().then(() => (init_file_fetcher(), file_fetcher_exports)),
91791         "../core/graph.js": () => Promise.resolve().then(() => (init_graph(), graph_exports)),
91792         "../core/history.js": () => Promise.resolve().then(() => (init_history(), history_exports)),
91793         "../core/index.js": () => Promise.resolve().then(() => (init_core(), core_exports)),
91794         "../core/localizer.js": () => Promise.resolve().then(() => (init_localizer(), localizer_exports)),
91795         "../core/preferences.js": () => Promise.resolve().then(() => (init_preferences(), preferences_exports)),
91796         "../core/tree.js": () => Promise.resolve().then(() => (init_tree(), tree_exports)),
91797         "../core/uploader.js": () => Promise.resolve().then(() => (init_uploader(), uploader_exports)),
91798         "../core/validation/index.js": () => Promise.resolve().then(() => (init_validation(), validation_exports)),
91799         "../core/validation/models.js": () => Promise.resolve().then(() => (init_models(), models_exports)),
91800         "../core/validator.js": () => Promise.resolve().then(() => (init_validator(), validator_exports)),
91801         "../geo/extent.js": () => Promise.resolve().then(() => (init_extent(), extent_exports)),
91802         "../geo/geo.js": () => Promise.resolve().then(() => (init_geo(), geo_exports)),
91803         "../geo/geom.js": () => Promise.resolve().then(() => (init_geom(), geom_exports)),
91804         "../geo/index.js": () => Promise.resolve().then(() => (init_geo2(), geo_exports2)),
91805         "../geo/ortho.js": () => Promise.resolve().then(() => (init_ortho(), ortho_exports)),
91806         "../geo/raw_mercator.js": () => Promise.resolve().then(() => (init_raw_mercator(), raw_mercator_exports)),
91807         "../geo/vector.js": () => Promise.resolve().then(() => (init_vector(), vector_exports)),
91808         "../globals.d.ts": () => Promise.resolve().then(() => (init_globals_d(), globals_d_exports)),
91809         "../id.js": () => Promise.resolve().then(() => (init_id2(), id_exports)),
91810         "../index.js": () => Promise.resolve().then(() => (init_index(), index_exports)),
91811         "../modes/add_area.js": () => Promise.resolve().then(() => (init_add_area(), add_area_exports)),
91812         "../modes/add_line.js": () => Promise.resolve().then(() => (init_add_line(), add_line_exports)),
91813         "../modes/add_note.js": () => Promise.resolve().then(() => (init_add_note(), add_note_exports)),
91814         "../modes/add_point.js": () => Promise.resolve().then(() => (init_add_point(), add_point_exports)),
91815         "../modes/browse.js": () => Promise.resolve().then(() => (init_browse(), browse_exports)),
91816         "../modes/drag_node.js": () => Promise.resolve().then(() => (init_drag_node(), drag_node_exports)),
91817         "../modes/drag_note.js": () => Promise.resolve().then(() => (init_drag_note(), drag_note_exports)),
91818         "../modes/draw_area.js": () => Promise.resolve().then(() => (init_draw_area(), draw_area_exports)),
91819         "../modes/draw_line.js": () => Promise.resolve().then(() => (init_draw_line(), draw_line_exports)),
91820         "../modes/index.js": () => Promise.resolve().then(() => (init_modes2(), modes_exports2)),
91821         "../modes/move.js": () => Promise.resolve().then(() => (init_move3(), move_exports3)),
91822         "../modes/rotate.js": () => Promise.resolve().then(() => (init_rotate2(), rotate_exports2)),
91823         "../modes/save.js": () => Promise.resolve().then(() => (init_save2(), save_exports2)),
91824         "../modes/select.js": () => Promise.resolve().then(() => (init_select5(), select_exports2)),
91825         "../modes/select_data.js": () => Promise.resolve().then(() => (init_select_data(), select_data_exports)),
91826         "../modes/select_error.js": () => Promise.resolve().then(() => (init_select_error(), select_error_exports)),
91827         "../modes/select_note.js": () => Promise.resolve().then(() => (init_select_note(), select_note_exports)),
91828         "../operations/circularize.js": () => Promise.resolve().then(() => (init_circularize2(), circularize_exports2)),
91829         "../operations/continue.js": () => Promise.resolve().then(() => (init_continue(), continue_exports)),
91830         "../operations/copy.js": () => Promise.resolve().then(() => (init_copy(), copy_exports)),
91831         "../operations/delete.js": () => Promise.resolve().then(() => (init_delete(), delete_exports)),
91832         "../operations/disconnect.js": () => Promise.resolve().then(() => (init_disconnect2(), disconnect_exports2)),
91833         "../operations/downgrade.js": () => Promise.resolve().then(() => (init_downgrade(), downgrade_exports)),
91834         "../operations/extract.js": () => Promise.resolve().then(() => (init_extract2(), extract_exports2)),
91835         "../operations/index.js": () => Promise.resolve().then(() => (init_operations(), operations_exports)),
91836         "../operations/merge.js": () => Promise.resolve().then(() => (init_merge6(), merge_exports2)),
91837         "../operations/move.js": () => Promise.resolve().then(() => (init_move2(), move_exports2)),
91838         "../operations/orthogonalize.js": () => Promise.resolve().then(() => (init_orthogonalize2(), orthogonalize_exports2)),
91839         "../operations/paste.js": () => Promise.resolve().then(() => (init_paste2(), paste_exports2)),
91840         "../operations/reflect.js": () => Promise.resolve().then(() => (init_reflect2(), reflect_exports2)),
91841         "../operations/reverse.js": () => Promise.resolve().then(() => (init_reverse2(), reverse_exports2)),
91842         "../operations/rotate.js": () => Promise.resolve().then(() => (init_rotate3(), rotate_exports3)),
91843         "../operations/split.js": () => Promise.resolve().then(() => (init_split2(), split_exports2)),
91844         "../operations/straighten.js": () => Promise.resolve().then(() => (init_straighten(), straighten_exports)),
91845         "../osm/changeset.js": () => Promise.resolve().then(() => (init_changeset(), changeset_exports)),
91846         "../osm/deprecated.js": () => Promise.resolve().then(() => (init_deprecated(), deprecated_exports)),
91847         "../osm/entity.js": () => Promise.resolve().then(() => (init_entity(), entity_exports)),
91848         "../osm/index.js": () => Promise.resolve().then(() => (init_osm(), osm_exports)),
91849         "../osm/intersection.js": () => Promise.resolve().then(() => (init_intersection(), intersection_exports)),
91850         "../osm/lanes.js": () => Promise.resolve().then(() => (init_lanes(), lanes_exports)),
91851         "../osm/multipolygon.js": () => Promise.resolve().then(() => (init_multipolygon(), multipolygon_exports)),
91852         "../osm/node.js": () => Promise.resolve().then(() => (init_node2(), node_exports)),
91853         "../osm/note.js": () => Promise.resolve().then(() => (init_note(), note_exports)),
91854         "../osm/qa_item.js": () => Promise.resolve().then(() => (init_qa_item(), qa_item_exports)),
91855         "../osm/relation.js": () => Promise.resolve().then(() => (init_relation(), relation_exports)),
91856         "../osm/tags.js": () => Promise.resolve().then(() => (init_tags(), tags_exports)),
91857         "../osm/way.js": () => Promise.resolve().then(() => (init_way(), way_exports)),
91858         "../presets/category.js": () => Promise.resolve().then(() => (init_category(), category_exports)),
91859         "../presets/collection.js": () => Promise.resolve().then(() => (init_collection(), collection_exports)),
91860         "../presets/field.js": () => Promise.resolve().then(() => (init_field(), field_exports)),
91861         "../presets/index.js": () => Promise.resolve().then(() => (init_presets(), presets_exports)),
91862         "../presets/preset.js": () => Promise.resolve().then(() => (init_preset(), preset_exports)),
91863         "../renderer/background.js": () => Promise.resolve().then(() => (init_background2(), background_exports2)),
91864         "../renderer/background_source.js": () => Promise.resolve().then(() => (init_background_source(), background_source_exports)),
91865         "../renderer/features.js": () => Promise.resolve().then(() => (init_features(), features_exports)),
91866         "../renderer/index.js": () => Promise.resolve().then(() => (init_renderer(), renderer_exports)),
91867         "../renderer/map.js": () => Promise.resolve().then(() => (init_map(), map_exports)),
91868         "../renderer/photos.js": () => Promise.resolve().then(() => (init_photos(), photos_exports)),
91869         "../renderer/tile_layer.js": () => Promise.resolve().then(() => (init_tile_layer(), tile_layer_exports)),
91870         "../services/index.js": () => Promise.resolve().then(() => (init_services(), services_exports)),
91871         "../services/kartaview.js": () => Promise.resolve().then(() => (init_kartaview(), kartaview_exports)),
91872         "../services/keepRight.js": () => Promise.resolve().then(() => (init_keepRight(), keepRight_exports)),
91873         "../services/mapilio.js": () => Promise.resolve().then(() => (init_mapilio(), mapilio_exports)),
91874         "../services/mapillary.js": () => Promise.resolve().then(() => (init_mapillary(), mapillary_exports)),
91875         "../services/maprules.js": () => Promise.resolve().then(() => (init_maprules(), maprules_exports)),
91876         "../services/nominatim.js": () => Promise.resolve().then(() => (init_nominatim(), nominatim_exports)),
91877         "../services/nsi.js": () => Promise.resolve().then(() => (init_nsi(), nsi_exports)),
91878         "../services/osm.js": () => Promise.resolve().then(() => (init_osm3(), osm_exports3)),
91879         "../services/osm_wikibase.js": () => Promise.resolve().then(() => (init_osm_wikibase(), osm_wikibase_exports)),
91880         "../services/osmose.js": () => Promise.resolve().then(() => (init_osmose(), osmose_exports)),
91881         "../services/pannellum_photo.js": () => Promise.resolve().then(() => (init_pannellum_photo(), pannellum_photo_exports)),
91882         "../services/panoramax.js": () => Promise.resolve().then(() => (init_panoramax(), panoramax_exports)),
91883         "../services/plane_photo.js": () => Promise.resolve().then(() => (init_plane_photo(), plane_photo_exports)),
91884         "../services/streetside.js": () => Promise.resolve().then(() => (init_streetside2(), streetside_exports2)),
91885         "../services/taginfo.js": () => Promise.resolve().then(() => (init_taginfo(), taginfo_exports)),
91886         "../services/vector_tile.js": () => Promise.resolve().then(() => (init_vector_tile2(), vector_tile_exports)),
91887         "../services/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder2(), vegbilder_exports2)),
91888         "../services/wikidata.js": () => Promise.resolve().then(() => (init_wikidata2(), wikidata_exports2)),
91889         "../services/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia2(), wikipedia_exports2)),
91890         "../svg/areas.js": () => Promise.resolve().then(() => (init_areas(), areas_exports)),
91891         "../svg/data.js": () => Promise.resolve().then(() => (init_data2(), data_exports)),
91892         "../svg/debug.js": () => Promise.resolve().then(() => (init_debug(), debug_exports)),
91893         "../svg/defs.js": () => Promise.resolve().then(() => (init_defs(), defs_exports)),
91894         "../svg/geolocate.js": () => Promise.resolve().then(() => (init_geolocate(), geolocate_exports)),
91895         "../svg/helpers.js": () => Promise.resolve().then(() => (init_helpers(), helpers_exports)),
91896         "../svg/icon.js": () => Promise.resolve().then(() => (init_icon(), icon_exports)),
91897         "../svg/index.js": () => Promise.resolve().then(() => (init_svg(), svg_exports)),
91898         "../svg/kartaview_images.js": () => Promise.resolve().then(() => (init_kartaview_images(), kartaview_images_exports)),
91899         "../svg/keepRight.js": () => Promise.resolve().then(() => (init_keepRight2(), keepRight_exports2)),
91900         "../svg/labels.js": () => Promise.resolve().then(() => (init_labels(), labels_exports)),
91901         "../svg/layers.js": () => Promise.resolve().then(() => (init_layers(), layers_exports)),
91902         "../svg/lines.js": () => Promise.resolve().then(() => (init_lines(), lines_exports)),
91903         "../svg/local_photos.js": () => Promise.resolve().then(() => (init_local_photos(), local_photos_exports)),
91904         "../svg/mapilio_images.js": () => Promise.resolve().then(() => (init_mapilio_images(), mapilio_images_exports)),
91905         "../svg/mapillary_images.js": () => Promise.resolve().then(() => (init_mapillary_images(), mapillary_images_exports)),
91906         "../svg/mapillary_map_features.js": () => Promise.resolve().then(() => (init_mapillary_map_features(), mapillary_map_features_exports)),
91907         "../svg/mapillary_position.js": () => Promise.resolve().then(() => (init_mapillary_position(), mapillary_position_exports)),
91908         "../svg/mapillary_signs.js": () => Promise.resolve().then(() => (init_mapillary_signs(), mapillary_signs_exports)),
91909         "../svg/midpoints.js": () => Promise.resolve().then(() => (init_midpoints(), midpoints_exports)),
91910         "../svg/notes.js": () => Promise.resolve().then(() => (init_notes(), notes_exports)),
91911         "../svg/osm.js": () => Promise.resolve().then(() => (init_osm2(), osm_exports2)),
91912         "../svg/osmose.js": () => Promise.resolve().then(() => (init_osmose2(), osmose_exports2)),
91913         "../svg/panoramax_images.js": () => Promise.resolve().then(() => (init_panoramax_images(), panoramax_images_exports)),
91914         "../svg/points.js": () => Promise.resolve().then(() => (init_points(), points_exports)),
91915         "../svg/streetside.js": () => Promise.resolve().then(() => (init_streetside(), streetside_exports)),
91916         "../svg/tag_classes.js": () => Promise.resolve().then(() => (init_tag_classes(), tag_classes_exports)),
91917         "../svg/tag_pattern.js": () => Promise.resolve().then(() => (init_tag_pattern(), tag_pattern_exports)),
91918         "../svg/touch.js": () => Promise.resolve().then(() => (init_touch(), touch_exports)),
91919         "../svg/turns.js": () => Promise.resolve().then(() => (init_turns(), turns_exports)),
91920         "../svg/vegbilder.js": () => Promise.resolve().then(() => (init_vegbilder(), vegbilder_exports)),
91921         "../svg/vertices.js": () => Promise.resolve().then(() => (init_vertices(), vertices_exports)),
91922         "../ui/account.js": () => Promise.resolve().then(() => (init_account(), account_exports)),
91923         "../ui/attribution.js": () => Promise.resolve().then(() => (init_attribution(), attribution_exports)),
91924         "../ui/changeset_editor.js": () => Promise.resolve().then(() => (init_changeset_editor(), changeset_editor_exports)),
91925         "../ui/cmd.js": () => Promise.resolve().then(() => (init_cmd(), cmd_exports)),
91926         "../ui/combobox.js": () => Promise.resolve().then(() => (init_combobox(), combobox_exports)),
91927         "../ui/commit.js": () => Promise.resolve().then(() => (init_commit(), commit_exports)),
91928         "../ui/commit_warnings.js": () => Promise.resolve().then(() => (init_commit_warnings(), commit_warnings_exports)),
91929         "../ui/confirm.js": () => Promise.resolve().then(() => (init_confirm(), confirm_exports)),
91930         "../ui/conflicts.js": () => Promise.resolve().then(() => (init_conflicts(), conflicts_exports)),
91931         "../ui/contributors.js": () => Promise.resolve().then(() => (init_contributors(), contributors_exports)),
91932         "../ui/curtain.js": () => Promise.resolve().then(() => (init_curtain(), curtain_exports)),
91933         "../ui/data_editor.js": () => Promise.resolve().then(() => (init_data_editor(), data_editor_exports)),
91934         "../ui/data_header.js": () => Promise.resolve().then(() => (init_data_header(), data_header_exports)),
91935         "../ui/disclosure.js": () => Promise.resolve().then(() => (init_disclosure(), disclosure_exports)),
91936         "../ui/edit_menu.js": () => Promise.resolve().then(() => (init_edit_menu(), edit_menu_exports)),
91937         "../ui/entity_editor.js": () => Promise.resolve().then(() => (init_entity_editor(), entity_editor_exports)),
91938         "../ui/feature_info.js": () => Promise.resolve().then(() => (init_feature_info(), feature_info_exports)),
91939         "../ui/feature_list.js": () => Promise.resolve().then(() => (init_feature_list(), feature_list_exports)),
91940         "../ui/field.js": () => Promise.resolve().then(() => (init_field2(), field_exports2)),
91941         "../ui/field_help.js": () => Promise.resolve().then(() => (init_field_help(), field_help_exports)),
91942         "../ui/fields/access.js": () => Promise.resolve().then(() => (init_access(), access_exports)),
91943         "../ui/fields/address.js": () => Promise.resolve().then(() => (init_address(), address_exports)),
91944         "../ui/fields/check.js": () => Promise.resolve().then(() => (init_check(), check_exports)),
91945         "../ui/fields/combo.js": () => Promise.resolve().then(() => (init_combo(), combo_exports)),
91946         "../ui/fields/directional_combo.js": () => Promise.resolve().then(() => (init_directional_combo(), directional_combo_exports)),
91947         "../ui/fields/index.js": () => Promise.resolve().then(() => (init_fields(), fields_exports)),
91948         "../ui/fields/input.js": () => Promise.resolve().then(() => (init_input(), input_exports)),
91949         "../ui/fields/lanes.js": () => Promise.resolve().then(() => (init_lanes2(), lanes_exports2)),
91950         "../ui/fields/localized.js": () => Promise.resolve().then(() => (init_localized(), localized_exports)),
91951         "../ui/fields/radio.js": () => Promise.resolve().then(() => (init_radio(), radio_exports)),
91952         "../ui/fields/restrictions.js": () => Promise.resolve().then(() => (init_restrictions(), restrictions_exports)),
91953         "../ui/fields/roadheight.js": () => Promise.resolve().then(() => (init_roadheight(), roadheight_exports)),
91954         "../ui/fields/roadspeed.js": () => Promise.resolve().then(() => (init_roadspeed(), roadspeed_exports)),
91955         "../ui/fields/textarea.js": () => Promise.resolve().then(() => (init_textarea(), textarea_exports)),
91956         "../ui/fields/wikidata.js": () => Promise.resolve().then(() => (init_wikidata(), wikidata_exports)),
91957         "../ui/fields/wikipedia.js": () => Promise.resolve().then(() => (init_wikipedia(), wikipedia_exports)),
91958         "../ui/flash.js": () => Promise.resolve().then(() => (init_flash(), flash_exports)),
91959         "../ui/form_fields.js": () => Promise.resolve().then(() => (init_form_fields(), form_fields_exports)),
91960         "../ui/full_screen.js": () => Promise.resolve().then(() => (init_full_screen(), full_screen_exports)),
91961         "../ui/geolocate.js": () => Promise.resolve().then(() => (init_geolocate2(), geolocate_exports2)),
91962         "../ui/index.js": () => Promise.resolve().then(() => (init_ui(), ui_exports)),
91963         "../ui/info.js": () => Promise.resolve().then(() => (init_info(), info_exports)),
91964         "../ui/init.js": () => Promise.resolve().then(() => (init_init2(), init_exports)),
91965         "../ui/inspector.js": () => Promise.resolve().then(() => (init_inspector(), inspector_exports)),
91966         "../ui/intro/area.js": () => Promise.resolve().then(() => (init_area4(), area_exports)),
91967         "../ui/intro/building.js": () => Promise.resolve().then(() => (init_building(), building_exports)),
91968         "../ui/intro/helper.js": () => Promise.resolve().then(() => (init_helper(), helper_exports)),
91969         "../ui/intro/index.js": () => Promise.resolve().then(() => (init_intro2(), intro_exports2)),
91970         "../ui/intro/intro.js": () => Promise.resolve().then(() => (init_intro(), intro_exports)),
91971         "../ui/intro/line.js": () => Promise.resolve().then(() => (init_line2(), line_exports)),
91972         "../ui/intro/navigation.js": () => Promise.resolve().then(() => (init_navigation(), navigation_exports)),
91973         "../ui/intro/point.js": () => Promise.resolve().then(() => (init_point(), point_exports)),
91974         "../ui/intro/start_editing.js": () => Promise.resolve().then(() => (init_start_editing(), start_editing_exports)),
91975         "../ui/intro/welcome.js": () => Promise.resolve().then(() => (init_welcome(), welcome_exports)),
91976         "../ui/issues_info.js": () => Promise.resolve().then(() => (init_issues_info(), issues_info_exports)),
91977         "../ui/keepRight_details.js": () => Promise.resolve().then(() => (init_keepRight_details(), keepRight_details_exports)),
91978         "../ui/keepRight_editor.js": () => Promise.resolve().then(() => (init_keepRight_editor(), keepRight_editor_exports)),
91979         "../ui/keepRight_header.js": () => Promise.resolve().then(() => (init_keepRight_header(), keepRight_header_exports)),
91980         "../ui/lasso.js": () => Promise.resolve().then(() => (init_lasso(), lasso_exports)),
91981         "../ui/length_indicator.js": () => Promise.resolve().then(() => (init_length_indicator(), length_indicator_exports)),
91982         "../ui/loading.js": () => Promise.resolve().then(() => (init_loading(), loading_exports)),
91983         "../ui/map_in_map.js": () => Promise.resolve().then(() => (init_map_in_map(), map_in_map_exports)),
91984         "../ui/modal.js": () => Promise.resolve().then(() => (init_modal(), modal_exports)),
91985         "../ui/note_comments.js": () => Promise.resolve().then(() => (init_note_comments(), note_comments_exports)),
91986         "../ui/note_editor.js": () => Promise.resolve().then(() => (init_note_editor(), note_editor_exports)),
91987         "../ui/note_header.js": () => Promise.resolve().then(() => (init_note_header(), note_header_exports)),
91988         "../ui/note_report.js": () => Promise.resolve().then(() => (init_note_report(), note_report_exports)),
91989         "../ui/notice.js": () => Promise.resolve().then(() => (init_notice(), notice_exports)),
91990         "../ui/osmose_details.js": () => Promise.resolve().then(() => (init_osmose_details(), osmose_details_exports)),
91991         "../ui/osmose_editor.js": () => Promise.resolve().then(() => (init_osmose_editor(), osmose_editor_exports)),
91992         "../ui/osmose_header.js": () => Promise.resolve().then(() => (init_osmose_header(), osmose_header_exports)),
91993         "../ui/pane.js": () => Promise.resolve().then(() => (init_pane(), pane_exports)),
91994         "../ui/panels/background.js": () => Promise.resolve().then(() => (init_background(), background_exports)),
91995         "../ui/panels/history.js": () => Promise.resolve().then(() => (init_history2(), history_exports2)),
91996         "../ui/panels/index.js": () => Promise.resolve().then(() => (init_panels(), panels_exports)),
91997         "../ui/panels/location.js": () => Promise.resolve().then(() => (init_location(), location_exports)),
91998         "../ui/panels/measurement.js": () => Promise.resolve().then(() => (init_measurement(), measurement_exports)),
91999         "../ui/panes/background.js": () => Promise.resolve().then(() => (init_background3(), background_exports3)),
92000         "../ui/panes/help.js": () => Promise.resolve().then(() => (init_help(), help_exports)),
92001         "../ui/panes/index.js": () => Promise.resolve().then(() => (init_panes(), panes_exports)),
92002         "../ui/panes/issues.js": () => Promise.resolve().then(() => (init_issues(), issues_exports)),
92003         "../ui/panes/map_data.js": () => Promise.resolve().then(() => (init_map_data(), map_data_exports)),
92004         "../ui/panes/preferences.js": () => Promise.resolve().then(() => (init_preferences2(), preferences_exports2)),
92005         "../ui/photoviewer.js": () => Promise.resolve().then(() => (init_photoviewer(), photoviewer_exports)),
92006         "../ui/popover.js": () => Promise.resolve().then(() => (init_popover(), popover_exports)),
92007         "../ui/preset_icon.js": () => Promise.resolve().then(() => (init_preset_icon(), preset_icon_exports)),
92008         "../ui/preset_list.js": () => Promise.resolve().then(() => (init_preset_list(), preset_list_exports)),
92009         "../ui/restore.js": () => Promise.resolve().then(() => (init_restore(), restore_exports)),
92010         "../ui/scale.js": () => Promise.resolve().then(() => (init_scale2(), scale_exports2)),
92011         "../ui/section.js": () => Promise.resolve().then(() => (init_section(), section_exports)),
92012         "../ui/sections/background_display_options.js": () => Promise.resolve().then(() => (init_background_display_options(), background_display_options_exports)),
92013         "../ui/sections/background_list.js": () => Promise.resolve().then(() => (init_background_list(), background_list_exports)),
92014         "../ui/sections/background_offset.js": () => Promise.resolve().then(() => (init_background_offset(), background_offset_exports)),
92015         "../ui/sections/changes.js": () => Promise.resolve().then(() => (init_changes(), changes_exports)),
92016         "../ui/sections/data_layers.js": () => Promise.resolve().then(() => (init_data_layers(), data_layers_exports)),
92017         "../ui/sections/entity_issues.js": () => Promise.resolve().then(() => (init_entity_issues(), entity_issues_exports)),
92018         "../ui/sections/feature_type.js": () => Promise.resolve().then(() => (init_feature_type(), feature_type_exports)),
92019         "../ui/sections/index.js": () => Promise.resolve().then(() => (init_sections(), sections_exports)),
92020         "../ui/sections/map_features.js": () => Promise.resolve().then(() => (init_map_features(), map_features_exports)),
92021         "../ui/sections/map_style_options.js": () => Promise.resolve().then(() => (init_map_style_options(), map_style_options_exports)),
92022         "../ui/sections/overlay_list.js": () => Promise.resolve().then(() => (init_overlay_list(), overlay_list_exports)),
92023         "../ui/sections/photo_overlays.js": () => Promise.resolve().then(() => (init_photo_overlays(), photo_overlays_exports)),
92024         "../ui/sections/preset_fields.js": () => Promise.resolve().then(() => (init_preset_fields(), preset_fields_exports)),
92025         "../ui/sections/privacy.js": () => Promise.resolve().then(() => (init_privacy(), privacy_exports)),
92026         "../ui/sections/raw_member_editor.js": () => Promise.resolve().then(() => (init_raw_member_editor(), raw_member_editor_exports)),
92027         "../ui/sections/raw_membership_editor.js": () => Promise.resolve().then(() => (init_raw_membership_editor(), raw_membership_editor_exports)),
92028         "../ui/sections/raw_tag_editor.js": () => Promise.resolve().then(() => (init_raw_tag_editor(), raw_tag_editor_exports)),
92029         "../ui/sections/selection_list.js": () => Promise.resolve().then(() => (init_selection_list(), selection_list_exports)),
92030         "../ui/sections/validation_issues.js": () => Promise.resolve().then(() => (init_validation_issues(), validation_issues_exports)),
92031         "../ui/sections/validation_options.js": () => Promise.resolve().then(() => (init_validation_options(), validation_options_exports)),
92032         "../ui/sections/validation_rules.js": () => Promise.resolve().then(() => (init_validation_rules(), validation_rules_exports)),
92033         "../ui/sections/validation_status.js": () => Promise.resolve().then(() => (init_validation_status(), validation_status_exports)),
92034         "../ui/settings/custom_background.js": () => Promise.resolve().then(() => (init_custom_background(), custom_background_exports)),
92035         "../ui/settings/custom_data.js": () => Promise.resolve().then(() => (init_custom_data(), custom_data_exports)),
92036         "../ui/settings/index.js": () => Promise.resolve().then(() => (init_settings(), settings_exports)),
92037         "../ui/settings/local_photos.js": () => Promise.resolve().then(() => (init_local_photos2(), local_photos_exports2)),
92038         "../ui/shortcuts.js": () => Promise.resolve().then(() => (init_shortcuts(), shortcuts_exports)),
92039         "../ui/sidebar.js": () => Promise.resolve().then(() => (init_sidebar(), sidebar_exports)),
92040         "../ui/source_switch.js": () => Promise.resolve().then(() => (init_source_switch(), source_switch_exports)),
92041         "../ui/spinner.js": () => Promise.resolve().then(() => (init_spinner(), spinner_exports)),
92042         "../ui/splash.js": () => Promise.resolve().then(() => (init_splash(), splash_exports)),
92043         "../ui/status.js": () => Promise.resolve().then(() => (init_status(), status_exports)),
92044         "../ui/success.js": () => Promise.resolve().then(() => (init_success(), success_exports)),
92045         "../ui/tag_reference.js": () => Promise.resolve().then(() => (init_tag_reference(), tag_reference_exports)),
92046         "../ui/toggle.js": () => Promise.resolve().then(() => (init_toggle(), toggle_exports)),
92047         "../ui/tools/index.js": () => Promise.resolve().then(() => (init_tools(), tools_exports)),
92048         "../ui/tools/modes.js": () => Promise.resolve().then(() => (init_modes(), modes_exports)),
92049         "../ui/tools/notes.js": () => Promise.resolve().then(() => (init_notes2(), notes_exports2)),
92050         "../ui/tools/save.js": () => Promise.resolve().then(() => (init_save(), save_exports)),
92051         "../ui/tools/sidebar_toggle.js": () => Promise.resolve().then(() => (init_sidebar_toggle(), sidebar_toggle_exports)),
92052         "../ui/tools/undo_redo.js": () => Promise.resolve().then(() => (init_undo_redo(), undo_redo_exports)),
92053         "../ui/tooltip.js": () => Promise.resolve().then(() => (init_tooltip(), tooltip_exports)),
92054         "../ui/top_toolbar.js": () => Promise.resolve().then(() => (init_top_toolbar(), top_toolbar_exports)),
92055         "../ui/version.js": () => Promise.resolve().then(() => (init_version(), version_exports)),
92056         "../ui/view_on_keepRight.js": () => Promise.resolve().then(() => (init_view_on_keepRight(), view_on_keepRight_exports)),
92057         "../ui/view_on_osm.js": () => Promise.resolve().then(() => (init_view_on_osm(), view_on_osm_exports)),
92058         "../ui/view_on_osmose.js": () => Promise.resolve().then(() => (init_view_on_osmose(), view_on_osmose_exports)),
92059         "../ui/zoom.js": () => Promise.resolve().then(() => (init_zoom3(), zoom_exports)),
92060         "../ui/zoom_to_selection.js": () => Promise.resolve().then(() => (init_zoom_to_selection(), zoom_to_selection_exports)),
92061         "../util/IntervalTasksQueue.js": () => Promise.resolve().then(() => (init_IntervalTasksQueue(), IntervalTasksQueue_exports)),
92062         "../util/aes.js": () => Promise.resolve().then(() => (init_aes(), aes_exports)),
92063         "../util/array.js": () => Promise.resolve().then(() => (init_array3(), array_exports)),
92064         "../util/bind_once.js": () => Promise.resolve().then(() => (init_bind_once(), bind_once_exports)),
92065         "../util/clean_tags.js": () => Promise.resolve().then(() => (init_clean_tags(), clean_tags_exports)),
92066         "../util/detect.js": () => Promise.resolve().then(() => (init_detect(), detect_exports)),
92067         "../util/dimensions.js": () => Promise.resolve().then(() => (init_dimensions(), dimensions_exports)),
92068         "../util/double_up.js": () => Promise.resolve().then(() => (init_double_up(), double_up_exports)),
92069         "../util/get_set_value.js": () => Promise.resolve().then(() => (init_get_set_value(), get_set_value_exports)),
92070         "../util/index.js": () => Promise.resolve().then(() => (init_util(), util_exports)),
92071         "../util/jxon.js": () => Promise.resolve().then(() => (init_jxon(), jxon_exports)),
92072         "../util/keybinding.js": () => Promise.resolve().then(() => (init_keybinding(), keybinding_exports)),
92073         "../util/object.js": () => Promise.resolve().then(() => (init_object2(), object_exports)),
92074         "../util/rebind.js": () => Promise.resolve().then(() => (init_rebind(), rebind_exports)),
92075         "../util/session_mutex.js": () => Promise.resolve().then(() => (init_session_mutex(), session_mutex_exports)),
92076         "../util/svg_paths_rtl_fix.js": () => Promise.resolve().then(() => (init_svg_paths_rtl_fix(), svg_paths_rtl_fix_exports)),
92077         "../util/tiler.js": () => Promise.resolve().then(() => (init_tiler(), tiler_exports)),
92078         "../util/trigger_event.js": () => Promise.resolve().then(() => (init_trigger_event(), trigger_event_exports)),
92079         "../util/units.js": () => Promise.resolve().then(() => (init_units(), units_exports)),
92080         "../util/util.js": () => Promise.resolve().then(() => (init_util2(), util_exports2)),
92081         "../util/utilDisplayLabel.js": () => Promise.resolve().then(() => (init_utilDisplayLabel(), utilDisplayLabel_exports)),
92082         "../util/zoom_pan.js": () => Promise.resolve().then(() => (init_zoom_pan(), zoom_pan_exports)),
92083         "../validations/almost_junction.js": () => Promise.resolve().then(() => (init_almost_junction(), almost_junction_exports)),
92084         "../validations/close_nodes.js": () => Promise.resolve().then(() => (init_close_nodes(), close_nodes_exports)),
92085         "../validations/crossing_ways.js": () => Promise.resolve().then(() => (init_crossing_ways(), crossing_ways_exports)),
92086         "../validations/disconnected_way.js": () => Promise.resolve().then(() => (init_disconnected_way(), disconnected_way_exports)),
92087         "../validations/help_request.js": () => Promise.resolve().then(() => (init_help_request(), help_request_exports)),
92088         "../validations/impossible_oneway.js": () => Promise.resolve().then(() => (init_impossible_oneway(), impossible_oneway_exports)),
92089         "../validations/incompatible_source.js": () => Promise.resolve().then(() => (init_incompatible_source(), incompatible_source_exports)),
92090         "../validations/index.js": () => Promise.resolve().then(() => (init_validations(), validations_exports)),
92091         "../validations/invalid_format.js": () => Promise.resolve().then(() => (init_invalid_format(), invalid_format_exports)),
92092         "../validations/maprules.js": () => Promise.resolve().then(() => (init_maprules2(), maprules_exports2)),
92093         "../validations/mismatched_geometry.js": () => Promise.resolve().then(() => (init_mismatched_geometry(), mismatched_geometry_exports)),
92094         "../validations/missing_role.js": () => Promise.resolve().then(() => (init_missing_role(), missing_role_exports)),
92095         "../validations/missing_tag.js": () => Promise.resolve().then(() => (init_missing_tag(), missing_tag_exports)),
92096         "../validations/mutually_exclusive_tags.js": () => Promise.resolve().then(() => (init_mutually_exclusive_tags(), mutually_exclusive_tags_exports)),
92097         "../validations/osm_api_limits.js": () => Promise.resolve().then(() => (init_osm_api_limits(), osm_api_limits_exports)),
92098         "../validations/outdated_tags.js": () => Promise.resolve().then(() => (init_outdated_tags(), outdated_tags_exports)),
92099         "../validations/private_data.js": () => Promise.resolve().then(() => (init_private_data(), private_data_exports)),
92100         "../validations/suspicious_name.js": () => Promise.resolve().then(() => (init_suspicious_name(), suspicious_name_exports)),
92101         "../validations/unsquare_way.js": () => Promise.resolve().then(() => (init_unsquare_way(), unsquare_way_exports))
92102       });
92103     }
92104   });
92105
92106   // modules/core/file_fetcher.js
92107   var file_fetcher_exports = {};
92108   __export(file_fetcher_exports, {
92109     coreFileFetcher: () => coreFileFetcher,
92110     fileFetcher: () => _mainFileFetcher
92111   });
92112   function coreFileFetcher() {
92113     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
92114     const v2 = (0, import_vparse2.default)(ociVersion);
92115     const ociVersionMinor = `${v2.major}.${v2.minor}`;
92116     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
92117     let _this = {};
92118     let _inflight4 = {};
92119     let _fileMap = {
92120       "address_formats": "data/address_formats.min.json",
92121       "imagery": "data/imagery.min.json",
92122       "intro_graph": "data/intro_graph.min.json",
92123       "keepRight": "data/keepRight.min.json",
92124       "languages": "data/languages.min.json",
92125       "locales": "locales/index.min.json",
92126       "phone_formats": "data/phone_formats.min.json",
92127       "qa_data": "data/qa_data.min.json",
92128       "shortcuts": "data/shortcuts.min.json",
92129       "territory_languages": "data/territory_languages.min.json",
92130       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
92131       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
92132       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
92133       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
92134       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
92135       "discarded": presetsCdnUrl + "dist/discarded.min.json",
92136       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
92137       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
92138       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
92139       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
92140       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.2") + "data/wikipedia.min.json"
92141     };
92142     let _cachedData = {};
92143     _this.cache = () => _cachedData;
92144     _this.get = (which) => {
92145       if (_cachedData[which]) {
92146         return Promise.resolve(_cachedData[which]);
92147       }
92148       const file = _fileMap[which];
92149       const url = file && _this.asset(file);
92150       if (!url) {
92151         return Promise.reject(`Unknown data file for "${which}"`);
92152       }
92153       if (url.includes("{presets_version}")) {
92154         return _this.get("presets_package").then((result) => {
92155           const presetsVersion2 = result.version;
92156           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
92157         });
92158       } else {
92159         return getUrl(url, which);
92160       }
92161     };
92162     function getUrl(url, which) {
92163       let prom = _inflight4[url];
92164       if (!prom) {
92165         _inflight4[url] = prom = (window.VITEST ? globImport(`../${url}`) : fetch(url)).then((response) => {
92166           if (window.VITEST) return response.default;
92167           if (!response.ok || !response.json) {
92168             throw new Error(response.status + " " + response.statusText);
92169           }
92170           if (response.status === 204 || response.status === 205) return;
92171           return response.json();
92172         }).then((result) => {
92173           delete _inflight4[url];
92174           if (!result) {
92175             throw new Error(`No data loaded for "${which}"`);
92176           }
92177           _cachedData[which] = result;
92178           return result;
92179         }).catch((err) => {
92180           delete _inflight4[url];
92181           throw err;
92182         });
92183       }
92184       return prom;
92185     }
92186     _this.fileMap = function(val) {
92187       if (!arguments.length) return _fileMap;
92188       _fileMap = val;
92189       return _this;
92190     };
92191     let _assetPath = "";
92192     _this.assetPath = function(val) {
92193       if (!arguments.length) return _assetPath;
92194       _assetPath = val;
92195       return _this;
92196     };
92197     let _assetMap = {};
92198     _this.assetMap = function(val) {
92199       if (!arguments.length) return _assetMap;
92200       _assetMap = val;
92201       return _this;
92202     };
92203     _this.asset = (val) => {
92204       if (/^http(s)?:\/\//i.test(val)) return val;
92205       const filename = _assetPath + val;
92206       return _assetMap[filename] || filename;
92207     };
92208     return _this;
92209   }
92210   var import_vparse2, _mainFileFetcher;
92211   var init_file_fetcher = __esm({
92212     "modules/core/file_fetcher.js"() {
92213       "use strict";
92214       import_vparse2 = __toESM(require_vparse());
92215       init_id();
92216       init_package();
92217       init_();
92218       _mainFileFetcher = coreFileFetcher();
92219     }
92220   });
92221
92222   // modules/core/localizer.js
92223   var localizer_exports = {};
92224   __export(localizer_exports, {
92225     coreLocalizer: () => coreLocalizer,
92226     localizer: () => _mainLocalizer,
92227     t: () => _t
92228   });
92229   function coreLocalizer() {
92230     let localizer = {};
92231     let _dataLanguages = {};
92232     let _dataLocales = {};
92233     let _localeStrings = {};
92234     let _localeCode = "en-US";
92235     let _localeCodes = ["en-US", "en"];
92236     let _languageCode = "en";
92237     let _textDirection = "ltr";
92238     let _usesMetric = false;
92239     let _languageNames = {};
92240     let _scriptNames = {};
92241     localizer.localeCode = () => _localeCode;
92242     localizer.localeCodes = () => _localeCodes;
92243     localizer.languageCode = () => _languageCode;
92244     localizer.textDirection = () => _textDirection;
92245     localizer.usesMetric = () => _usesMetric;
92246     localizer.languageNames = () => _languageNames;
92247     localizer.scriptNames = () => _scriptNames;
92248     let _preferredLocaleCodes = [];
92249     localizer.preferredLocaleCodes = function(codes) {
92250       if (!arguments.length) return _preferredLocaleCodes;
92251       if (typeof codes === "string") {
92252         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
92253       } else {
92254         _preferredLocaleCodes = codes;
92255       }
92256       return localizer;
92257     };
92258     var _loadPromise;
92259     localizer.ensureLoaded = () => {
92260       if (_loadPromise) return _loadPromise;
92261       let filesToFetch = [
92262         "languages",
92263         // load the list of languages
92264         "locales"
92265         // load the list of supported locales
92266       ];
92267       const localeDirs = {
92268         general: "locales",
92269         tagging: presetsCdnUrl + "dist/translations"
92270       };
92271       let fileMap = _mainFileFetcher.fileMap();
92272       for (let scopeId in localeDirs) {
92273         const key = `locales_index_${scopeId}`;
92274         if (!fileMap[key]) {
92275           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
92276         }
92277         filesToFetch.push(key);
92278       }
92279       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
92280         _dataLanguages = results[0];
92281         _dataLocales = results[1];
92282         let indexes = results.slice(2);
92283         _localeCodes = localizer.localesToUseFrom(_dataLocales);
92284         _localeCode = _localeCodes[0];
92285         let loadStringsPromises = [];
92286         indexes.forEach((index, i3) => {
92287           const fullCoverageIndex = _localeCodes.findIndex(function(locale3) {
92288             return index[locale3] && index[locale3].pct === 1;
92289           });
92290           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
92291             let scopeId = Object.keys(localeDirs)[i3];
92292             let directory = Object.values(localeDirs)[i3];
92293             if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
92294           });
92295         });
92296         return Promise.all(loadStringsPromises);
92297       }).then(() => {
92298         updateForCurrentLocale();
92299       }).catch((err) => console.error(err));
92300     };
92301     localizer.localesToUseFrom = (supportedLocales) => {
92302       const requestedLocales = [
92303         ..._preferredLocaleCodes || [],
92304         ...utilDetect().browserLocales,
92305         // List of locales preferred by the browser in priority order.
92306         "en"
92307         // fallback to English since it's the only guaranteed complete language
92308       ];
92309       let toUse = [];
92310       for (const locale3 of requestedLocales) {
92311         if (supportedLocales[locale3]) toUse.push(locale3);
92312         if ("Intl" in window && "Locale" in window.Intl) {
92313           const localeObj = new Intl.Locale(locale3);
92314           const withoutScript = `${localeObj.language}-${localeObj.region}`;
92315           const base = localeObj.language;
92316           if (supportedLocales[withoutScript]) toUse.push(withoutScript);
92317           if (supportedLocales[base]) toUse.push(base);
92318         } else if (locale3.includes("-")) {
92319           let langPart = locale3.split("-")[0];
92320           if (supportedLocales[langPart]) toUse.push(langPart);
92321         }
92322       }
92323       return utilArrayUniq(toUse);
92324     };
92325     function updateForCurrentLocale() {
92326       if (!_localeCode) return;
92327       _languageCode = _localeCode.split("-")[0];
92328       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
92329       const hash2 = utilStringQs(window.location.hash);
92330       if (hash2.rtl === "true") {
92331         _textDirection = "rtl";
92332       } else if (hash2.rtl === "false") {
92333         _textDirection = "ltr";
92334       } else {
92335         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
92336       }
92337       let locale3 = _localeCode;
92338       if (locale3.toLowerCase() === "en-us") locale3 = "en";
92339       _languageNames = _localeStrings.general[locale3].languageNames || _localeStrings.general[_languageCode].languageNames;
92340       _scriptNames = _localeStrings.general[locale3].scriptNames || _localeStrings.general[_languageCode].scriptNames;
92341       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
92342     }
92343     localizer.loadLocale = (locale3, scopeId, directory) => {
92344       if (locale3.toLowerCase() === "en-us") locale3 = "en";
92345       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale3]) {
92346         return Promise.resolve(locale3);
92347       }
92348       let fileMap = _mainFileFetcher.fileMap();
92349       const key = `locale_${scopeId}_${locale3}`;
92350       if (!fileMap[key]) {
92351         fileMap[key] = `${directory}/${locale3}.min.json`;
92352       }
92353       return _mainFileFetcher.get(key).then((d2) => {
92354         if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
92355         _localeStrings[scopeId][locale3] = d2[locale3];
92356         return locale3;
92357       });
92358     };
92359     localizer.pluralRule = function(number3) {
92360       return pluralRule(number3, _localeCode);
92361     };
92362     function pluralRule(number3, localeCode) {
92363       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
92364       if (rules) {
92365         return rules.select(number3);
92366       }
92367       if (number3 === 1) return "one";
92368       return "other";
92369     }
92370     localizer.tInfo = function(origStringId, replacements, locale3) {
92371       let stringId = origStringId.trim();
92372       let scopeId = "general";
92373       if (stringId[0] === "_") {
92374         let split = stringId.split(".");
92375         scopeId = split[0].slice(1);
92376         stringId = split.slice(1).join(".");
92377       }
92378       locale3 = locale3 || _localeCode;
92379       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
92380       let stringsKey = locale3;
92381       if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
92382       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
92383       while (result !== void 0 && path.length) {
92384         result = result[path.pop()];
92385       }
92386       if (result !== void 0) {
92387         if (replacements) {
92388           if (typeof result === "object" && Object.keys(result).length) {
92389             const number3 = Object.values(replacements).find(function(value) {
92390               return typeof value === "number";
92391             });
92392             if (number3 !== void 0) {
92393               const rule = pluralRule(number3, locale3);
92394               if (result[rule]) {
92395                 result = result[rule];
92396               } else {
92397                 result = Object.values(result)[0];
92398               }
92399             }
92400           }
92401           if (typeof result === "string") {
92402             for (let key in replacements) {
92403               let value = replacements[key];
92404               if (typeof value === "number") {
92405                 if (value.toLocaleString) {
92406                   value = value.toLocaleString(locale3, {
92407                     style: "decimal",
92408                     useGrouping: true,
92409                     minimumFractionDigits: 0
92410                   });
92411                 } else {
92412                   value = value.toString();
92413                 }
92414               }
92415               const token = `{${key}}`;
92416               const regex = new RegExp(token, "g");
92417               result = result.replace(regex, value);
92418             }
92419           }
92420         }
92421         if (typeof result === "string") {
92422           return {
92423             text: result,
92424             locale: locale3
92425           };
92426         }
92427       }
92428       let index = _localeCodes.indexOf(locale3);
92429       if (index >= 0 && index < _localeCodes.length - 1) {
92430         let fallback = _localeCodes[index + 1];
92431         return localizer.tInfo(origStringId, replacements, fallback);
92432       }
92433       if (replacements && "default" in replacements) {
92434         return {
92435           text: replacements.default,
92436           locale: null
92437         };
92438       }
92439       const missing = `Missing ${locale3} translation: ${origStringId}`;
92440       if (typeof console !== "undefined") console.error(missing);
92441       return {
92442         text: missing,
92443         locale: "en"
92444       };
92445     };
92446     localizer.hasTextForStringId = function(stringId) {
92447       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
92448     };
92449     localizer.t = function(stringId, replacements, locale3) {
92450       return localizer.tInfo(stringId, replacements, locale3).text;
92451     };
92452     localizer.t.html = function(stringId, replacements, locale3) {
92453       replacements = Object.assign({}, replacements);
92454       for (var k2 in replacements) {
92455         if (typeof replacements[k2] === "string") {
92456           replacements[k2] = escape_default(replacements[k2]);
92457         }
92458         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
92459           replacements[k2] = replacements[k2].html;
92460         }
92461       }
92462       const info = localizer.tInfo(stringId, replacements, locale3);
92463       if (info.text) {
92464         return `<span class="localized-text" lang="${info.locale || "und"}">${info.text}</span>`;
92465       } else {
92466         return "";
92467       }
92468     };
92469     localizer.t.append = function(stringId, replacements, locale3) {
92470       const ret = function(selection2) {
92471         const info = localizer.tInfo(stringId, replacements, locale3);
92472         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
92473       };
92474       ret.stringId = stringId;
92475       return ret;
92476     };
92477     localizer.t.addOrUpdate = function(stringId, replacements, locale3) {
92478       const ret = function(selection2) {
92479         const info = localizer.tInfo(stringId, replacements, locale3);
92480         const span = selection2.selectAll("span.localized-text").data([info]);
92481         const enter = span.enter().append("span").classed("localized-text", true);
92482         span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
92483       };
92484       ret.stringId = stringId;
92485       return ret;
92486     };
92487     localizer.languageName = (code, options2) => {
92488       if (_languageNames && _languageNames[code]) {
92489         return _languageNames[code];
92490       }
92491       if (options2 && options2.localOnly) return null;
92492       const langInfo = _dataLanguages[code];
92493       if (langInfo) {
92494         if (langInfo.nativeName) {
92495           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
92496         } else if (langInfo.base && langInfo.script) {
92497           const base = langInfo.base;
92498           if (_languageNames && _languageNames[base]) {
92499             const scriptCode = langInfo.script;
92500             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
92501             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
92502           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
92503             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
92504           }
92505         }
92506       }
92507       return code;
92508     };
92509     localizer.floatFormatter = (locale3) => {
92510       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
92511         return (number3, fractionDigits) => {
92512           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
92513         };
92514       } else {
92515         return (number3, fractionDigits) => number3.toLocaleString(locale3, {
92516           minimumFractionDigits: fractionDigits,
92517           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
92518         });
92519       }
92520     };
92521     localizer.floatParser = (locale3) => {
92522       const polyfill = (string) => +string.trim();
92523       if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
92524       const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
92525       if (!("formatToParts" in format2)) return polyfill;
92526       const parts = format2.formatToParts(-12345.6);
92527       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
92528       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
92529       const literalPart = parts.find((d2) => d2.type === "literal");
92530       const literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
92531       const groupPart = parts.find((d2) => d2.type === "group");
92532       const group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
92533       const decimalPart = parts.find((d2) => d2.type === "decimal");
92534       const decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
92535       const numeral = new RegExp(`[${numerals.join("")}]`, "g");
92536       const getIndex = (d2) => index.get(d2);
92537       return (string) => {
92538         string = string.trim();
92539         if (literal) string = string.replace(literal, "");
92540         if (group) string = string.replace(group, "");
92541         if (decimal) string = string.replace(decimal, ".");
92542         string = string.replace(numeral, getIndex);
92543         return string ? +string : NaN;
92544       };
92545     };
92546     localizer.decimalPlaceCounter = (locale3) => {
92547       var literal, group, decimal;
92548       if ("Intl" in window && "NumberFormat" in Intl) {
92549         const format2 = new Intl.NumberFormat(locale3, { maximumFractionDigits: 20 });
92550         if ("formatToParts" in format2) {
92551           const parts = format2.formatToParts(-12345.6);
92552           const literalPart = parts.find((d2) => d2.type === "literal");
92553           literal = literalPart && new RegExp(`[${literalPart.value}]`, "g");
92554           const groupPart = parts.find((d2) => d2.type === "group");
92555           group = groupPart && new RegExp(`[${groupPart.value}]`, "g");
92556           const decimalPart = parts.find((d2) => d2.type === "decimal");
92557           decimal = decimalPart && new RegExp(`[${decimalPart.value}]`);
92558         }
92559       }
92560       return (string) => {
92561         string = string.trim();
92562         if (literal) string = string.replace(literal, "");
92563         if (group) string = string.replace(group, "");
92564         const parts = string.split(decimal || ".");
92565         return parts && parts[1] && parts[1].length || 0;
92566       };
92567     };
92568     return localizer;
92569   }
92570   var _mainLocalizer, _t;
92571   var init_localizer = __esm({
92572     "modules/core/localizer.js"() {
92573       "use strict";
92574       init_lodash();
92575       init_file_fetcher();
92576       init_detect();
92577       init_util();
92578       init_array3();
92579       init_id();
92580       _mainLocalizer = coreLocalizer();
92581       _t = _mainLocalizer.t;
92582     }
92583   });
92584
92585   // modules/util/util.js
92586   var util_exports2 = {};
92587   __export(util_exports2, {
92588     utilAsyncMap: () => utilAsyncMap,
92589     utilCleanOsmString: () => utilCleanOsmString,
92590     utilCombinedTags: () => utilCombinedTags,
92591     utilCompareIDs: () => utilCompareIDs,
92592     utilDeepMemberSelector: () => utilDeepMemberSelector,
92593     utilDisplayName: () => utilDisplayName,
92594     utilDisplayNameForPath: () => utilDisplayNameForPath,
92595     utilDisplayType: () => utilDisplayType,
92596     utilEditDistance: () => utilEditDistance,
92597     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
92598     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
92599     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
92600     utilEntityRoot: () => utilEntityRoot,
92601     utilEntitySelector: () => utilEntitySelector,
92602     utilFastMouse: () => utilFastMouse,
92603     utilFunctor: () => utilFunctor,
92604     utilGetAllNodes: () => utilGetAllNodes,
92605     utilHashcode: () => utilHashcode,
92606     utilHighlightEntities: () => utilHighlightEntities,
92607     utilNoAuto: () => utilNoAuto,
92608     utilOldestID: () => utilOldestID,
92609     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
92610     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
92611     utilQsString: () => utilQsString,
92612     utilSafeClassName: () => utilSafeClassName,
92613     utilSetTransform: () => utilSetTransform,
92614     utilStringQs: () => utilStringQs,
92615     utilTagDiff: () => utilTagDiff,
92616     utilTagText: () => utilTagText,
92617     utilTotalExtent: () => utilTotalExtent,
92618     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
92619     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
92620     utilUniqueDomId: () => utilUniqueDomId,
92621     utilWrap: () => utilWrap
92622   });
92623   function utilTagText(entity) {
92624     var obj = entity && entity.tags || {};
92625     return Object.keys(obj).map(function(k2) {
92626       return k2 + "=" + obj[k2];
92627     }).join(", ");
92628   }
92629   function utilTotalExtent(array2, graph) {
92630     var extent = geoExtent();
92631     var val, entity;
92632     for (var i3 = 0; i3 < array2.length; i3++) {
92633       val = array2[i3];
92634       entity = typeof val === "string" ? graph.hasEntity(val) : val;
92635       if (entity) {
92636         extent._extend(entity.extent(graph));
92637       }
92638     }
92639     return extent;
92640   }
92641   function utilTagDiff(oldTags, newTags) {
92642     var tagDiff = [];
92643     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
92644     keys2.forEach(function(k2) {
92645       var oldVal = oldTags[k2];
92646       var newVal = newTags[k2];
92647       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
92648         tagDiff.push({
92649           type: "-",
92650           key: k2,
92651           oldVal,
92652           newVal,
92653           display: "- " + k2 + "=" + oldVal
92654         });
92655       }
92656       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
92657         tagDiff.push({
92658           type: "+",
92659           key: k2,
92660           oldVal,
92661           newVal,
92662           display: "+ " + k2 + "=" + newVal
92663         });
92664       }
92665     });
92666     return tagDiff;
92667   }
92668   function utilEntitySelector(ids) {
92669     return ids.length ? "." + ids.join(",.") : "nothing";
92670   }
92671   function utilEntityOrMemberSelector(ids, graph) {
92672     var seen = new Set(ids);
92673     ids.forEach(collectShallowDescendants);
92674     return utilEntitySelector(Array.from(seen));
92675     function collectShallowDescendants(id2) {
92676       var entity = graph.hasEntity(id2);
92677       if (!entity || entity.type !== "relation") return;
92678       entity.members.map(function(member) {
92679         return member.id;
92680       }).forEach(function(id3) {
92681         seen.add(id3);
92682       });
92683     }
92684   }
92685   function utilEntityOrDeepMemberSelector(ids, graph) {
92686     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
92687   }
92688   function utilEntityAndDeepMemberIDs(ids, graph) {
92689     var seen = /* @__PURE__ */ new Set();
92690     ids.forEach(collectDeepDescendants);
92691     return Array.from(seen);
92692     function collectDeepDescendants(id2) {
92693       if (seen.has(id2)) return;
92694       seen.add(id2);
92695       var entity = graph.hasEntity(id2);
92696       if (!entity || entity.type !== "relation") return;
92697       entity.members.map(function(member) {
92698         return member.id;
92699       }).forEach(collectDeepDescendants);
92700     }
92701   }
92702   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
92703     var idsSet = new Set(ids);
92704     var seen = /* @__PURE__ */ new Set();
92705     var returners = /* @__PURE__ */ new Set();
92706     ids.forEach(collectDeepDescendants);
92707     return utilEntitySelector(Array.from(returners));
92708     function collectDeepDescendants(id2) {
92709       if (seen.has(id2)) return;
92710       seen.add(id2);
92711       if (!idsSet.has(id2)) {
92712         returners.add(id2);
92713       }
92714       var entity = graph.hasEntity(id2);
92715       if (!entity || entity.type !== "relation") return;
92716       if (skipMultipolgonMembers && entity.isMultipolygon()) return;
92717       entity.members.map(function(member) {
92718         return member.id;
92719       }).forEach(collectDeepDescendants);
92720     }
92721   }
92722   function utilHighlightEntities(ids, highlighted, context) {
92723     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
92724   }
92725   function utilGetAllNodes(ids, graph) {
92726     var seen = /* @__PURE__ */ new Set();
92727     var nodes = /* @__PURE__ */ new Set();
92728     ids.forEach(collectNodes);
92729     return Array.from(nodes);
92730     function collectNodes(id2) {
92731       if (seen.has(id2)) return;
92732       seen.add(id2);
92733       var entity = graph.hasEntity(id2);
92734       if (!entity) return;
92735       if (entity.type === "node") {
92736         nodes.add(entity);
92737       } else if (entity.type === "way") {
92738         entity.nodes.forEach(collectNodes);
92739       } else {
92740         entity.members.map(function(member) {
92741           return member.id;
92742         }).forEach(collectNodes);
92743       }
92744     }
92745   }
92746   function utilDisplayName(entity, hideNetwork) {
92747     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
92748     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
92749     var tags = {
92750       direction: entity.tags.direction,
92751       from: entity.tags.from,
92752       name,
92753       network: hideNetwork ? void 0 : entity.tags.cycle_network || entity.tags.network,
92754       ref: entity.tags.ref,
92755       to: entity.tags.to,
92756       via: entity.tags.via
92757     };
92758     if (entity.tags.route && entity.tags.name && entity.tags.name.match(/[→⇒↔⇔]|[-=]>/)) {
92759       return entity.tags.name;
92760     }
92761     if (!entity.tags.route && name) {
92762       return name;
92763     }
92764     var keyComponents = [];
92765     if (tags.network) {
92766       keyComponents.push("network");
92767     }
92768     if (tags.ref) {
92769       keyComponents.push("ref");
92770     }
92771     if (tags.name) {
92772       keyComponents.push("name");
92773     }
92774     if (entity.tags.route) {
92775       if (tags.direction) {
92776         keyComponents.push("direction");
92777       } else if (tags.from && tags.to) {
92778         keyComponents.push("from");
92779         keyComponents.push("to");
92780         if (tags.via) {
92781           keyComponents.push("via");
92782         }
92783       }
92784     }
92785     if (keyComponents.length) {
92786       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
92787     }
92788     return name;
92789   }
92790   function utilDisplayNameForPath(entity) {
92791     var name = utilDisplayName(entity);
92792     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
92793     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
92794     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
92795       name = fixRTLTextForSvg(name);
92796     }
92797     return name;
92798   }
92799   function utilDisplayType(id2) {
92800     return {
92801       n: _t("inspector.node"),
92802       w: _t("inspector.way"),
92803       r: _t("inspector.relation")
92804     }[id2.charAt(0)];
92805   }
92806   function utilEntityRoot(entityType) {
92807     return {
92808       node: "n",
92809       way: "w",
92810       relation: "r"
92811     }[entityType];
92812   }
92813   function utilCombinedTags(entityIDs, graph) {
92814     var tags = {};
92815     var tagCounts = {};
92816     var allKeys = /* @__PURE__ */ new Set();
92817     var allTags = [];
92818     var entities = entityIDs.map(function(entityID) {
92819       return graph.hasEntity(entityID);
92820     }).filter(Boolean);
92821     entities.forEach(function(entity) {
92822       var keys2 = Object.keys(entity.tags).filter(Boolean);
92823       keys2.forEach(function(key2) {
92824         allKeys.add(key2);
92825       });
92826     });
92827     entities.forEach(function(entity) {
92828       allTags.push(entity.tags);
92829       allKeys.forEach(function(key2) {
92830         var value = entity.tags[key2];
92831         if (!tags.hasOwnProperty(key2)) {
92832           tags[key2] = value;
92833         } else {
92834           if (!Array.isArray(tags[key2])) {
92835             if (tags[key2] !== value) {
92836               tags[key2] = [tags[key2], value];
92837             }
92838           } else {
92839             if (tags[key2].indexOf(value) === -1) {
92840               tags[key2].push(value);
92841             }
92842           }
92843         }
92844         var tagHash = key2 + "=" + value;
92845         if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
92846         tagCounts[tagHash] += 1;
92847       });
92848     });
92849     for (var key in tags) {
92850       if (!Array.isArray(tags[key])) continue;
92851       tags[key] = tags[key].sort(function(val12, val2) {
92852         var key2 = key2;
92853         var count2 = tagCounts[key2 + "=" + val2];
92854         var count1 = tagCounts[key2 + "=" + val12];
92855         if (count2 !== count1) {
92856           return count2 - count1;
92857         }
92858         if (val2 && val12) {
92859           return val12.localeCompare(val2);
92860         }
92861         return val12 ? 1 : -1;
92862       });
92863     }
92864     tags = Object.defineProperty(tags, Symbol.for("allTags"), { enumerable: false, value: allTags });
92865     return tags;
92866   }
92867   function utilStringQs(str) {
92868     str = str.replace(/^[#?]{0,2}/, "");
92869     return Object.fromEntries(new URLSearchParams(str));
92870   }
92871   function utilQsString(obj, softEncode) {
92872     let str = new URLSearchParams(obj).toString();
92873     if (softEncode) {
92874       str = str.replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
92875     }
92876     return str;
92877   }
92878   function utilPrefixDOMProperty(property) {
92879     var prefixes2 = ["webkit", "ms", "moz", "o"];
92880     var i3 = -1;
92881     var n3 = prefixes2.length;
92882     var s2 = document.body;
92883     if (property in s2) return property;
92884     property = property.slice(0, 1).toUpperCase() + property.slice(1);
92885     while (++i3 < n3) {
92886       if (prefixes2[i3] + property in s2) {
92887         return prefixes2[i3] + property;
92888       }
92889     }
92890     return false;
92891   }
92892   function utilPrefixCSSProperty(property) {
92893     var prefixes2 = ["webkit", "ms", "Moz", "O"];
92894     var i3 = -1;
92895     var n3 = prefixes2.length;
92896     var s2 = document.body.style;
92897     if (property.toLowerCase() in s2) {
92898       return property.toLowerCase();
92899     }
92900     while (++i3 < n3) {
92901       if (prefixes2[i3] + property in s2) {
92902         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
92903       }
92904     }
92905     return false;
92906   }
92907   function utilSetTransform(el, x2, y2, scale) {
92908     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
92909     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
92910     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
92911   }
92912   function utilEditDistance(a2, b2) {
92913     a2 = (0, import_diacritics3.remove)(a2.toLowerCase());
92914     b2 = (0, import_diacritics3.remove)(b2.toLowerCase());
92915     if (a2.length === 0) return b2.length;
92916     if (b2.length === 0) return a2.length;
92917     var matrix = [];
92918     var i3, j2;
92919     for (i3 = 0; i3 <= b2.length; i3++) {
92920       matrix[i3] = [i3];
92921     }
92922     for (j2 = 0; j2 <= a2.length; j2++) {
92923       matrix[0][j2] = j2;
92924     }
92925     for (i3 = 1; i3 <= b2.length; i3++) {
92926       for (j2 = 1; j2 <= a2.length; j2++) {
92927         if (b2.charAt(i3 - 1) === a2.charAt(j2 - 1)) {
92928           matrix[i3][j2] = matrix[i3 - 1][j2 - 1];
92929         } else {
92930           matrix[i3][j2] = Math.min(
92931             matrix[i3 - 1][j2 - 1] + 1,
92932             // substitution
92933             Math.min(
92934               matrix[i3][j2 - 1] + 1,
92935               // insertion
92936               matrix[i3 - 1][j2] + 1
92937             )
92938           );
92939         }
92940       }
92941     }
92942     return matrix[b2.length][a2.length];
92943   }
92944   function utilFastMouse(container) {
92945     var rect = container.getBoundingClientRect();
92946     var rectLeft = rect.left;
92947     var rectTop = rect.top;
92948     var clientLeft = +container.clientLeft;
92949     var clientTop = +container.clientTop;
92950     return function(e3) {
92951       return [
92952         e3.clientX - rectLeft - clientLeft,
92953         e3.clientY - rectTop - clientTop
92954       ];
92955     };
92956   }
92957   function utilAsyncMap(inputs, func, callback) {
92958     var remaining = inputs.length;
92959     var results = [];
92960     var errors = [];
92961     inputs.forEach(function(d2, i3) {
92962       func(d2, function done(err, data) {
92963         errors[i3] = err;
92964         results[i3] = data;
92965         remaining--;
92966         if (!remaining) callback(errors, results);
92967       });
92968     });
92969   }
92970   function utilWrap(index, length2) {
92971     if (index < 0) {
92972       index += Math.ceil(-index / length2) * length2;
92973     }
92974     return index % length2;
92975   }
92976   function utilFunctor(value) {
92977     if (typeof value === "function") return value;
92978     return function() {
92979       return value;
92980     };
92981   }
92982   function utilNoAuto(selection2) {
92983     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
92984     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("data-1p-ignore", "true").attr("data-bwignore", "true").attr("data-form-type", "other").attr("data-lpignore", "true").attr("spellcheck", isText ? "true" : "false");
92985   }
92986   function utilHashcode(str) {
92987     var hash2 = 0;
92988     if (str.length === 0) {
92989       return hash2;
92990     }
92991     for (var i3 = 0; i3 < str.length; i3++) {
92992       var char = str.charCodeAt(i3);
92993       hash2 = (hash2 << 5) - hash2 + char;
92994       hash2 = hash2 & hash2;
92995     }
92996     return hash2;
92997   }
92998   function utilSafeClassName(str) {
92999     return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
93000   }
93001   function utilUniqueDomId(val) {
93002     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
93003   }
93004   function utilUnicodeCharsCount(str) {
93005     return Array.from(str).length;
93006   }
93007   function utilUnicodeCharsTruncated(str, limit) {
93008     return Array.from(str).slice(0, limit).join("");
93009   }
93010   function toNumericID(id2) {
93011     var match = id2.match(/^[cnwr](-?\d+)$/);
93012     if (match) {
93013       return parseInt(match[1], 10);
93014     }
93015     return NaN;
93016   }
93017   function compareNumericIDs(left, right) {
93018     if (isNaN(left) && isNaN(right)) return -1;
93019     if (isNaN(left)) return 1;
93020     if (isNaN(right)) return -1;
93021     if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
93022     if (Math.sign(left) < 0) return Math.sign(right - left);
93023     return Math.sign(left - right);
93024   }
93025   function utilCompareIDs(left, right) {
93026     return compareNumericIDs(toNumericID(left), toNumericID(right));
93027   }
93028   function utilOldestID(ids) {
93029     if (ids.length === 0) {
93030       return void 0;
93031     }
93032     var oldestIDIndex = 0;
93033     var oldestID = toNumericID(ids[0]);
93034     for (var i3 = 1; i3 < ids.length; i3++) {
93035       var num = toNumericID(ids[i3]);
93036       if (compareNumericIDs(oldestID, num) === 1) {
93037         oldestIDIndex = i3;
93038         oldestID = num;
93039       }
93040     }
93041     return ids[oldestIDIndex];
93042   }
93043   function utilCleanOsmString(val, maxChars) {
93044     if (val === void 0 || val === null) {
93045       val = "";
93046     } else {
93047       val = val.toString();
93048     }
93049     val = val.trim();
93050     if (val.normalize) val = val.normalize("NFC");
93051     return utilUnicodeCharsTruncated(val, maxChars);
93052   }
93053   var import_diacritics3, transformProperty;
93054   var init_util2 = __esm({
93055     "modules/util/util.js"() {
93056       "use strict";
93057       import_diacritics3 = __toESM(require_diacritics());
93058       init_svg_paths_rtl_fix();
93059       init_localizer();
93060       init_array3();
93061       init_detect();
93062       init_extent();
93063     }
93064   });
93065
93066   // modules/osm/entity.js
93067   var entity_exports = {};
93068   __export(entity_exports, {
93069     osmEntity: () => osmEntity
93070   });
93071   function osmEntity(attrs) {
93072     if (this instanceof osmEntity) return;
93073     if (attrs && attrs.type) {
93074       return osmEntity[attrs.type].apply(this, arguments);
93075     } else if (attrs && attrs.id) {
93076       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
93077     }
93078     return new osmEntity().initialize(arguments);
93079   }
93080   var init_entity = __esm({
93081     "modules/osm/entity.js"() {
93082       "use strict";
93083       init_index();
93084       init_tags();
93085       init_array3();
93086       init_util2();
93087       osmEntity.id = function(type2) {
93088         return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
93089       };
93090       osmEntity.id.next = {
93091         changeset: -1,
93092         node: -1,
93093         way: -1,
93094         relation: -1
93095       };
93096       osmEntity.id.fromOSM = function(type2, id2) {
93097         return type2[0] + id2;
93098       };
93099       osmEntity.id.toOSM = function(id2) {
93100         var match = id2.match(/^[cnwr](-?\d+)$/);
93101         if (match) {
93102           return match[1];
93103         }
93104         return "";
93105       };
93106       osmEntity.id.type = function(id2) {
93107         return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
93108       };
93109       osmEntity.key = function(entity) {
93110         return entity.id + "v" + (entity.v || 0);
93111       };
93112       osmEntity.prototype = {
93113         /** @type {Tags} */
93114         tags: {},
93115         /** @type {String} */
93116         id: void 0,
93117         initialize: function(sources) {
93118           for (var i3 = 0; i3 < sources.length; ++i3) {
93119             var source = sources[i3];
93120             for (var prop in source) {
93121               if (Object.prototype.hasOwnProperty.call(source, prop)) {
93122                 if (source[prop] === void 0) {
93123                   delete this[prop];
93124                 } else {
93125                   this[prop] = source[prop];
93126                 }
93127               }
93128             }
93129           }
93130           if (!this.id && this.type) {
93131             this.id = osmEntity.id(this.type);
93132           }
93133           if (!this.hasOwnProperty("visible")) {
93134             this.visible = true;
93135           }
93136           if (debug) {
93137             Object.freeze(this);
93138             Object.freeze(this.tags);
93139             if (this.loc) Object.freeze(this.loc);
93140             if (this.nodes) Object.freeze(this.nodes);
93141             if (this.members) Object.freeze(this.members);
93142           }
93143           return this;
93144         },
93145         copy: function(resolver, copies) {
93146           if (copies[this.id]) return copies[this.id];
93147           var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
93148           copies[this.id] = copy2;
93149           return copy2;
93150         },
93151         osmId: function() {
93152           return osmEntity.id.toOSM(this.id);
93153         },
93154         isNew: function() {
93155           var osmId = osmEntity.id.toOSM(this.id);
93156           return osmId.length === 0 || osmId[0] === "-";
93157         },
93158         update: function(attrs) {
93159           return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
93160         },
93161         /**
93162          *
93163          * @param {Tags} tags tags to merge into this entity's tags
93164          * @param {Tags} setTags (optional) a set of tags to overwrite in this entity's tags
93165          * @returns {iD.OsmEntity}
93166          */
93167         mergeTags: function(tags, setTags = {}) {
93168           const merged = Object.assign({}, this.tags);
93169           let changed = false;
93170           for (const k2 in tags) {
93171             if (setTags.hasOwnProperty(k2)) continue;
93172             const t12 = this.tags[k2];
93173             const t2 = tags[k2];
93174             if (!t12) {
93175               changed = true;
93176               merged[k2] = t2;
93177             } else if (t12 !== t2) {
93178               changed = true;
93179               merged[k2] = utilUnicodeCharsTruncated(
93180                 utilArrayUnion(t12.split(/;\s*/), t2.split(/;\s*/)).join(";"),
93181                 255
93182                 // avoid exceeding character limit; see also context.maxCharsForTagValue()
93183               );
93184             }
93185           }
93186           for (const k2 in setTags) {
93187             if (this.tags[k2] !== setTags[k2]) {
93188               changed = true;
93189               merged[k2] = setTags[k2];
93190             }
93191           }
93192           return changed ? this.update({ tags: merged }) : this;
93193         },
93194         intersects: function(extent, resolver) {
93195           return this.extent(resolver).intersects(extent);
93196         },
93197         hasNonGeometryTags: function() {
93198           return Object.keys(this.tags).some(function(k2) {
93199             return k2 !== "area";
93200           });
93201         },
93202         hasParentRelations: function(resolver) {
93203           return resolver.parentRelations(this).length > 0;
93204         },
93205         hasInterestingTags: function() {
93206           return Object.keys(this.tags).some(osmIsInterestingTag);
93207         },
93208         isDegenerate: function() {
93209           return true;
93210         }
93211       };
93212     }
93213   });
93214
93215   // modules/osm/way.js
93216   var way_exports = {};
93217   __export(way_exports, {
93218     osmWay: () => osmWay
93219   });
93220   function osmWay() {
93221     if (!(this instanceof osmWay)) {
93222       return new osmWay().initialize(arguments);
93223     } else if (arguments.length) {
93224       this.initialize(arguments);
93225     }
93226   }
93227   function noRepeatNodes(node, i3, arr) {
93228     return i3 === 0 || node !== arr[i3 - 1];
93229   }
93230   var prototype3;
93231   var init_way = __esm({
93232     "modules/osm/way.js"() {
93233       "use strict";
93234       init_src2();
93235       init_geo2();
93236       init_entity();
93237       init_lanes();
93238       init_tags();
93239       init_util();
93240       osmEntity.way = osmWay;
93241       osmWay.prototype = Object.create(osmEntity.prototype);
93242       prototype3 = {
93243         type: "way",
93244         nodes: [],
93245         copy: function(resolver, copies) {
93246           if (copies[this.id]) return copies[this.id];
93247           var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
93248           var nodes = this.nodes.map(function(id2) {
93249             return resolver.entity(id2).copy(resolver, copies).id;
93250           });
93251           copy2 = copy2.update({ nodes });
93252           copies[this.id] = copy2;
93253           return copy2;
93254         },
93255         extent: function(resolver) {
93256           return resolver.transient(this, "extent", function() {
93257             var extent = geoExtent();
93258             for (var i3 = 0; i3 < this.nodes.length; i3++) {
93259               var node = resolver.hasEntity(this.nodes[i3]);
93260               if (node) {
93261                 extent._extend(node.extent());
93262               }
93263             }
93264             return extent;
93265           });
93266         },
93267         first: function() {
93268           return this.nodes[0];
93269         },
93270         last: function() {
93271           return this.nodes[this.nodes.length - 1];
93272         },
93273         contains: function(node) {
93274           return this.nodes.indexOf(node) >= 0;
93275         },
93276         affix: function(node) {
93277           if (this.nodes[0] === node) return "prefix";
93278           if (this.nodes[this.nodes.length - 1] === node) return "suffix";
93279         },
93280         layer: function() {
93281           if (isFinite(this.tags.layer)) {
93282             return Math.max(-10, Math.min(+this.tags.layer, 10));
93283           }
93284           if (this.tags.covered === "yes") return -1;
93285           if (this.tags.location === "overground") return 1;
93286           if (this.tags.location === "underground") return -1;
93287           if (this.tags.location === "underwater") return -10;
93288           if (this.tags.power === "line") return 10;
93289           if (this.tags.power === "minor_line") return 10;
93290           if (this.tags.aerialway) return 10;
93291           if (this.tags.bridge) return 1;
93292           if (this.tags.cutting) return -1;
93293           if (this.tags.tunnel) return -1;
93294           if (this.tags.waterway) return -1;
93295           if (this.tags.man_made === "pipeline") return -10;
93296           if (this.tags.boundary) return -10;
93297           return 0;
93298         },
93299         // the approximate width of the line based on its tags except its `width` tag
93300         impliedLineWidthMeters: function() {
93301           var averageWidths = {
93302             highway: {
93303               // width is for single lane
93304               motorway: 5,
93305               motorway_link: 5,
93306               trunk: 4.5,
93307               trunk_link: 4.5,
93308               primary: 4,
93309               secondary: 4,
93310               tertiary: 4,
93311               primary_link: 4,
93312               secondary_link: 4,
93313               tertiary_link: 4,
93314               unclassified: 4,
93315               road: 4,
93316               living_street: 4,
93317               bus_guideway: 4,
93318               busway: 4,
93319               pedestrian: 4,
93320               residential: 3.5,
93321               service: 3.5,
93322               track: 3,
93323               cycleway: 2.5,
93324               bridleway: 2,
93325               corridor: 2,
93326               steps: 2,
93327               path: 1.5,
93328               footway: 1.5,
93329               ladder: 0.5
93330             },
93331             railway: {
93332               // width includes ties and rail bed, not just track gauge
93333               rail: 2.5,
93334               light_rail: 2.5,
93335               tram: 2.5,
93336               subway: 2.5,
93337               monorail: 2.5,
93338               funicular: 2.5,
93339               disused: 2.5,
93340               preserved: 2.5,
93341               miniature: 1.5,
93342               narrow_gauge: 1.5
93343             },
93344             waterway: {
93345               river: 50,
93346               canal: 25,
93347               stream: 5,
93348               tidal_channel: 5,
93349               fish_pass: 2.5,
93350               drain: 2.5,
93351               ditch: 1.5
93352             }
93353           };
93354           for (var key in averageWidths) {
93355             if (this.tags[key] && averageWidths[key][this.tags[key]]) {
93356               var width = averageWidths[key][this.tags[key]];
93357               if (key === "highway") {
93358                 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
93359                 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
93360                 return width * laneCount;
93361               }
93362               return width;
93363             }
93364           }
93365           return null;
93366         },
93367         /** @returns {boolean} for example, if `oneway=yes` */
93368         isOneWayForwards() {
93369           if (this.tags.oneway === "no") return false;
93370           return !!utilCheckTagDictionary(this.tags, osmOneWayForwardTags);
93371         },
93372         /** @returns {boolean} for example, if `oneway=-1` */
93373         isOneWayBackwards() {
93374           if (this.tags.oneway === "no") return false;
93375           return !!utilCheckTagDictionary(this.tags, osmOneWayBackwardTags);
93376         },
93377         /** @returns {boolean} for example, if `oneway=alternating` */
93378         isBiDirectional() {
93379           if (this.tags.oneway === "no") return false;
93380           return !!utilCheckTagDictionary(this.tags, osmOneWayBiDirectionalTags);
93381         },
93382         /** @returns {boolean} */
93383         isOneWay() {
93384           if (this.tags.oneway === "no") return false;
93385           return !!utilCheckTagDictionary(this.tags, osmOneWayTags);
93386         },
93387         // Some identifier for tag that implies that this way is "sided",
93388         // i.e. the right side is the 'inside' (e.g. the right side of a
93389         // natural=cliff is lower).
93390         sidednessIdentifier: function() {
93391           for (const realKey in this.tags) {
93392             const value = this.tags[realKey];
93393             const key = osmRemoveLifecyclePrefix(realKey);
93394             if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
93395               if (osmRightSideIsInsideTags[key][value] === true) {
93396                 return key;
93397               } else {
93398                 return osmRightSideIsInsideTags[key][value];
93399               }
93400             }
93401           }
93402           return null;
93403         },
93404         isSided: function() {
93405           if (this.tags.two_sided === "yes") {
93406             return false;
93407           }
93408           return this.sidednessIdentifier() !== null;
93409         },
93410         lanes: function() {
93411           return osmLanes(this);
93412         },
93413         isClosed: function() {
93414           return this.nodes.length > 1 && this.first() === this.last();
93415         },
93416         isConvex: function(resolver) {
93417           if (!this.isClosed() || this.isDegenerate()) return null;
93418           var nodes = utilArrayUniq(resolver.childNodes(this));
93419           var coords = nodes.map(function(n3) {
93420             return n3.loc;
93421           });
93422           var curr = 0;
93423           var prev = 0;
93424           for (var i3 = 0; i3 < coords.length; i3++) {
93425             var o2 = coords[(i3 + 1) % coords.length];
93426             var a2 = coords[i3];
93427             var b2 = coords[(i3 + 2) % coords.length];
93428             var res = geoVecCross(a2, b2, o2);
93429             curr = res > 0 ? 1 : res < 0 ? -1 : 0;
93430             if (curr === 0) {
93431               continue;
93432             } else if (prev && curr !== prev) {
93433               return false;
93434             }
93435             prev = curr;
93436           }
93437           return true;
93438         },
93439         // returns an object with the tag that implies this is an area, if any
93440         tagSuggestingArea: function() {
93441           return osmTagSuggestingArea(this.tags);
93442         },
93443         isArea: function() {
93444           if (this.tags.area === "yes") return true;
93445           if (!this.isClosed() || this.tags.area === "no") return false;
93446           return this.tagSuggestingArea() !== null;
93447         },
93448         isDegenerate: function() {
93449           return new Set(this.nodes).size < (this.isClosed() ? 3 : 2);
93450         },
93451         areAdjacent: function(n1, n22) {
93452           for (var i3 = 0; i3 < this.nodes.length; i3++) {
93453             if (this.nodes[i3] === n1) {
93454               if (this.nodes[i3 - 1] === n22) return true;
93455               if (this.nodes[i3 + 1] === n22) return true;
93456             }
93457           }
93458           return false;
93459         },
93460         geometry: function(graph) {
93461           return graph.transient(this, "geometry", function() {
93462             return this.isArea() ? "area" : "line";
93463           });
93464         },
93465         // returns an array of objects representing the segments between the nodes in this way
93466         segments: function(graph) {
93467           function segmentExtent(graph2) {
93468             var n1 = graph2.hasEntity(this.nodes[0]);
93469             var n22 = graph2.hasEntity(this.nodes[1]);
93470             return n1 && n22 && geoExtent([
93471               [
93472                 Math.min(n1.loc[0], n22.loc[0]),
93473                 Math.min(n1.loc[1], n22.loc[1])
93474               ],
93475               [
93476                 Math.max(n1.loc[0], n22.loc[0]),
93477                 Math.max(n1.loc[1], n22.loc[1])
93478               ]
93479             ]);
93480           }
93481           return graph.transient(this, "segments", function() {
93482             var segments = [];
93483             for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
93484               segments.push({
93485                 id: this.id + "-" + i3,
93486                 wayId: this.id,
93487                 index: i3,
93488                 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
93489                 extent: segmentExtent
93490               });
93491             }
93492             return segments;
93493           });
93494         },
93495         // If this way is not closed, append the beginning node to the end of the nodelist to close it.
93496         close: function() {
93497           if (this.isClosed() || !this.nodes.length) return this;
93498           var nodes = this.nodes.slice();
93499           nodes = nodes.filter(noRepeatNodes);
93500           nodes.push(nodes[0]);
93501           return this.update({ nodes });
93502         },
93503         // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
93504         unclose: function() {
93505           if (!this.isClosed()) return this;
93506           var nodes = this.nodes.slice();
93507           var connector = this.first();
93508           var i3 = nodes.length - 1;
93509           while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93510             nodes.splice(i3, 1);
93511             i3 = nodes.length - 1;
93512           }
93513           nodes = nodes.filter(noRepeatNodes);
93514           return this.update({ nodes });
93515         },
93516         // Adds a node (id) in front of the node which is currently at position index.
93517         // If index is undefined, the node will be added to the end of the way for linear ways,
93518         //   or just before the final connecting node for circular ways.
93519         // Consecutive duplicates are eliminated including existing ones.
93520         // Circularity is always preserved when adding a node.
93521         addNode: function(id2, index) {
93522           var nodes = this.nodes.slice();
93523           var isClosed = this.isClosed();
93524           var max3 = isClosed ? nodes.length - 1 : nodes.length;
93525           if (index === void 0) {
93526             index = max3;
93527           }
93528           if (index < 0 || index > max3) {
93529             throw new RangeError("index " + index + " out of range 0.." + max3);
93530           }
93531           if (isClosed) {
93532             var connector = this.first();
93533             var i3 = 1;
93534             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
93535               nodes.splice(i3, 1);
93536               if (index > i3) index--;
93537             }
93538             i3 = nodes.length - 1;
93539             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93540               nodes.splice(i3, 1);
93541               if (index > i3) index--;
93542               i3 = nodes.length - 1;
93543             }
93544           }
93545           nodes.splice(index, 0, id2);
93546           nodes = nodes.filter(noRepeatNodes);
93547           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93548             nodes.push(nodes[0]);
93549           }
93550           return this.update({ nodes });
93551         },
93552         // Replaces the node which is currently at position index with the given node (id).
93553         // Consecutive duplicates are eliminated including existing ones.
93554         // Circularity is preserved when updating a node.
93555         updateNode: function(id2, index) {
93556           var nodes = this.nodes.slice();
93557           var isClosed = this.isClosed();
93558           var max3 = nodes.length - 1;
93559           if (index === void 0 || index < 0 || index > max3) {
93560             throw new RangeError("index " + index + " out of range 0.." + max3);
93561           }
93562           if (isClosed) {
93563             var connector = this.first();
93564             var i3 = 1;
93565             while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
93566               nodes.splice(i3, 1);
93567               if (index > i3) index--;
93568             }
93569             i3 = nodes.length - 1;
93570             while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
93571               nodes.splice(i3, 1);
93572               if (index === i3) index = 0;
93573               i3 = nodes.length - 1;
93574             }
93575           }
93576           nodes.splice(index, 1, id2);
93577           nodes = nodes.filter(noRepeatNodes);
93578           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93579             nodes.push(nodes[0]);
93580           }
93581           return this.update({ nodes });
93582         },
93583         // Replaces each occurrence of node id needle with replacement.
93584         // Consecutive duplicates are eliminated including existing ones.
93585         // Circularity is preserved.
93586         replaceNode: function(needleID, replacementID) {
93587           var nodes = this.nodes.slice();
93588           var isClosed = this.isClosed();
93589           for (var i3 = 0; i3 < nodes.length; i3++) {
93590             if (nodes[i3] === needleID) {
93591               nodes[i3] = replacementID;
93592             }
93593           }
93594           nodes = nodes.filter(noRepeatNodes);
93595           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93596             nodes.push(nodes[0]);
93597           }
93598           return this.update({ nodes });
93599         },
93600         // Removes each occurrence of node id.
93601         // Consecutive duplicates are eliminated including existing ones.
93602         // Circularity is preserved.
93603         removeNode: function(id2) {
93604           var nodes = this.nodes.slice();
93605           var isClosed = this.isClosed();
93606           nodes = nodes.filter(function(node) {
93607             return node !== id2;
93608           }).filter(noRepeatNodes);
93609           if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
93610             nodes.push(nodes[0]);
93611           }
93612           return this.update({ nodes });
93613         },
93614         asJXON: function(changeset_id) {
93615           var r2 = {
93616             way: {
93617               "@id": this.osmId(),
93618               "@version": this.version || 0,
93619               nd: this.nodes.map(function(id2) {
93620                 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
93621               }, this),
93622               tag: Object.keys(this.tags).map(function(k2) {
93623                 return { keyAttributes: { k: k2, v: this.tags[k2] } };
93624               }, this)
93625             }
93626           };
93627           if (changeset_id) {
93628             r2.way["@changeset"] = changeset_id;
93629           }
93630           return r2;
93631         },
93632         asGeoJSON: function(resolver) {
93633           return resolver.transient(this, "GeoJSON", function() {
93634             var coordinates = resolver.childNodes(this).map(function(n3) {
93635               return n3.loc;
93636             });
93637             if (this.isArea() && this.isClosed()) {
93638               return {
93639                 type: "Polygon",
93640                 coordinates: [coordinates]
93641               };
93642             } else {
93643               return {
93644                 type: "LineString",
93645                 coordinates
93646               };
93647             }
93648           });
93649         },
93650         area: function(resolver) {
93651           return resolver.transient(this, "area", function() {
93652             var nodes = resolver.childNodes(this);
93653             var json = {
93654               type: "Polygon",
93655               coordinates: [nodes.map(function(n3) {
93656                 return n3.loc;
93657               })]
93658             };
93659             if (!this.isClosed() && nodes.length) {
93660               json.coordinates[0].push(nodes[0].loc);
93661             }
93662             var area = area_default(json);
93663             if (area > 2 * Math.PI) {
93664               json.coordinates[0] = json.coordinates[0].reverse();
93665               area = area_default(json);
93666             }
93667             return isNaN(area) ? 0 : area;
93668           });
93669         }
93670       };
93671       Object.assign(osmWay.prototype, prototype3);
93672     }
93673   });
93674
93675   // modules/osm/multipolygon.js
93676   var multipolygon_exports = {};
93677   __export(multipolygon_exports, {
93678     osmJoinWays: () => osmJoinWays
93679   });
93680   function osmJoinWays(toJoin, graph) {
93681     function resolve(member) {
93682       return graph.childNodes(graph.entity(member.id));
93683     }
93684     function reverse(item2) {
93685       var action = actionReverse(item2.id, { reverseOneway: true });
93686       sequences.actions.push(action);
93687       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
93688     }
93689     toJoin = toJoin.filter(function(member) {
93690       return member.type === "way" && graph.hasEntity(member.id);
93691     });
93692     var i3;
93693     var joinAsMembers = true;
93694     for (i3 = 0; i3 < toJoin.length; i3++) {
93695       if (toJoin[i3] instanceof osmWay) {
93696         joinAsMembers = false;
93697         break;
93698       }
93699     }
93700     var sequences = [];
93701     sequences.actions = [];
93702     while (toJoin.length) {
93703       var item = toJoin.shift();
93704       var currWays = [item];
93705       var currNodes = resolve(item).slice();
93706       while (toJoin.length) {
93707         var start2 = currNodes[0];
93708         var end = currNodes[currNodes.length - 1];
93709         var fn = null;
93710         var nodes = null;
93711         for (i3 = 0; i3 < toJoin.length; i3++) {
93712           item = toJoin[i3];
93713           nodes = resolve(item);
93714           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
93715             currWays[0] = reverse(currWays[0]);
93716             currNodes.reverse();
93717             start2 = currNodes[0];
93718             end = currNodes[currNodes.length - 1];
93719           }
93720           if (nodes[0] === end) {
93721             fn = currNodes.push;
93722             nodes = nodes.slice(1);
93723             break;
93724           } else if (nodes[nodes.length - 1] === end) {
93725             fn = currNodes.push;
93726             nodes = nodes.slice(0, -1).reverse();
93727             item = reverse(item);
93728             break;
93729           } else if (nodes[nodes.length - 1] === start2) {
93730             fn = currNodes.unshift;
93731             nodes = nodes.slice(0, -1);
93732             break;
93733           } else if (nodes[0] === start2) {
93734             fn = currNodes.unshift;
93735             nodes = nodes.slice(1).reverse();
93736             item = reverse(item);
93737             break;
93738           } else {
93739             fn = nodes = null;
93740           }
93741         }
93742         if (!nodes) {
93743           break;
93744         }
93745         fn.apply(currWays, [item]);
93746         fn.apply(currNodes, nodes);
93747         toJoin.splice(i3, 1);
93748       }
93749       currWays.nodes = currNodes;
93750       sequences.push(currWays);
93751     }
93752     return sequences;
93753   }
93754   var init_multipolygon = __esm({
93755     "modules/osm/multipolygon.js"() {
93756       "use strict";
93757       init_reverse();
93758       init_way();
93759     }
93760   });
93761
93762   // modules/actions/add_member.js
93763   var add_member_exports = {};
93764   __export(add_member_exports, {
93765     actionAddMember: () => actionAddMember
93766   });
93767   function actionAddMember(relationId, member, memberIndex) {
93768     return function action(graph) {
93769       var relation = graph.entity(relationId);
93770       var isPTv2 = /stop|platform/.test(member.role);
93771       if (member.type === "way" && !isPTv2) {
93772         graph = addWayMember(relation, graph);
93773       } else {
93774         if (isPTv2 && isNaN(memberIndex)) {
93775           memberIndex = 0;
93776         }
93777         graph = graph.replace(relation.addMember(member, memberIndex));
93778       }
93779       return graph;
93780     };
93781     function addWayMember(relation, graph) {
93782       var groups, item, i3, j2, k2;
93783       var PTv2members = [];
93784       var members = [];
93785       for (i3 = 0; i3 < relation.members.length; i3++) {
93786         var m2 = relation.members[i3];
93787         if (/stop|platform/.test(m2.role)) {
93788           PTv2members.push(m2);
93789         } else {
93790           members.push(m2);
93791         }
93792       }
93793       relation = relation.update({ members });
93794       groups = utilArrayGroupBy(relation.members, "type");
93795       groups.way = groups.way || [];
93796       groups.way.push(member);
93797       members = withIndex(groups.way);
93798       var joined = osmJoinWays(members, graph);
93799       for (i3 = 0; i3 < joined.length; i3++) {
93800         var segment = joined[i3];
93801         var nodes = segment.nodes.slice();
93802         var startIndex = segment[0].index;
93803         for (j2 = 0; j2 < members.length; j2++) {
93804           if (members[j2].index === startIndex) {
93805             break;
93806           }
93807         }
93808         for (k2 = 0; k2 < segment.length; k2++) {
93809           item = segment[k2];
93810           var way = graph.entity(item.id);
93811           if (k2 > 0) {
93812             if (j2 + k2 >= members.length || item.index !== members[j2 + k2].index) {
93813               moveMember(members, item.index, j2 + k2);
93814             }
93815           }
93816           nodes.splice(0, way.nodes.length - 1);
93817         }
93818       }
93819       var wayMembers = [];
93820       for (i3 = 0; i3 < members.length; i3++) {
93821         item = members[i3];
93822         if (item.index === -1) continue;
93823         wayMembers.push(utilObjectOmit(item, ["index"]));
93824       }
93825       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
93826       return graph.replace(relation.update({ members: newMembers }));
93827       function moveMember(arr, findIndex, toIndex) {
93828         var i4;
93829         for (i4 = 0; i4 < arr.length; i4++) {
93830           if (arr[i4].index === findIndex) {
93831             break;
93832           }
93833         }
93834         var item2 = Object.assign({}, arr[i4]);
93835         arr[i4].index = -1;
93836         delete item2.index;
93837         arr.splice(toIndex, 0, item2);
93838       }
93839       function withIndex(arr) {
93840         var result = new Array(arr.length);
93841         for (var i4 = 0; i4 < arr.length; i4++) {
93842           result[i4] = Object.assign({}, arr[i4]);
93843           result[i4].index = i4;
93844         }
93845         return result;
93846       }
93847     }
93848   }
93849   var init_add_member = __esm({
93850     "modules/actions/add_member.js"() {
93851       "use strict";
93852       init_multipolygon();
93853       init_util();
93854     }
93855   });
93856
93857   // modules/actions/index.js
93858   var actions_exports = {};
93859   __export(actions_exports, {
93860     actionAddEntity: () => actionAddEntity,
93861     actionAddMember: () => actionAddMember,
93862     actionAddMidpoint: () => actionAddMidpoint,
93863     actionAddVertex: () => actionAddVertex,
93864     actionChangeMember: () => actionChangeMember,
93865     actionChangePreset: () => actionChangePreset,
93866     actionChangeTags: () => actionChangeTags,
93867     actionCircularize: () => actionCircularize,
93868     actionConnect: () => actionConnect,
93869     actionCopyEntities: () => actionCopyEntities,
93870     actionDeleteMember: () => actionDeleteMember,
93871     actionDeleteMultiple: () => actionDeleteMultiple,
93872     actionDeleteNode: () => actionDeleteNode,
93873     actionDeleteRelation: () => actionDeleteRelation,
93874     actionDeleteWay: () => actionDeleteWay,
93875     actionDiscardTags: () => actionDiscardTags,
93876     actionDisconnect: () => actionDisconnect,
93877     actionExtract: () => actionExtract,
93878     actionJoin: () => actionJoin,
93879     actionMerge: () => actionMerge,
93880     actionMergeNodes: () => actionMergeNodes,
93881     actionMergePolygon: () => actionMergePolygon,
93882     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
93883     actionMove: () => actionMove,
93884     actionMoveMember: () => actionMoveMember,
93885     actionMoveNode: () => actionMoveNode,
93886     actionNoop: () => actionNoop,
93887     actionOrthogonalize: () => actionOrthogonalize,
93888     actionReflect: () => actionReflect,
93889     actionRestrictTurn: () => actionRestrictTurn,
93890     actionReverse: () => actionReverse,
93891     actionRevert: () => actionRevert,
93892     actionRotate: () => actionRotate,
93893     actionScale: () => actionScale,
93894     actionSplit: () => actionSplit,
93895     actionStraightenNodes: () => actionStraightenNodes,
93896     actionStraightenWay: () => actionStraightenWay,
93897     actionUnrestrictTurn: () => actionUnrestrictTurn,
93898     actionUpgradeTags: () => actionUpgradeTags
93899   });
93900   var init_actions = __esm({
93901     "modules/actions/index.js"() {
93902       "use strict";
93903       init_add_entity();
93904       init_add_member();
93905       init_add_midpoint();
93906       init_add_vertex();
93907       init_change_member();
93908       init_change_preset();
93909       init_change_tags();
93910       init_circularize();
93911       init_connect();
93912       init_copy_entities();
93913       init_delete_member();
93914       init_delete_multiple();
93915       init_delete_node();
93916       init_delete_relation();
93917       init_delete_way();
93918       init_discard_tags();
93919       init_disconnect();
93920       init_extract();
93921       init_join2();
93922       init_merge5();
93923       init_merge_nodes();
93924       init_merge_polygon();
93925       init_merge_remote_changes();
93926       init_move();
93927       init_move_member();
93928       init_move_node();
93929       init_noop2();
93930       init_orthogonalize();
93931       init_restrict_turn();
93932       init_reverse();
93933       init_revert();
93934       init_rotate();
93935       init_scale();
93936       init_split();
93937       init_straighten_nodes();
93938       init_straighten_way();
93939       init_unrestrict_turn();
93940       init_reflect();
93941       init_upgrade_tags();
93942     }
93943   });
93944
93945   // node_modules/d3-axis/src/index.js
93946   var init_src19 = __esm({
93947     "node_modules/d3-axis/src/index.js"() {
93948     }
93949   });
93950
93951   // node_modules/d3-brush/src/constant.js
93952   var init_constant7 = __esm({
93953     "node_modules/d3-brush/src/constant.js"() {
93954     }
93955   });
93956
93957   // node_modules/d3-brush/src/event.js
93958   var init_event3 = __esm({
93959     "node_modules/d3-brush/src/event.js"() {
93960     }
93961   });
93962
93963   // node_modules/d3-brush/src/noevent.js
93964   var init_noevent3 = __esm({
93965     "node_modules/d3-brush/src/noevent.js"() {
93966     }
93967   });
93968
93969   // node_modules/d3-brush/src/brush.js
93970   function number1(e3) {
93971     return [+e3[0], +e3[1]];
93972   }
93973   function number22(e3) {
93974     return [number1(e3[0]), number1(e3[1])];
93975   }
93976   function type(t2) {
93977     return { type: t2 };
93978   }
93979   var abs2, max2, min2, X3, Y3, XY;
93980   var init_brush = __esm({
93981     "node_modules/d3-brush/src/brush.js"() {
93982       init_src11();
93983       init_constant7();
93984       init_event3();
93985       init_noevent3();
93986       ({ abs: abs2, max: max2, min: min2 } = Math);
93987       X3 = {
93988         name: "x",
93989         handles: ["w", "e"].map(type),
93990         input: function(x2, e3) {
93991           return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
93992         },
93993         output: function(xy) {
93994           return xy && [xy[0][0], xy[1][0]];
93995         }
93996       };
93997       Y3 = {
93998         name: "y",
93999         handles: ["n", "s"].map(type),
94000         input: function(y2, e3) {
94001           return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
94002         },
94003         output: function(xy) {
94004           return xy && [xy[0][1], xy[1][1]];
94005         }
94006       };
94007       XY = {
94008         name: "xy",
94009         handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
94010         input: function(xy) {
94011           return xy == null ? null : number22(xy);
94012         },
94013         output: function(xy) {
94014           return xy;
94015         }
94016       };
94017     }
94018   });
94019
94020   // node_modules/d3-brush/src/index.js
94021   var init_src20 = __esm({
94022     "node_modules/d3-brush/src/index.js"() {
94023       init_brush();
94024     }
94025   });
94026
94027   // node_modules/d3-path/src/index.js
94028   var init_src21 = __esm({
94029     "node_modules/d3-path/src/index.js"() {
94030     }
94031   });
94032
94033   // node_modules/d3-chord/src/index.js
94034   var init_src22 = __esm({
94035     "node_modules/d3-chord/src/index.js"() {
94036     }
94037   });
94038
94039   // node_modules/d3-contour/src/index.js
94040   var init_src23 = __esm({
94041     "node_modules/d3-contour/src/index.js"() {
94042     }
94043   });
94044
94045   // node_modules/d3-delaunay/src/index.js
94046   var init_src24 = __esm({
94047     "node_modules/d3-delaunay/src/index.js"() {
94048     }
94049   });
94050
94051   // node_modules/d3-quadtree/src/index.js
94052   var init_src25 = __esm({
94053     "node_modules/d3-quadtree/src/index.js"() {
94054     }
94055   });
94056
94057   // node_modules/d3-force/src/index.js
94058   var init_src26 = __esm({
94059     "node_modules/d3-force/src/index.js"() {
94060     }
94061   });
94062
94063   // node_modules/d3-hierarchy/src/index.js
94064   var init_src27 = __esm({
94065     "node_modules/d3-hierarchy/src/index.js"() {
94066     }
94067   });
94068
94069   // node_modules/d3-random/src/index.js
94070   var init_src28 = __esm({
94071     "node_modules/d3-random/src/index.js"() {
94072     }
94073   });
94074
94075   // node_modules/d3-scale-chromatic/src/index.js
94076   var init_src29 = __esm({
94077     "node_modules/d3-scale-chromatic/src/index.js"() {
94078     }
94079   });
94080
94081   // node_modules/d3-shape/src/index.js
94082   var init_src30 = __esm({
94083     "node_modules/d3-shape/src/index.js"() {
94084     }
94085   });
94086
94087   // node_modules/d3/src/index.js
94088   var init_src31 = __esm({
94089     "node_modules/d3/src/index.js"() {
94090       init_src();
94091       init_src19();
94092       init_src20();
94093       init_src22();
94094       init_src7();
94095       init_src23();
94096       init_src24();
94097       init_src4();
94098       init_src6();
94099       init_src17();
94100       init_src10();
94101       init_src18();
94102       init_src26();
94103       init_src13();
94104       init_src2();
94105       init_src27();
94106       init_src8();
94107       init_src21();
94108       init_src3();
94109       init_src25();
94110       init_src28();
94111       init_src16();
94112       init_src29();
94113       init_src5();
94114       init_src30();
94115       init_src14();
94116       init_src15();
94117       init_src9();
94118       init_src11();
94119       init_src12();
94120     }
94121   });
94122
94123   // modules/index.js
94124   var index_exports = {};
94125   __export(index_exports, {
94126     LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
94127     LocationManager: () => LocationManager,
94128     QAItem: () => QAItem,
94129     actionAddEntity: () => actionAddEntity,
94130     actionAddMember: () => actionAddMember,
94131     actionAddMidpoint: () => actionAddMidpoint,
94132     actionAddVertex: () => actionAddVertex,
94133     actionChangeMember: () => actionChangeMember,
94134     actionChangePreset: () => actionChangePreset,
94135     actionChangeTags: () => actionChangeTags,
94136     actionCircularize: () => actionCircularize,
94137     actionConnect: () => actionConnect,
94138     actionCopyEntities: () => actionCopyEntities,
94139     actionDeleteMember: () => actionDeleteMember,
94140     actionDeleteMultiple: () => actionDeleteMultiple,
94141     actionDeleteNode: () => actionDeleteNode,
94142     actionDeleteRelation: () => actionDeleteRelation,
94143     actionDeleteWay: () => actionDeleteWay,
94144     actionDiscardTags: () => actionDiscardTags,
94145     actionDisconnect: () => actionDisconnect,
94146     actionExtract: () => actionExtract,
94147     actionJoin: () => actionJoin,
94148     actionMerge: () => actionMerge,
94149     actionMergeNodes: () => actionMergeNodes,
94150     actionMergePolygon: () => actionMergePolygon,
94151     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
94152     actionMove: () => actionMove,
94153     actionMoveMember: () => actionMoveMember,
94154     actionMoveNode: () => actionMoveNode,
94155     actionNoop: () => actionNoop,
94156     actionOrthogonalize: () => actionOrthogonalize,
94157     actionReflect: () => actionReflect,
94158     actionRestrictTurn: () => actionRestrictTurn,
94159     actionReverse: () => actionReverse,
94160     actionRevert: () => actionRevert,
94161     actionRotate: () => actionRotate,
94162     actionScale: () => actionScale,
94163     actionSplit: () => actionSplit,
94164     actionStraightenNodes: () => actionStraightenNodes,
94165     actionStraightenWay: () => actionStraightenWay,
94166     actionUnrestrictTurn: () => actionUnrestrictTurn,
94167     actionUpgradeTags: () => actionUpgradeTags,
94168     behaviorAddWay: () => behaviorAddWay,
94169     behaviorBreathe: () => behaviorBreathe,
94170     behaviorDrag: () => behaviorDrag,
94171     behaviorDraw: () => behaviorDraw,
94172     behaviorDrawWay: () => behaviorDrawWay,
94173     behaviorEdit: () => behaviorEdit,
94174     behaviorHash: () => behaviorHash,
94175     behaviorHover: () => behaviorHover,
94176     behaviorLasso: () => behaviorLasso,
94177     behaviorOperation: () => behaviorOperation,
94178     behaviorPaste: () => behaviorPaste,
94179     behaviorSelect: () => behaviorSelect,
94180     coreContext: () => coreContext,
94181     coreDifference: () => coreDifference,
94182     coreFileFetcher: () => coreFileFetcher,
94183     coreGraph: () => coreGraph,
94184     coreHistory: () => coreHistory,
94185     coreLocalizer: () => coreLocalizer,
94186     coreTree: () => coreTree,
94187     coreUploader: () => coreUploader,
94188     coreValidator: () => coreValidator,
94189     d3: () => d3,
94190     debug: () => debug,
94191     dmsCoordinatePair: () => dmsCoordinatePair,
94192     dmsMatcher: () => dmsMatcher,
94193     fileFetcher: () => _mainFileFetcher,
94194     geoAngle: () => geoAngle,
94195     geoChooseEdge: () => geoChooseEdge,
94196     geoEdgeEqual: () => geoEdgeEqual,
94197     geoExtent: () => geoExtent,
94198     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
94199     geoHasLineIntersections: () => geoHasLineIntersections,
94200     geoHasSelfIntersections: () => geoHasSelfIntersections,
94201     geoLatToMeters: () => geoLatToMeters,
94202     geoLineIntersection: () => geoLineIntersection,
94203     geoLonToMeters: () => geoLonToMeters,
94204     geoMetersToLat: () => geoMetersToLat,
94205     geoMetersToLon: () => geoMetersToLon,
94206     geoMetersToOffset: () => geoMetersToOffset,
94207     geoOffsetToMeters: () => geoOffsetToMeters,
94208     geoOrthoCalcScore: () => geoOrthoCalcScore,
94209     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
94210     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
94211     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
94212     geoPathHasIntersections: () => geoPathHasIntersections,
94213     geoPathIntersections: () => geoPathIntersections,
94214     geoPathLength: () => geoPathLength,
94215     geoPointInPolygon: () => geoPointInPolygon,
94216     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
94217     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
94218     geoRawMercator: () => geoRawMercator,
94219     geoRotate: () => geoRotate,
94220     geoScaleToZoom: () => geoScaleToZoom,
94221     geoSphericalClosestNode: () => geoSphericalClosestNode,
94222     geoSphericalDistance: () => geoSphericalDistance,
94223     geoVecAdd: () => geoVecAdd,
94224     geoVecAngle: () => geoVecAngle,
94225     geoVecCross: () => geoVecCross,
94226     geoVecDot: () => geoVecDot,
94227     geoVecEqual: () => geoVecEqual,
94228     geoVecFloor: () => geoVecFloor,
94229     geoVecInterp: () => geoVecInterp,
94230     geoVecLength: () => geoVecLength,
94231     geoVecLengthSquare: () => geoVecLengthSquare,
94232     geoVecNormalize: () => geoVecNormalize,
94233     geoVecNormalizedDot: () => geoVecNormalizedDot,
94234     geoVecProject: () => geoVecProject,
94235     geoVecScale: () => geoVecScale,
94236     geoVecSubtract: () => geoVecSubtract,
94237     geoViewportEdge: () => geoViewportEdge,
94238     geoZoomToScale: () => geoZoomToScale,
94239     likelyRawNumberFormat: () => likelyRawNumberFormat,
94240     localizer: () => _mainLocalizer,
94241     locationManager: () => _sharedLocationManager,
94242     modeAddArea: () => modeAddArea,
94243     modeAddLine: () => modeAddLine,
94244     modeAddNote: () => modeAddNote,
94245     modeAddPoint: () => modeAddPoint,
94246     modeBrowse: () => modeBrowse,
94247     modeDragNode: () => modeDragNode,
94248     modeDragNote: () => modeDragNote,
94249     modeDrawArea: () => modeDrawArea,
94250     modeDrawLine: () => modeDrawLine,
94251     modeMove: () => modeMove,
94252     modeRotate: () => modeRotate,
94253     modeSave: () => modeSave,
94254     modeSelect: () => modeSelect,
94255     modeSelectData: () => modeSelectData,
94256     modeSelectError: () => modeSelectError,
94257     modeSelectNote: () => modeSelectNote,
94258     operationCircularize: () => operationCircularize,
94259     operationContinue: () => operationContinue,
94260     operationCopy: () => operationCopy,
94261     operationDelete: () => operationDelete,
94262     operationDisconnect: () => operationDisconnect,
94263     operationDowngrade: () => operationDowngrade,
94264     operationExtract: () => operationExtract,
94265     operationMerge: () => operationMerge,
94266     operationMove: () => operationMove,
94267     operationOrthogonalize: () => operationOrthogonalize,
94268     operationPaste: () => operationPaste,
94269     operationReflectLong: () => operationReflectLong,
94270     operationReflectShort: () => operationReflectShort,
94271     operationReverse: () => operationReverse,
94272     operationRotate: () => operationRotate,
94273     operationSplit: () => operationSplit,
94274     operationStraighten: () => operationStraighten,
94275     osmAreaKeys: () => osmAreaKeys,
94276     osmChangeset: () => osmChangeset,
94277     osmEntity: () => osmEntity,
94278     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
94279     osmInferRestriction: () => osmInferRestriction,
94280     osmIntersection: () => osmIntersection,
94281     osmIsInterestingTag: () => osmIsInterestingTag,
94282     osmJoinWays: () => osmJoinWays,
94283     osmLanes: () => osmLanes,
94284     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
94285     osmNode: () => osmNode,
94286     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
94287     osmNote: () => osmNote,
94288     osmPavedTags: () => osmPavedTags,
94289     osmPointTags: () => osmPointTags,
94290     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
94291     osmRelation: () => osmRelation,
94292     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
94293     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
94294     osmSetAreaKeys: () => osmSetAreaKeys,
94295     osmSetPointTags: () => osmSetPointTags,
94296     osmSetVertexTags: () => osmSetVertexTags,
94297     osmTagSuggestingArea: () => osmTagSuggestingArea,
94298     osmTurn: () => osmTurn,
94299     osmVertexTags: () => osmVertexTags,
94300     osmWay: () => osmWay,
94301     prefs: () => corePreferences,
94302     presetCategory: () => presetCategory,
94303     presetCollection: () => presetCollection,
94304     presetField: () => presetField,
94305     presetIndex: () => presetIndex,
94306     presetManager: () => _mainPresetIndex,
94307     presetPreset: () => presetPreset,
94308     rendererBackground: () => rendererBackground,
94309     rendererBackgroundSource: () => rendererBackgroundSource,
94310     rendererFeatures: () => rendererFeatures,
94311     rendererMap: () => rendererMap,
94312     rendererPhotos: () => rendererPhotos,
94313     rendererTileLayer: () => rendererTileLayer,
94314     serviceKartaview: () => kartaview_default,
94315     serviceKeepRight: () => keepRight_default,
94316     serviceMapRules: () => maprules_default,
94317     serviceMapilio: () => mapilio_default,
94318     serviceMapillary: () => mapillary_default,
94319     serviceNominatim: () => nominatim_default,
94320     serviceNsi: () => nsi_default,
94321     serviceOsm: () => osm_default,
94322     serviceOsmWikibase: () => osm_wikibase_default,
94323     serviceOsmose: () => osmose_default,
94324     servicePanoramax: () => panoramax_default,
94325     serviceStreetside: () => streetside_default,
94326     serviceTaginfo: () => taginfo_default,
94327     serviceVectorTile: () => vector_tile_default,
94328     serviceVegbilder: () => vegbilder_default,
94329     serviceWikidata: () => wikidata_default,
94330     serviceWikipedia: () => wikipedia_default,
94331     services: () => services,
94332     setDebug: () => setDebug,
94333     svgAreas: () => svgAreas,
94334     svgData: () => svgData,
94335     svgDebug: () => svgDebug,
94336     svgDefs: () => svgDefs,
94337     svgGeolocate: () => svgGeolocate,
94338     svgIcon: () => svgIcon,
94339     svgKartaviewImages: () => svgKartaviewImages,
94340     svgKeepRight: () => svgKeepRight,
94341     svgLabels: () => svgLabels,
94342     svgLayers: () => svgLayers,
94343     svgLines: () => svgLines,
94344     svgMapilioImages: () => svgMapilioImages,
94345     svgMapillaryImages: () => svgMapillaryImages,
94346     svgMapillarySigns: () => svgMapillarySigns,
94347     svgMarkerSegments: () => svgMarkerSegments,
94348     svgMidpoints: () => svgMidpoints,
94349     svgNotes: () => svgNotes,
94350     svgOsm: () => svgOsm,
94351     svgPanoramaxImages: () => svgPanoramaxImages,
94352     svgPassiveVertex: () => svgPassiveVertex,
94353     svgPath: () => svgPath,
94354     svgPointTransform: () => svgPointTransform,
94355     svgPoints: () => svgPoints,
94356     svgRelationMemberTags: () => svgRelationMemberTags,
94357     svgSegmentWay: () => svgSegmentWay,
94358     svgStreetside: () => svgStreetside,
94359     svgTagClasses: () => svgTagClasses,
94360     svgTagPattern: () => svgTagPattern,
94361     svgTouch: () => svgTouch,
94362     svgTurns: () => svgTurns,
94363     svgVegbilder: () => svgVegbilder,
94364     svgVertices: () => svgVertices,
94365     t: () => _t,
94366     uiAccount: () => uiAccount,
94367     uiAttribution: () => uiAttribution,
94368     uiChangesetEditor: () => uiChangesetEditor,
94369     uiCmd: () => uiCmd,
94370     uiCombobox: () => uiCombobox,
94371     uiCommit: () => uiCommit,
94372     uiCommitWarnings: () => uiCommitWarnings,
94373     uiConfirm: () => uiConfirm,
94374     uiConflicts: () => uiConflicts,
94375     uiContributors: () => uiContributors,
94376     uiCurtain: () => uiCurtain,
94377     uiDataEditor: () => uiDataEditor,
94378     uiDataHeader: () => uiDataHeader,
94379     uiDisclosure: () => uiDisclosure,
94380     uiEditMenu: () => uiEditMenu,
94381     uiEntityEditor: () => uiEntityEditor,
94382     uiFeatureInfo: () => uiFeatureInfo,
94383     uiFeatureList: () => uiFeatureList,
94384     uiField: () => uiField,
94385     uiFieldAccess: () => uiFieldAccess,
94386     uiFieldAddress: () => uiFieldAddress,
94387     uiFieldCheck: () => uiFieldCheck,
94388     uiFieldColour: () => uiFieldText,
94389     uiFieldCombo: () => uiFieldCombo,
94390     uiFieldDefaultCheck: () => uiFieldCheck,
94391     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
94392     uiFieldEmail: () => uiFieldText,
94393     uiFieldHelp: () => uiFieldHelp,
94394     uiFieldIdentifier: () => uiFieldText,
94395     uiFieldLanes: () => uiFieldLanes,
94396     uiFieldLocalized: () => uiFieldLocalized,
94397     uiFieldManyCombo: () => uiFieldCombo,
94398     uiFieldMultiCombo: () => uiFieldCombo,
94399     uiFieldNetworkCombo: () => uiFieldCombo,
94400     uiFieldNumber: () => uiFieldText,
94401     uiFieldOnewayCheck: () => uiFieldCheck,
94402     uiFieldRadio: () => uiFieldRadio,
94403     uiFieldRestrictions: () => uiFieldRestrictions,
94404     uiFieldRoadheight: () => uiFieldRoadheight,
94405     uiFieldRoadspeed: () => uiFieldRoadspeed,
94406     uiFieldSemiCombo: () => uiFieldCombo,
94407     uiFieldStructureRadio: () => uiFieldRadio,
94408     uiFieldTel: () => uiFieldText,
94409     uiFieldText: () => uiFieldText,
94410     uiFieldTextarea: () => uiFieldTextarea,
94411     uiFieldTypeCombo: () => uiFieldCombo,
94412     uiFieldUrl: () => uiFieldText,
94413     uiFieldWikidata: () => uiFieldWikidata,
94414     uiFieldWikipedia: () => uiFieldWikipedia,
94415     uiFields: () => uiFields,
94416     uiFlash: () => uiFlash,
94417     uiFormFields: () => uiFormFields,
94418     uiFullScreen: () => uiFullScreen,
94419     uiGeolocate: () => uiGeolocate,
94420     uiInfo: () => uiInfo,
94421     uiInfoPanels: () => uiInfoPanels,
94422     uiInit: () => uiInit,
94423     uiInspector: () => uiInspector,
94424     uiIntro: () => uiIntro,
94425     uiIssuesInfo: () => uiIssuesInfo,
94426     uiKeepRightDetails: () => uiKeepRightDetails,
94427     uiKeepRightEditor: () => uiKeepRightEditor,
94428     uiKeepRightHeader: () => uiKeepRightHeader,
94429     uiLasso: () => uiLasso,
94430     uiLengthIndicator: () => uiLengthIndicator,
94431     uiLoading: () => uiLoading,
94432     uiMapInMap: () => uiMapInMap,
94433     uiModal: () => uiModal,
94434     uiNoteComments: () => uiNoteComments,
94435     uiNoteEditor: () => uiNoteEditor,
94436     uiNoteHeader: () => uiNoteHeader,
94437     uiNoteReport: () => uiNoteReport,
94438     uiNotice: () => uiNotice,
94439     uiPaneBackground: () => uiPaneBackground,
94440     uiPaneHelp: () => uiPaneHelp,
94441     uiPaneIssues: () => uiPaneIssues,
94442     uiPaneMapData: () => uiPaneMapData,
94443     uiPanePreferences: () => uiPanePreferences,
94444     uiPanelBackground: () => uiPanelBackground,
94445     uiPanelHistory: () => uiPanelHistory,
94446     uiPanelLocation: () => uiPanelLocation,
94447     uiPanelMeasurement: () => uiPanelMeasurement,
94448     uiPopover: () => uiPopover,
94449     uiPresetIcon: () => uiPresetIcon,
94450     uiPresetList: () => uiPresetList,
94451     uiRestore: () => uiRestore,
94452     uiScale: () => uiScale,
94453     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
94454     uiSectionBackgroundList: () => uiSectionBackgroundList,
94455     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
94456     uiSectionChanges: () => uiSectionChanges,
94457     uiSectionDataLayers: () => uiSectionDataLayers,
94458     uiSectionEntityIssues: () => uiSectionEntityIssues,
94459     uiSectionFeatureType: () => uiSectionFeatureType,
94460     uiSectionMapFeatures: () => uiSectionMapFeatures,
94461     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
94462     uiSectionOverlayList: () => uiSectionOverlayList,
94463     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
94464     uiSectionPresetFields: () => uiSectionPresetFields,
94465     uiSectionPrivacy: () => uiSectionPrivacy,
94466     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
94467     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
94468     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
94469     uiSectionSelectionList: () => uiSectionSelectionList,
94470     uiSectionValidationIssues: () => uiSectionValidationIssues,
94471     uiSectionValidationOptions: () => uiSectionValidationOptions,
94472     uiSectionValidationRules: () => uiSectionValidationRules,
94473     uiSectionValidationStatus: () => uiSectionValidationStatus,
94474     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
94475     uiSettingsCustomData: () => uiSettingsCustomData,
94476     uiSidebar: () => uiSidebar,
94477     uiSourceSwitch: () => uiSourceSwitch,
94478     uiSpinner: () => uiSpinner,
94479     uiSplash: () => uiSplash,
94480     uiStatus: () => uiStatus,
94481     uiSuccess: () => uiSuccess,
94482     uiTagReference: () => uiTagReference,
94483     uiToggle: () => uiToggle,
94484     uiTooltip: () => uiTooltip,
94485     uiVersion: () => uiVersion,
94486     uiViewOnKeepRight: () => uiViewOnKeepRight,
94487     uiViewOnOSM: () => uiViewOnOSM,
94488     uiZoom: () => uiZoom,
94489     utilAesDecrypt: () => utilAesDecrypt,
94490     utilAesEncrypt: () => utilAesEncrypt,
94491     utilArrayChunk: () => utilArrayChunk,
94492     utilArrayDifference: () => utilArrayDifference,
94493     utilArrayFlatten: () => utilArrayFlatten,
94494     utilArrayGroupBy: () => utilArrayGroupBy,
94495     utilArrayIdentical: () => utilArrayIdentical,
94496     utilArrayIntersection: () => utilArrayIntersection,
94497     utilArrayUnion: () => utilArrayUnion,
94498     utilArrayUniq: () => utilArrayUniq,
94499     utilArrayUniqBy: () => utilArrayUniqBy,
94500     utilAsyncMap: () => utilAsyncMap,
94501     utilCheckTagDictionary: () => utilCheckTagDictionary,
94502     utilCleanOsmString: () => utilCleanOsmString,
94503     utilCleanTags: () => utilCleanTags,
94504     utilCombinedTags: () => utilCombinedTags,
94505     utilCompareIDs: () => utilCompareIDs,
94506     utilDeepMemberSelector: () => utilDeepMemberSelector,
94507     utilDetect: () => utilDetect,
94508     utilDisplayName: () => utilDisplayName,
94509     utilDisplayNameForPath: () => utilDisplayNameForPath,
94510     utilDisplayType: () => utilDisplayType,
94511     utilEditDistance: () => utilEditDistance,
94512     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
94513     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
94514     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
94515     utilEntityRoot: () => utilEntityRoot,
94516     utilEntitySelector: () => utilEntitySelector,
94517     utilFastMouse: () => utilFastMouse,
94518     utilFunctor: () => utilFunctor,
94519     utilGetAllNodes: () => utilGetAllNodes,
94520     utilGetSetValue: () => utilGetSetValue,
94521     utilHashcode: () => utilHashcode,
94522     utilHighlightEntities: () => utilHighlightEntities,
94523     utilKeybinding: () => utilKeybinding,
94524     utilNoAuto: () => utilNoAuto,
94525     utilObjectOmit: () => utilObjectOmit,
94526     utilOldestID: () => utilOldestID,
94527     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
94528     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
94529     utilQsString: () => utilQsString,
94530     utilRebind: () => utilRebind,
94531     utilSafeClassName: () => utilSafeClassName,
94532     utilSessionMutex: () => utilSessionMutex,
94533     utilSetTransform: () => utilSetTransform,
94534     utilStringQs: () => utilStringQs,
94535     utilTagDiff: () => utilTagDiff,
94536     utilTagText: () => utilTagText,
94537     utilTiler: () => utilTiler,
94538     utilTotalExtent: () => utilTotalExtent,
94539     utilTriggerEvent: () => utilTriggerEvent,
94540     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
94541     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
94542     utilUniqueDomId: () => utilUniqueDomId,
94543     utilWrap: () => utilWrap,
94544     validationAlmostJunction: () => validationAlmostJunction,
94545     validationCloseNodes: () => validationCloseNodes,
94546     validationCrossingWays: () => validationCrossingWays,
94547     validationDisconnectedWay: () => validationDisconnectedWay,
94548     validationFormatting: () => validationFormatting,
94549     validationHelpRequest: () => validationHelpRequest,
94550     validationImpossibleOneway: () => validationImpossibleOneway,
94551     validationIncompatibleSource: () => validationIncompatibleSource,
94552     validationMaprules: () => validationMaprules,
94553     validationMismatchedGeometry: () => validationMismatchedGeometry,
94554     validationMissingRole: () => validationMissingRole,
94555     validationMissingTag: () => validationMissingTag,
94556     validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
94557     validationOsmApiLimits: () => validationOsmApiLimits,
94558     validationOutdatedTags: () => validationOutdatedTags,
94559     validationPrivateData: () => validationPrivateData,
94560     validationSuspiciousName: () => validationSuspiciousName,
94561     validationUnsquareWay: () => validationUnsquareWay
94562   });
94563   var debug, setDebug, d3;
94564   var init_index = __esm({
94565     "modules/index.js"() {
94566       "use strict";
94567       init_actions();
94568       init_behavior();
94569       init_core();
94570       init_geo2();
94571       init_modes2();
94572       init_operations();
94573       init_osm();
94574       init_presets();
94575       init_renderer();
94576       init_services();
94577       init_svg();
94578       init_fields();
94579       init_intro2();
94580       init_panels();
94581       init_panes();
94582       init_sections();
94583       init_settings();
94584       init_ui();
94585       init_util();
94586       init_validations();
94587       init_src31();
94588       debug = false;
94589       setDebug = (newValue) => {
94590         debug = newValue;
94591       };
94592       d3 = {
94593         dispatch: dispatch_default,
94594         geoMercator: mercator_default,
94595         geoProjection: projection,
94596         polygonArea: area_default3,
94597         polygonCentroid: centroid_default2,
94598         select: select_default2,
94599         selectAll: selectAll_default2,
94600         timerFlush
94601       };
94602     }
94603   });
94604
94605   // modules/id.js
94606   var id_exports = {};
94607   var init_id2 = __esm({
94608     "modules/id.js"() {
94609       init_fetch();
94610       init_polyfill_patch_fetch();
94611       init_index();
94612       window.requestIdleCallback = window.requestIdleCallback || function(cb) {
94613         var start2 = Date.now();
94614         return window.requestAnimationFrame(function() {
94615           cb({
94616             didTimeout: false,
94617             timeRemaining: function() {
94618               return Math.max(0, 50 - (Date.now() - start2));
94619             }
94620           });
94621         });
94622       };
94623       window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
94624         window.cancelAnimationFrame(id2);
94625       };
94626       window.iD = index_exports;
94627     }
94628   });
94629   init_id2();
94630 })();
94631 //# sourceMappingURL=iD.js.map